/* US-UI-01 Sprint 6 — sidebar fixe + collapsible
   Cible : laptops 11" et + (>= 1024px). Mobile non géré (Sprint 7+). */

/* Layout : body offset à gauche pour la sidebar */
body.layout-sidebar {
    margin: 0;
    padding-left: 240px;
    transition: padding-left .2s ease;
}
body.layout-sidebar.sidebar-collapsed {
    padding-left: 64px;
}

/* Sidebar container */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-navy-900, #1d2a6f);
    color: #fff;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 50;
    transition: width .2s ease;
    overflow: hidden;
}
.sidebar.is-collapsed { width: 64px; }

/* Brand block en haut */
.sidebar-brand {
    flex-shrink: 0;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    color: #fff;
    font-family: var(--font-display, Fraunces, serif);
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
}
.sidebar-brand-hex {
    width: 28px;
    height: 32px;
    flex-shrink: 0;
    color: var(--color-gold-500, #d4a93a);
}
.sidebar.is-collapsed .sidebar-brand-text { display: none; }

/* Nav scrollable au milieu */
.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: .75rem 0;
}
.sidebar-section { padding: .25rem 0 .75rem; }
.sidebar-section + .sidebar-section {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: .75rem;
    margin-top: .25rem;
}
.sidebar-section-label {
    display: block;
    padding: .25rem 1.25rem .4rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255, 255, 255, 0.45);
}
.sidebar.is-collapsed .sidebar-section-label { display: none; }

/* Lien */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 1.25rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: .92rem;
    line-height: 1.2;
    border-left: 3px solid transparent;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
    white-space: nowrap;
    background: none;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}
.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}
.sidebar-link.is-active {
    background: rgba(212, 169, 58, 0.12);
    color: var(--color-gold-200, #f3e3a8);
    border-left-color: var(--color-gold-500, #d4a93a);
}
.sidebar-icon {
    flex-shrink: 0;
    width: 22px;
    text-align: center;
    font-size: 1.05rem;
}
.sidebar.is-collapsed .sidebar-label { display: none; }
.sidebar.is-collapsed .sidebar-link { padding: .55rem 0; justify-content: center; }
.sidebar.is-collapsed .sidebar-link.is-active { border-left-width: 0; border-bottom: 2px solid var(--color-gold-500, #d4a93a); }

/* Footer (user + logout + collapse btn) */
.sidebar-footer {
    flex-shrink: 0;
    padding: .75rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .35rem 1.25rem .55rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: .82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar.is-collapsed .sidebar-user { padding: .35rem 0; justify-content: center; }
.sidebar-logout { margin: 0; padding: 0; }
.sidebar-link-button {
    background: none;
    border: 0;
    border-left: 3px solid transparent;
}

/* Collapse button */
.sidebar-collapse-btn {
    display: block;
    width: 100%;
    padding: .55rem 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border: 0;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    text-align: right;
    font-size: .9rem;
    transition: background .12s ease, color .12s ease;
}
.sidebar-collapse-btn:hover {
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
}
.sidebar.is-collapsed .sidebar-collapse-btn { text-align: center; padding: .55rem 0; }

/* Main content offset */
.main-with-sidebar {
    min-height: 100vh;
}

/* Cible : laptop 11" min (≥ 1024px). En dessous, on cache la sidebar
   pour éviter un rendu cassé (mobile = Sprint futur).               */
@media (max-width: 1023px) {
    body.layout-sidebar { padding-left: 0; }
    .sidebar { display: none; }
}
