/* ========================================
   VARIABLES DE COULEURS
   ======================================== */
:root {
    --primary-orange: #F66B0E;
    --primary-orange-hover: #E55A00;
    --primary-orange-light: #FF7A1F;
    --text-dark: #212121;
    --text-secondary: #757575;
    --text-light: #9E9E9E;
    --bg-cream: #FFF8F1;
    --bg-white: #FFFFFF;
    --bg-light-gray: #F5F5F5;
    --bg-dark: #1A1A1A;
    --border-color: #E0E0E0;
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.15);
    --header-height: 70px;
    --transition-speed: 0.3s;
}

/* ========================================
   DARK MODE
   ======================================== */
[data-theme="dark"] {
    --primary-orange: #F66B0E;
    --primary-orange-hover: #FF7A1F;
    --primary-orange-light: #FF9447;
    --text-dark: #F5F5F5;
    --text-secondary: #BDBDBD;
    --text-light: #757575;
    --bg-cream: #2A2A2A;
    --bg-white: #1E1E1E;
    --bg-light-gray: #333333;
    --bg-dark: #0D0D0D;
    --border-color: #444444;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.5);
    --shadow-strong: rgba(0, 0, 0, 0.6);
}

/* ========================================
   RESET ET BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Lato', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-cream);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* ========================================
   HEADER PRINCIPAL
   ======================================== */
.tedplas-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    box-shadow: 0 2px 8px var(--shadow-light);
    z-index: 1000;
    height: var(--header-height);
    transition: box-shadow var(--transition-speed), background-color var(--transition-speed);
}

.tedplas-header.scrolled {
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.header-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 24px;
}

/* ========================================
   SECTION GAUCHE
   ======================================== */
.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
    flex: 1;
}

.brand-logo {
    display: flex;
    align-items: center;
    transition: opacity var(--transition-speed);
}

.brand-logo:hover { opacity: 0.85; }

.logo-image {
    height: 45px;
    width: auto;
    object-fit: contain;
}

.main-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    transition: all var(--transition-speed);
    position: relative;
}

.nav-item i {
    font-size: 18px;
    color: var(--text-secondary);
    transition: color var(--transition-speed);
}

.nav-item:hover {
    background-color: var(--bg-cream);
    color: var(--primary-orange);
}

.nav-item:hover i { color: var(--primary-orange); }

.nav-item.active {
    color: var(--primary-orange);
    background-color: var(--bg-cream);
}

.nav-item.active i { color: var(--primary-orange); }

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 16px;
    right: 16px;
    height: 3px;
    background: var(--primary-orange);
    border-radius: 3px 3px 0 0;
}

/* ========================================
   SECTION DROITE
   ======================================== */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ========================================
   BARRE DE RECHERCHE
   ======================================== */
.header-search-form {
    flex: 1;
    max-width: 500px;
    margin-right: 16px;
}

.search-container {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 16px;
    pointer-events: none;
    transition: color var(--transition-speed);
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-white);
    color: var(--text-dark);
    transition: all var(--transition-speed);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(246, 107, 14, 0.1);
}

.search-container:focus-within .search-icon { color: var(--primary-orange); }

.search-input::placeholder { color: var(--text-light); }

.mobile-search  { display: none; }
.desktop-search { display: flex; }

.header-divider {
    width: 1px;
    height: 30px;
    background: var(--border-color);
}

/* Icônes d'actions */
.action-icons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 50%;
    transition: all var(--transition-speed);
    background: transparent;
    border: none;
    cursor: pointer;
}

.action-icon i {
    font-size: 20px;
    display: block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
}

.action-icon:hover {
    background-color: var(--bg-cream);
    color: var(--primary-orange);
}

.icon-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #FF3B30 0%, #FF6B6B 100%);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    padding: 0 5px;
    border: 2px solid var(--bg-white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: border-color var(--transition-speed);
}

/* ========================================
   MENU UTILISATEUR
   ======================================== */
.user-menu { position: relative; }

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-speed);
    font-family: inherit;
    color: var(--text-dark);
}

.user-menu-btn:hover {
    border-color: var(--primary-orange);
    background-color: var(--bg-cream);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-light-gray);
}

