/* Global Styles */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-width: 250px;
}

/* Layout Structure */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
}

.sidebar-container {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.main-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-wrapper.full-width {
    margin-left: 0;
    width: 100%;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 20px 20px;
}

/* Tablet Sidebar Adjustments */
/* 兄弟セレクタを使用したmain-wrapperの調整 */
.sidebar-container.tablet-sidebar-container ~ .main-wrapper {
    margin-left: 90px !important;
    width: calc(100% - 90px) !important;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.sidebar-container.tablet-sidebar-container.expanded ~ .main-wrapper {
    margin-left: 250px !important;
    width: calc(100% - 250px) !important;
}

/* Sidebar Styles */
.sidebar {
    height: 100%;
    padding: 20px 0;
    background-color: #212529 !important;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: white;
    background-color: var(--primary-color);
}

.sidebar .nav-link i {
    width: 20px;
    margin-right: 10px;
}

/* Mobile Sidebar */
@media (max-width: 767px) {
    .sidebar-container {
        transform: translateX(-100%);
    }
    
    .sidebar-container.show {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.btn {
    border-radius: 5px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* Tables */
.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Navbar */
.navbar {
    background-color: white !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dashboard Widgets */
.stat-card {
    border-left: 4px solid;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card.primary {
    border-left-color: var(--primary-color);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.danger {
    border-left-color: var(--danger-color);
}

/* Floating Help Button */
.floating-help-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    animation: float 3s ease-in-out infinite;
}

.floating-help-btn:hover {
    background-color: #c82333;
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.floating-help-btn:active {
    transform: scale(0.95);
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* Manual Slide Panel */
.manual-slide-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background-color: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}

.manual-slide-panel.open {
    right: 0;
}

.manual-panel-header {
    padding: 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.manual-panel-header h5 {
    margin: 0;
}

.close-panel {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6c757d;
    transition: color 0.3s ease;
}

.close-panel:hover {
    color: #212529;
}

.manual-panel-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.manual-search-box {
    margin-bottom: 20px;
}

.manual-categories .list-group-item,
.manual-results .list-group-item {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.manual-categories .list-group-item:hover,
.manual-results .list-group-item:hover {
    background-color: #f8f9fa;
}

.manual-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1045;
}

.manual-panel-overlay.show {
    display: block;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .manual-slide-panel {
        width: 100%;
        right: -100%;
    }
    
    .floating-help-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Utility Classes */
.text-truncate-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Custom Scrollbar */
.manual-panel-body::-webkit-scrollbar {
    width: 8px;
}

.manual-panel-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.manual-panel-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.manual-panel-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}