/* ====================================
   Layout principal - Aligne sur le design system myCFiA
   Sources : _app-layout.css, _sidebar.css, _header.css, _content.css
   ==================================== */

/* ==========================================================================
   APP CONTAINER (from _app-layout.css)
   ========================================================================== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ==========================================================================
   MAIN CONTENT AREA (from _app-layout.css)
   ========================================================================== */
.main {
    margin-left: 260px;
    flex: 1;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.sidebar.collapsed ~ .main {
    margin-left: 70px;
}

/* ==========================================================================
   SIDEBAR CONTAINER (from _sidebar.css)
   ========================================================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--sidebar-bg, #001f3f);
    color: #ffffff;
    padding: 0;
    z-index: 200;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ==========================================================================
   SIDEBAR COLLAPSED STATE (from _sidebar.css)
   ========================================================================== */
.sidebar.collapsed {
    width: 70px !important;
}

.sidebar.collapsed span:not(.sidebar-header span),
.sidebar.collapsed .bi-chevron-down,
.sidebar.collapsed .bi-arrow-left-circle {
    display: none !important;
}

/* UX-005 §1.3 : masquer le message "Aucune conversation favorite/recente"
   en mode sidebar repliee, sinon le texte s'enroule caractere par caractere
   sur 3 lignes dans les 70px de large. */
.sidebar.collapsed .empty-state-message {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center !important;
}

.sidebar.collapsed .nav-section-title-pill {
    padding: 0.75rem;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    cursor: default;
}

.sidebar.collapsed .sidebar-link {
    padding: 0.75rem;
    justify-content: center;
}

/* ==========================================================================
   SIDEBAR HEADER (from _sidebar.css)
   ========================================================================== */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header .btn-link,
.sidebar-header .btn-link:hover,
.sidebar-header .btn-link:focus,
.sidebar-header .btn-link:active {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
    outline: none !important;
    padding: 0 !important;
}

/* ==========================================================================
   SIDEBAR NAVIGATION SECTIONS (from _sidebar.css)
   ========================================================================== */
.nav-section {
    margin-bottom: 20px;
}

.nav-section-title-pill {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.nav-section-title-pill:hover {
    background: rgba(255, 255, 255, 0.15);
}

.nav-section-title-pill i.bi-chevron-down {
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

/* BUG-020 : aligner la taille de l'icone principale de l'en-tete de section
   (megaphone, etoile, horloge) sur la taille des icones des sidebar-link
   (20px). Le pill a un font-size: 12px (pour le label texte uppercase),
   du coup sans regle dediee l'icone bi heritait de cette petite taille
   et apparaissait deux fois plus petite que les icones du footer. */
.nav-section-title-pill i:not(.bi-chevron-down) {
    font-size: 20px;
    line-height: 1;
}

.nav-section-title-pill[aria-expanded='true'] i.bi-chevron-down {
    transform: rotate(180deg);
}

.nav-section-content {
    padding: 0;
}

/* ==========================================================================
   SIDEBAR LINKS (from _sidebar.css)
   ========================================================================== */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff;
    padding-left: 16px;
}

.sidebar-link.active {
    background: #003080;
    color: #ffffff;
}

.sidebar-link i {
    font-size: 20px;
    min-width: 24px;
    text-align: center;
    transition: transform 0.3s ease;
}

.sidebar-link:hover i {
    transform: scale(1.1);
}

/* ==========================================================================
   SIDEBAR FOOTER (from _sidebar.css)
   ========================================================================== */
.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ==========================================================================
   STICKY TOP CONTAINER
   ========================================================================== */
.sticky-top-container {
    position: sticky;
    top: 0;
    flex-shrink: 0;
    z-index: 100;
}

/* ==========================================================================
   HEADER (from _header.css)
   ========================================================================== */
.header {
    background: var(--theme-card-bg, #ffffff);
    padding: 20px 30px;
    border-bottom: 1px solid var(--theme-border-color, #e3e4e9);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* ==========================================================================
   HEADER LOGOS
   ========================================================================== */
.header-logo-picto {
    width: 37px;
    height: 40px;
}

.header-logo {
    width: auto;
    max-width: 180px;
    height: 55px;
}

/* BUG-010 : recoloration retiree au profit de variantes pre-colorees du SVG
   (logo-light.svg pour le theme clair, logo.svg blanc pour les themes sombres).
   Eliminait un FOUC de 100-300 ms visible au chargement (le logo s'affichait
   dans sa couleur SVG d'origine avant que ce CSS soit charge via app.js). */

/* ==========================================================================
   HEADER BUTTONS (from _buttons.css)
   ========================================================================== */
.header-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.header-btn-text {
    display: inline;
}

/* btn-glass : bouton outline (Ma Division, Retour CFI) */
.btn-glass {
    background: rgba(255, 255, 255, 0.6) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 48, 128, 0.2) !important;
    color: #003080 !important;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.8) !important;
    border-color: rgba(0, 48, 128, 0.3) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 48, 128, 0.15);
    color: #003080 !important;
}

.btn-glass:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(0, 48, 128, 0.1);
}

/* btn-glass-primary : bouton rempli bleu (Theme selector) */
.btn-glass-primary {
    background: rgba(0, 48, 128, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(57, 191, 239, 0.3) !important;
    color: #ffffff !important;
}

.btn-glass-primary:hover {
    background: rgba(0, 48, 128, 0.95) !important;
    border-color: rgba(57, 191, 239, 0.5) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 48, 128, 0.3);
    color: #ffffff !important;
}

/* Supprimer le caret Bootstrap sur les header-btn dropdowns */
.header-btn.dropdown-toggle::after {
    display: none;
}

.header-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   CONTENT AREA (from _content.css)
   ========================================================================== */
.home-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Page variants */
.home-content.chat-page {
    justify-content: flex-start;
}

.home-content.profile-page {
    justify-content: flex-start;
    padding: 0;
}

.home-content.campaign-page {
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
}

.home-content.settings-page {
    justify-content: flex-start;
    padding: 0;
}

.home-content.marketing-page {
    justify-content: flex-start;
    padding-top: 1rem;
}

/* ==========================================================================
   RESPONSIVE (from _app-layout.css + _header.css)
   ========================================================================== */

/* Mobile : sidebar cachee, burger pour ouvrir */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: 260px;
    }

    .main {
        margin-left: 0;
    }

    .sidebar.collapsed ~ .main {
        margin-left: 0;
    }

    .header-logo {
        max-width: 150px;
        height: 40px;
    }

    .home-content {
        padding: 1rem;
    }
}

/* Tablet : header buttons compacts */
@media (max-width: 991px) {
    .header-logo {
        display: none;
    }

    .header-btn {
        padding: 8px;
        gap: 0;
        min-width: 40px;
        justify-content: center;
    }

    .header-btn-text {
        display: none;
    }

    .header-content {
        gap: 8px;
    }

    .header-actions {
        gap: 8px;
    }
}

/* Mobile burger button */
.sidebar-mobile-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 250;
    background: var(--theme-card-bg, #ffffff);
    border: 1px solid var(--theme-border-color, #e3e4e9);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-mobile-toggle i {
    font-size: 1.5rem;
    color: #003080;
}

@media (max-width: 768px) {
    .sidebar-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 190;
}

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