.user-avatar-letter {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.user-name {
    color: var(--text-dark);
    font-weight: 500;
    font-size: 14px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-btn i.fa-chevron-down {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform var(--transition-speed);
}

.user-menu:hover .user-menu-btn i.fa-chevron-down { transform: rotate(180deg); }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--shadow-medium);
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-speed);
    z-index: 100;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.dropdown-link i {
    width: 20px;
    font-size: 16px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.dropdown-link:hover {
    background-color: var(--bg-cream);
    color: var(--primary-orange);
}

.dropdown-link:hover i { color: var(--primary-orange); }

.dropdown-separator {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.logout-link { color: #FF3B30; }
.logout-link i { color: #FF3B30; }
.logout-link:hover { background-color: rgba(255, 59, 48, 0.08); }

/* ========================================
   MENU BURGER
   ======================================== */
.burger-menu {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color var(--transition-speed);
}

.burger-menu:hover { background-color: var(--bg-cream); }

.burger-menu span {
    width: 24px;
    height: 3px;
    background: var(--text-dark);
    border-radius: 3px;
    transition: all var(--transition-speed);
}

.burger-menu.active span:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); }
.burger-menu.active span:nth-child(2) { opacity: 0; }
.burger-menu.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }

/* ========================================
   SIDEBAR MOBILE
   ======================================== */
.mobile-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: var(--bg-white);
    box-shadow: -4px 0 24px var(--shadow-medium);
    z-index: 1001;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color var(--transition-speed);
    overflow-y: auto;
    /* Support barre de navigation iPhone / Android gesture nav */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-sidebar.active { right: 0; }

.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.mobile-logo img { height: 40px; }

.close-mobile-menu {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-dark);
    font-size: 20px;
    transition: all var(--transition-speed);
}

.close-mobile-menu:hover {
    background-color: var(--bg-cream);
    color: var(--primary-orange);
}

.mobile-content {
    padding: 20px;
    /* Espace suffisant en bas pour que la section langue soit toujours visible */
    padding-bottom: 50px;
}

.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-cream);
    border-radius: 12px;
    margin-bottom: 24px;
    transition: background-color var(--transition-speed);
}

.mobile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg-white);
}

.mobile-avatar-letter {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 24px;
    border: 3px solid var(--bg-white);
}

.mobile-username {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.mobile-view-profile {
    font-size: 13px;
    color: var(--primary-orange);
    text-decoration: none;
    font-weight: 500;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s;
    position: relative;
}

.mobile-nav-link i {
    width: 24px;
    font-size: 20px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    background-color: var(--bg-cream);
    color: var(--primary-orange);
}

.mobile-nav-link:hover i,
.mobile-nav-link:active i { color: var(--primary-orange); }

.mobile-badge {
    margin-left: auto;
    background: var(--primary-orange);
    color: white;
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    padding: 0 8px;
}

.mobile-nav-separator {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.mobile-nav-link.logout-link {
    color: #FF3B30;
    margin-top: 8px;
}

.mobile-nav-link.logout-link i { color: #FF3B30; }

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s;
    z-index: 999;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   RESPONSIVE TABLETTES
   ======================================== */
@media (max-width: 1024px) {
    .header-container { padding: 0 16px; }
    .header-left { gap: 24px; }
    .nav-item span { display: none; }
    .nav-item { padding: 10px; }
    .user-name { display: none; }
    .header-search-form { max-width: 350px; }
}

/* ========================================
   RESPONSIVE MOBILE
   ======================================== */
@media (max-width: 768px) {
    :root { --header-height: 60px; }

    .logo-image { height: 36px; }
    .main-navigation { display: none; }
    .header-divider { display: none; }
    .desktop-search { display: none; }

    .mobile-search {
        display: flex;
        flex: 1;
        max-width: none;
        margin-right: 8px;
    }

    .mobile-search .search-input {
        padding: 10px 12px 10px 40px;
        font-size: 14px;
    }

    .mobile-search .search-icon {
        left: 12px;
        font-size: 14px;
    }

    .action-icon.desktop-only { display: none; }
    .action-icons { gap: 0; }

    .action-icon {
        width: 40px;
        height: 40px;
    }

    .action-icon i { font-size: 18px; }
    .user-menu { display: none; }
    .burger-menu { display: flex; }
    .header-right { gap: 8px; }
}

@media (max-width: 480px) {
    .header-container { padding: 0 12px; }

    .mobile-search .search-input {
        padding: 8px 12px 8px 36px;
        font-size: 13px;
    }

    .mobile-search .search-icon {
        left: 10px;
        font-size: 13px;
    }

    .action-icons a:first-child { display: none; }
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tedplas-header { animation: slideInDown 0.5s ease-out; }

/* ========================================
   ACCESSIBILITÉ
   ======================================== */
.nav-item:focus,
.action-icon:focus,
.user-menu-btn:focus,
.burger-menu:focus {
    outline: 2px solid var(--primary-orange);
    outline-offset: 2px;
}

/* ========================================
   UTILITAIRES
   ======================================== */
.no-scroll { overflow: hidden; }

body { padding-top: var(--header-height); }

.loading { pointer-events: none; opacity: 0.6; }

a, button { -webkit-tap-highlight-color: transparent; }

.tedplas-header,
.mobile-sidebar,
.mobile-overlay { will-change: transform; }

/* ========================================
   IMPRESSIONS
   ======================================== */
@media print {
    .tedplas-header,
    .mobile-sidebar,
    .mobile-overlay { display: none; }
    body { padding-top: 0; }
}



.pwa-install-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 10px;   /* optionnel : coins arrondis style icône app */
}