/* ============================================================================
   SIDEBAR NAVIGATION
   Two-panel vertical sidebar: icon rail + expandable sub-panel
   ============================================================================ */

/* Layout container - sidebar + main content */
.app-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 10px;
    padding-left: 5px;
}

/* === SIDEBAR CONTAINER === */
.sidebar {
    display: flex;
    position: sticky;
    top: 10px;
    height: calc(100vh - 20px);
    z-index: 200;
}

/* === ICON RAIL === */
.sidebar-rail {
    width: 64px;
    min-width: 64px;
    background: #1e293b;
    border: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    padding-top: 8px;
    margin: 5px 0;
    border-radius: 7px;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 44px;
    color: #94a3b8;
    cursor: pointer;
    margin-bottom: 8px;
    text-decoration: none;
    transition: color 0.15s;
    opacity: 0.8;
}

.sidebar-logout:hover {
    color: #f87171;
    opacity: 1;
}

.sidebar-rail-item {
    width: 64px;
    height: auto;
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #94a3b8;
    transition: all 0.15s ease;
    position: relative;
}

.sidebar-rail-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.sidebar-rail-label {
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.sidebar-rail-item:hover {
    background: #1e293b;
    color: #e2e8f0;
}

.sidebar-rail-item.active {
    color: #60a5fa;
    background: #1e293b;
}

.sidebar-rail-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: #3b82f6;
    border-radius: 0 2px 2px 0;
}

.sidebar-rail-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    margin-left: 8px;
    padding: 6px 10px;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    pointer-events: none;
    z-index: 300;
}

.sidebar-rail-item:hover::after {
    opacity: 1;
    visibility: visible;
}

.sidebar.expanded .sidebar-rail-item::after {
    display: none;
}

/* === SUB-PANEL === */
.sidebar-panel {
    width: 0;
    overflow: hidden;
    background: #1e293b;
    transition: width 0.2s ease, border 0.2s ease;
    display: flex;
    flex-direction: column;
    margin: 5px;
    border-radius: 7px;
    border: none;
}

.sidebar.expanded .sidebar-panel {
    width: 280px;
    border: 1px solid #1e293b;
}

.sidebar-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #1e293b;
    min-height: 56px;
}

.sidebar-panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
}

.sidebar-collapse-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1;
    padding: 0;
    text-align: center;
}

.sidebar-collapse-btn:hover {
    background: #475569;
    color: #f1f5f9;
}

.sidebar-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 12px 8px;
    margin-top: 4px;
}

.sidebar-section-label:first-child {
    margin-top: 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 450;
    transition: all 0.15s ease;
    white-space: nowrap;
    margin-bottom: 2px;
}

.sidebar-nav-item:hover {
    background: #334155;
    color: #f1f5f9;
}

.sidebar-nav-item.active {
    background: #1e3a5f;
    color: #60a5fa;
}

.sidebar-nav-item-icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* === DIVIDER === */
.sidebar-divider {
    padding: 16px 14px 8px;
    margin-top: 12px;
    margin-bottom: 4px;
    background: transparent;
    pointer-events: none;
}

.sidebar-divider span {
    display: block;
    font-size: 0.625rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: transparent;
}

/* === MAIN CONTENT AREA === */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.main-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #0f172a;
}

.main-container {
    flex: 1;
    margin: 0 auto;
    padding: 5px 32px;
    width: 100%;
    box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.15);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sidebar-rail {
        width: 56px;
        min-width: 56px;
    }

    .sidebar-rail-item {
        width: 56px;
        padding: 8px 4px;
    }

    .sidebar-rail-icon {
        font-size: 1.1rem;
    }

    .sidebar-rail-label {
        font-size: 0.5625rem;
    }

    .sidebar.expanded .sidebar-panel {
        width: 240px;
    }
}

/* === PANEL ITEM ANIMATIONS === */
.sidebar-panel-content .sidebar-nav-item {
    opacity: 0;
    transform: translateX(-8px);
}

.sidebar.expanded .sidebar-panel-content .sidebar-nav-item {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar.expanded .sidebar-panel-content .sidebar-nav-item:nth-child(1) {
    transition-delay: 0.02s;
}

.sidebar.expanded .sidebar-panel-content .sidebar-nav-item:nth-child(2) {
    transition-delay: 0.04s;
}

.sidebar.expanded .sidebar-panel-content .sidebar-nav-item:nth-child(3) {
    transition-delay: 0.06s;
}

.sidebar.expanded .sidebar-panel-content .sidebar-nav-item:nth-child(4) {
    transition-delay: 0.08s;
}

.sidebar.expanded .sidebar-panel-content .sidebar-nav-item:nth-child(5) {
    transition-delay: 0.10s;
}

.sidebar.expanded .sidebar-panel-content .sidebar-nav-item:nth-child(6) {
    transition-delay: 0.12s;
}
