/* ============================================================
   Spectrum-Inspired Sidebar Navigation
   Etihad Design System Documentation
   ============================================================ */

/* --- Sidebar Container --- */
.sidebar {
    width: 280px;
    min-width: 280px;
    background-color: #ffffff;
    border-right: 1px solid #e4e4e7;
    position: sticky;
    top: 0;
    height: calc(100vh);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0 40px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

/* --- Sidebar Toggle Button --- */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 200;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #263a46;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.sidebar-toggle:hover {
    background: #34556f;
    transform: scale(1.05);
}

.sidebar-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: white;
    stroke-width: 2;
    stroke-linecap: round;
}

/* --- Search Box --- */
.sidebar-search {
    padding: 0 16px 16px;
    position: relative;
}

.sidebar-search input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    font-size: 13px;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    background: #f9fafb;
    color: #333;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sidebar-search input:focus {
    border-color: #B08747;
    box-shadow: 0 0 0 3px rgba(176, 135, 71, 0.12);
    background: #fff;
}

.sidebar-search input::placeholder {
    color: #9ca3af;
}

.sidebar-search-icon {
    position: absolute;
    left: 28px;
    top: 20px;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    pointer-events: none;
    color: #9ca3af;
}

/* --- Sidebar Section Group --- */
.sidebar-group {
    margin-bottom: 4px;
}

/* --- Group Header (Expand/Collapse Toggle) --- */
.sidebar-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 10px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-group-header:hover {
    background-color: #f4f4f5;
}

.sidebar-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #71717a;
    line-height: 1;
    flex: 1;
}

.sidebar-group-chevron {
    width: 16px;
    height: 16px;
    color: #a1a1aa;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.sidebar-group.collapsed .sidebar-group-chevron {
    transform: rotate(-90deg);
}

/* --- Group Items Container --- */
.sidebar-group-items {
    overflow: hidden;
    max-height: 1500px;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
    opacity: 1;
}

.sidebar-group.collapsed .sidebar-group-items {
    max-height: 0;
    opacity: 0;
}

/* --- Navigation Links --- */
.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0 0 8px;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px 7px 28px;
    color: #52525b;
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar-nav a:hover {
    color: #263a46;
    background-color: #f9fafb;
    border-left-color: #e4e4e7;
}

.sidebar-nav a.active {
    color: #263a46;
    font-weight: 600;
    background-color: #fef9f0;
    border-left-color: #B08747;
}

.sidebar-nav a.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #B08747;
    border-radius: 3px 0 0 3px;
}

/* Optional icon in nav items */
.sidebar-nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}

.sidebar-nav a:hover .sidebar-nav-icon,
.sidebar-nav a.active .sidebar-nav-icon {
    opacity: 1;
}

/* Badge (e.g., "New", count) */
.sidebar-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    background: #B08747;
    color: white;
    margin-left: auto;
    line-height: 1.2;
}

/* --- On This Page / Sub-Navigation --- */
.sidebar-subnav a {
    font-size: 12.5px;
    padding: 5px 16px 5px 28px;
    color: #71717a;
}

.sidebar-subnav a:hover {
    color: #263a46;
}

.sidebar-subnav a.active {
    color: #B08747;
    font-weight: 600;
    background-color: transparent;
    border-left-color: #B08747;
}

.sidebar-subnav a.active::after {
    display: none;
}

.sidebar-subnav .sidebar-sub-item {
    padding-left: 40px;
    font-size: 12px;
    color: #a1a1aa;
}

.sidebar-subnav .sidebar-sub-item:hover {
    color: #52525b;
}

.sidebar-subnav .sidebar-sub-item.active {
    color: #B08747;
    font-weight: 500;
    border-left-color: #B08747;
}

/* On This Page group has a distinct header look */
[data-group="on-this-page"] .sidebar-group-title {
    color: #B08747;
    font-size: 10px;
    letter-spacing: 0.1em;
}

.sidebar-badge--new {
    background: #16a34a;
}

.sidebar-badge--count {
    background: #e4e4e7;
    color: #52525b;
}

/* --- Sidebar Divider --- */
.sidebar-divider {
    height: 1px;
    background: #e4e4e7;
    margin: 8px 16px;
}

/* --- Sidebar Footer --- */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #e4e4e7;
    margin-top: 16px;
}

.sidebar-footer a {
    display: block;
    padding: 6px 0;
    color: #71717a;
    text-decoration: none;
    font-size: 12px;
    transition: color 0.15s;
}

.sidebar-footer a:hover {
    color: #B08747;
}

/* ============================================================
   Mobile / Tablet Responsive
   ============================================================ */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: none;
        z-index: 150;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.15);
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 140;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.visible {
        display: block;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 100%;
        min-width: 100%;
    }
}
