/**
 * HEADER CSS ULTRA-PROPRE
 * Compatible tous navigateurs & simulateurs
 * Safari, Chrome, Firefox, Edge, iOS
 * Version 2.0 - Janvier 2026
 */

/* ========================================
   RESET & BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    padding-top: 70px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   HEADER
   ======================================== */
.sapeo-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    z-index: 1000;
}

.sapeo-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ========================================
   LOGO
   ======================================== */
.sapeo-logo {
    font-size: 1.75rem;
    font-weight: 800;
    color: #667eea;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.sapeo-logo:hover {
    opacity: 0.8;
}

/* ========================================
   NAVIGATION DESKTOP
   ======================================== */
.sapeo-nav {
    display: none;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .sapeo-nav {
        display: flex;
    }
}

.sapeo-nav-link {
    padding: 0.625rem 1rem;
    color: #475569;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sapeo-nav-link:hover {
    background: #f1f5f9;
    color: #667eea;
}

.sapeo-nav-link.active {
    background: #667eea;
    color: white;
}

/* ========================================
   ACTIONS
   ======================================== */
.sapeo-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ========================================
   BUTTONS
   ======================================== */
.sapeo-btn {
    padding: 0.625rem 1.25rem;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-block;
}

.sapeo-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.sapeo-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    color: white;
}

.sapeo-btn-secondary {
    background: #f8fafc;
    color: #475569;
}

.sapeo-btn-secondary:hover {
    background: #f1f5f9;
    color: #667eea;
}

@media (max-width: 767px) {
    .sapeo-btn {
        display: none;
    }
}

/* ========================================
   NOTIFICATIONS
   ======================================== */
.sapeo-notif {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8fafc;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.sapeo-notif:hover {
    background: #f1f5f9;
    color: #667eea;
    transform: scale(1.05);
}

.sapeo-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* ========================================
   USER DROPDOWN
   ======================================== */
.sapeo-dropdown {
    position: relative;
    display: none;
}

@media (min-width: 768px) {
    .sapeo-dropdown {
        display: block;
    }
}

.sapeo-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.95rem;
}

.sapeo-user-btn:hover {
    background: #f1f5f9;
    border-color: #667eea;
}

.sapeo-user-btn.active {
    background: #f1f5f9;
    border-color: #667eea;
}

.sapeo-user-btn img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.sapeo-user-btn i {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.sapeo-user-btn.active i {
    transform: rotate(180deg);
}

.sapeo-user-name {
    font-weight: 600;
    color: #475569;
}

/* Dropdown Menu */
.sapeo-dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 320px;
    max-height: 80vh;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999;
}

.sapeo-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Scrollbar */
.sapeo-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.sapeo-dropdown-menu::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.sapeo-dropdown-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

/* Dropdown Header */
.sapeo-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.sapeo-dropdown-header img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.sapeo-dropdown-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.sapeo-dropdown-email {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Dropdown Sections */
.sapeo-dropdown-section {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.sapeo-dropdown-section:last-child {
    border-bottom: none;
}

.sapeo-dropdown-title {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

/* Dropdown Links */
.sapeo-dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 0.75rem;
    color: #475569;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.sapeo-dropdown-link i {
    width: 20px;
    color: #667eea;
    font-size: 1rem;
}

.sapeo-dropdown-link span:first-of-type {
    flex: 1;
}

.sapeo-dropdown-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateX(4px);
}

.sapeo-dropdown-link:hover i {
    color: white;
}

/* Tags */
.sapeo-tag {
    padding: 0.25rem 0.5rem;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 6px;
    text-transform: uppercase;
}

.sapeo-tag.premium {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

.sapeo-tag.admin {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
}

.sapeo-dropdown-link:hover .sapeo-tag {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Logout */
.sapeo-dropdown-link.logout {
    background: #fef2f2;
    color: #dc2626;
}

.sapeo-dropdown-link.logout i {
    color: #dc2626;
}

.sapeo-dropdown-link.logout:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
}

.sapeo-dropdown-link.logout:hover i {
    color: white;
}

/* ========================================
   HAMBURGER
   ======================================== */
.sapeo-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

@media (min-width: 768px) {
    .sapeo-hamburger {
        display: none;
    }
}

.sapeo-hamburger span {
    display: block;
    width: 20px;
    height: 2.5px;
    background: #475569;
    border-radius: 2px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.sapeo-hamburger.active span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.sapeo-hamburger.active span:nth-child(2) {
    opacity: 0;
}

.sapeo-hamburger.active span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* ========================================
   MOBILE MENU
   ======================================== */
.sapeo-mobile-menu {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 999;
    display: flex;
    flex-direction: column;
}

.sapeo-mobile-menu.active {
    transform: translateX(0);
}

.sapeo-mobile-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

/* Mobile Sections */
.sapeo-mobile-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.sapeo-mobile-section:last-of-type {
    border-bottom: none;
}

/* Mobile Links */
.sapeo-mobile-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sapeo-mobile-link i:first-child {
    width: 20px;
    color: #667eea;
    font-size: 1.1rem;
}

.sapeo-mobile-link span {
    flex: 1;
}

.sapeo-mobile-link i:last-child {
    color: #cbd5e1;
    font-size: 0.875rem;
}

.sapeo-mobile-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.sapeo-mobile-link:hover i {
    color: white;
}

.sapeo-mobile-link.logout {
    background: #fee;
    color: #dc2626;
}

.sapeo-mobile-link.logout i {
    color: #dc2626;
}

.sapeo-mobile-link.logout:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
}

/* Mobile User Info */
.sapeo-mobile-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    margin-bottom: 1rem;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
}

.sapeo-mobile-user img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.sapeo-mobile-user-name {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.sapeo-mobile-user-email {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
}

/* Mobile CTA */
.sapeo-mobile-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    margin-bottom: 0.5rem;
}

.sapeo-mobile-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    color: white;
}

/* Mobile Footer */
.sapeo-mobile-footer {
    background: linear-gradient(to top, #1e293b 0%, #334155 100%);
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
    text-align: center;
}

.sapeo-mobile-footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

.sapeo-mobile-footer-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.sapeo-mobile-footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.75rem;
}

.sapeo-mobile-footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sapeo-mobile-footer-links a:hover {
    color: #667eea;
}

.sapeo-mobile-footer-links span {
    color: rgba(255, 255, 255, 0.3);
}

/* ========================================
   UTILITIES
   ======================================== */
body.menu-open {
    overflow: hidden;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
    .sapeo-container {
        padding: 0 1rem;
    }
}
