/* ============================================================================
   VARIABLES ET RESET
   ============================================================================ */
:root {
    /* Palette de couleurs */
    --color-bg: #152a40;
    --color-card: #1c2d45;
    --color-accent: #ffca28;
    --color-secondary: #ef6c00;
    --color-light: #f0f0f0;
    --color-text: #e4e6ea;
    --color-user: #2e7d32;
    --color-ai: #ffca28;
    --color-success: #2e7d32;
    --color-warning: #ef6c00;
    --color-error: #ff5555;
    --color-data: #2e7d32;
    --color-web: #ef6c00;
    
    /* Dégradés */
    --gradient-main: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
    --gradient-secondary: linear-gradient(135deg, #ef6c00 0%, #d84315 100%);
    --gradient-accent: linear-gradient(135deg, #ffca28 0%, #ffd54f 100%);
    
    /* Breakpoints */
    --mobile-max: 767px;
    --tablet-min: 768px;
    --tablet-max: 1024px;
    --desktop-min: 1025px;
    
    /* Z-index */
    --z-particles: -1;
    --z-modal: 100001;
    --z-auth: 100000;
    --z-user-badge: 9998;
    --z-limit-badge: 9997;
    --z-top-bar: 9999;
    --z-language: 100000;
    --z-blog-dropdown: 10000;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* ============================================================================
   BACKGROUND ANIMATIONS
   ============================================================================ */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-particles);
    background: 
        radial-gradient(circle at 20% 20%, rgba(46, 125, 50, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(239, 108, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 202, 40, 0.05) 0%, transparent 50%);
    animation: backgroundPulse 10s ease-in-out infinite alternate;
}

@keyframes backgroundPulse {
    0% { 
        opacity: 0.5; 
        transform: scale(1); 
    }
    100% { 
        opacity: 0.8; 
        transform: scale(1.02); 
    }
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: var(--z-particles);
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: float 8s infinite linear;
    opacity: 0.6;
}

@keyframes float {
    0% { 
        transform: translateY(100vh) rotate(0deg); 
        opacity: 0; 
    }
    10% { 
        opacity: 0.6; 
    }
    90% { 
        opacity: 0.6; 
    }
    100% { 
        transform: translateY(-50px) rotate(360deg); 
        opacity: 0; 
    }
}

/* ============================================================================
   TOP BAR & HEADER
   ============================================================================ */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(28, 45, 69, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: var(--z-top-bar);
    border-bottom: 1px solid rgba(255, 202, 40, 0.2);
    min-height: 70px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 202, 40, 0.1);
    transition: all 0.3s ease;
}

.back-link:hover {
    background: var(--color-accent);
    color: var(--color-bg);
    transform: translateX(-3px);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap;
}

/* ============================================================================
   AUTHENTICATION BUTTONS
   ============================================================================ */
.auth-buttons {
    display: flex;
    gap: 10px;
}

.btn-auth-header {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-login {
    background: transparent;
    border: 2px solid var(--color-accent);
    color: var(--color-accent);
}

.btn-login:hover {
    background: var(--color-accent);
    color: var(--color-bg);
}

.btn-register {
    background: var(--color-accent);
    color: var(--color-bg);
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 202, 40, 0.4);
}

/* ============================================================================
   USER BADGE
   ============================================================================ */
.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: var(--z-user-badge);
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-email {
    font-size: 0.75rem;
    opacity: 0.7;
}

.user-tier {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-top: 4px;
    display: inline-block;
}

.user-tier.free {
    background: rgba(158, 158, 158, 0.2);
    color: #9e9e9e;
}

.user-tier.premium {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1c2d45;
}

.user-tier.formation {
    background: rgba(33, 150, 243, 0.2);
    color: #2196f3;
}

.btn-logout {
    background: rgba(239, 83, 80, 0.2);
    color: #ef5350;
    border: 1px solid rgba(239, 83, 80, 0.3);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    margin-top: 8px;
    font-family: inherit;
}

.btn-logout:hover {
    background: #ef5350;
    color: white;
    transform: translateY(-2px);
}

/* ============================================================================
   LANGUAGE SWITCHER - VERSION DESKTOP
   ============================================================================ */
.language-switcher {
    display: flex;
    visibility: visible;
    opacity: 1;
    position: relative;
    z-index: var(--z-language);
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 202, 40, 0.2);
    order: 3;
    margin-left: 15px;
    flex-wrap: nowrap;
    transform: none;
    width: auto;
    height: auto;
    min-width: auto;
    max-width: none;
}

.lang-btn {
    font-size: 1.8rem;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    border: none;
    background: transparent;
    padding: 5px;
}

.lang-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.lang-btn.active {
    opacity: 1;
}

/* ============================================================================
   PREMIUM & ADMIN BUTTONS
   ============================================================================ */
.btn-premium-header {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #152a40;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
}

.btn-premium-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
}

.btn-admin {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 8px;
    transition: all 0.3s ease;
    width: 100%;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-family: inherit;
}

.btn-admin:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
    background: linear-gradient(135deg, #c0392b, #a93226);
}

/* ============================================================================
   HEADER PRINCIPAL
   ============================================================================ */
.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    padding: 160px 20px 30px;
    margin-bottom: 20px;
    margin-top: 0;
}

.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.logo {
    max-width: 120px;
    height: auto;
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(255, 202, 40, 0.5);
    animation: logoGlow 3s ease-in-out infinite alternate;
}

@keyframes logoGlow {
    0% { 
        box-shadow: 0 0 30px rgba(255, 202, 40, 0.5); 
    }
    100% { 
        box-shadow: 
            0 0 50px rgba(255, 202, 40, 0.8), 
            0 0 70px rgba(255, 202, 40, 0.3); 
    }
}

.title {
    font-size: 3rem;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    font-weight: 800;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.3rem;
    opacity: 0.8;
    margin: 0;
    font-weight: 300;
}

/* ============================================================================
   STATISTICS BAR
   ============================================================================ */
.stats-bar-center {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    max-width: 90%;
    margin: 0 auto;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    min-width: 120px;
}

.stat-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-accent);
}

.stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 5px;
}

/* ============================================================================
   MAIN CONTAINER & LAYOUT
   ============================================================================ */
.container {
    max-width: 1400px;
    margin: 60px auto 20px;
    padding: 20px;
    display: flex;
    gap: 30px;
}

.sidebar {
    width: 280px;
    background: var(--color-card);
    border-radius: 15px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    flex-shrink: 0;
}

/* Scrollbar styling */
.sidebar::-webkit-scrollbar,
.quick-questions::-webkit-scrollbar,
.formations-list::-webkit-scrollbar,
.sources-list::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.quick-questions::-webkit-scrollbar-track,
.formations-list::-webkit-scrollbar-track,
.sources-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb,
.quick-questions::-webkit-scrollbar-thumb,
.formations-list::-webkit-scrollbar-thumb,
.sources-list::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border-radius: 10px;
}

/* ============================================================================
   FORMATIONS CATALOG
   ============================================================================ */
.sidebar h3 {
    color: var(--color-accent);
    margin-bottom: 15px;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 2px solid rgba(255, 202, 40, 0.2);
    padding-bottom: 8px;
}

.formations-list {
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.formation-card-mini {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    position: relative;
}

.formation-card-mini:hover {
    background: rgba(255, 202, 40, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 202, 40, 0.2);
}

.formation-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.formation-price {
    font-size: 0.75rem;
    color: var(--color-accent);
    margin-bottom: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.formation-price span {
    background: rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.formation-price span.purchased {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.btn-select-formation {
    background: var(--color-accent);
    color: var(--color-bg);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: inherit;
}

.btn-select-formation:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(255, 202, 40, 0.3);
    background: #ffd54f;
}

.btn-select-formation:active {
    transform: translateY(0);
}

/* ============================================================================
   QUICK QUESTIONS
   ============================================================================ */
.quick-questions {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.quick-questions li {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    line-height: 1.4;
    border-left: 3px solid transparent;
}

.quick-questions li:hover {
    background: rgba(255, 202, 40, 0.2);
    transform: translateX(5px);
    border-left-color: var(--color-accent);
}

/* ============================================================================
   SOURCES LIST
   ============================================================================ */
.sources-list {
    list-style: none;
    margin-top: 10px;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.sources-list li {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 0.75rem;
    border-left: 2px solid var(--color-data);
    line-height: 1.3;
    transition: all 0.2s ease;
}

.sources-list li:hover {
    background: rgba(255, 202, 40, 0.1);
    transform: translateX(3px);
}

.sources-list li strong {
    display: block;
    color: var(--color-accent);
    margin-bottom: 3px;
    font-size: 0.8rem;
}

/* ============================================================================
   LEARNING PROGRESS
   ============================================================================ */
.learning-progress {
    margin-top: 20px;
}

.progress-item {
    margin-bottom: 12px;
}

.progress-label {
    font-size: 0.8rem;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
}

.progress-bar {
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 3px;
    animation: progressGrow 2s ease-out;
    transition: width 0.5s ease;
}

@keyframes progressGrow {
    from { width: 0; }
}

/* ============================================================================
   CHAT AREA
   ============================================================================ */
.chat-area {
    flex: 1;
    background: var(--color-card);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    min-height: 600px;
    max-height: 80vh;
}

.chat-header {
    background: var(--gradient-main);
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.formation-select {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    cursor: pointer;
    max-width: 200px;
    font-size: 0.9rem;
    font-family: inherit;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
}

.status-online {
    background: #4caf50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================================================
   CHAT MESSAGES
   ============================================================================ */
.chat-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
}

.message {
    margin-bottom: 20px;
    animation: messageSlide 0.5s ease-out;
}

@keyframes messageSlide {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.message-bubble {
    max-width: 80%;
    padding: 15px 20px;
    border-radius: 20px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.5;
}

.message.user .message-bubble {
    background: var(--gradient-main);
    margin-left: auto;
    border-bottom-right-radius: 5px;
    color: white;
}

.message.ai .message-bubble {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 5px;
    backdrop-filter: blur(10px);
}

.message.ai[dir="rtl"] .message-bubble {
    direction: rtl;
    text-align: right;
}

/* Code styling */
.message-bubble pre {
    background: #1c1c1c;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.9rem;
    color: #f0f0f0;
    margin: 10px 0;
}

.message-bubble code {
    font-family: 'Courier New', monospace;
}

.message-bubble code:not(pre code) {
    background: rgba(255, 202, 40, 0.2);
    color: var(--color-accent);
    padding: 2px 5px;
    border-radius: 3px;
}

/* Sources container */
.sources-container {
    background: rgba(46, 125, 50, 0.1);
    border-radius: 10px;
    padding: 10px 15px;
    margin-top: 15px;
    border-left: 3px solid var(--color-data);
}

.sources-container summary {
    font-weight: 600;
    cursor: pointer;
    color: var(--color-data);
}

/* ============================================================================
   FEEDBACK BUTTONS
   ============================================================================ */
.feedback-buttons {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 1.1rem;
}

.feedback-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    opacity: 0.6;
    padding: 5px;
}

.feedback-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.feedback-btn.active-positive {
    opacity: 1;
    color: var(--color-success);
    transform: scale(1.1);
}

.feedback-btn.active-negative {
    opacity: 1;
    color: var(--color-error);
    transform: scale(1.1);
}

/* ============================================================================
   TYPING INDICATOR
   ============================================================================ */
.typing-indicator {
    display: none;
}

.typing-indicator.active {
    display: block;
}

.typing-bubble {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border-bottom-left-radius: 5px;
    padding: 15px 20px;
    max-width: 80px;
    backdrop-filter: blur(10px);
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { 
    animation-delay: 0.2s; 
}
.typing-dots span:nth-child(3) { 
    animation-delay: 0.4s; 
}

@keyframes typingBounce {
    0%, 60%, 100% { 
        transform: translateY(0); 
        opacity: 0.4; 
    }
    30% { 
        transform: translateY(-10px); 
        opacity: 1; 
    }
}

/* ============================================================================
   CHAT INPUT AREA
   ============================================================================ */
.chat-input-area {
    padding: 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.stop-typing-btn {
    background: var(--color-error);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    position: absolute;
    bottom: 60px;
    right: 25px;
    z-index: 50;
    display: none;
    font-family: inherit;
}

.input-container {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px 20px;
    color: var(--color-light);
    font-size: 1rem;
    resize: none;
    min-height: 50px;
    max-height: 150px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 202, 40, 0.1);
}

.chat-input::placeholder {
    color: rgba(228, 230, 234, 0.5);
}

.send-button {
    background: var(--gradient-accent);
    border: none;
    border-radius: 15px;
    width: 55px;
    height: 55px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(255, 202, 40, 0.4);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.input-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    opacity: 0.7;
    transition: all 0.3s ease;
    padding: 5px;
}

.action-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* ============================================================================
   SUGGESTIONS
   ============================================================================ */
.suggestions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.suggestion-chip {
    background: rgba(255, 202, 40, 0.1);
    border: 1px solid rgba(255, 202, 40, 0.3);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    user-select: none;
}

.suggestion-chip:hover {
    background: rgba(255, 202, 40, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 202, 40, 0.3);
}

.suggestion-chip:active {
    transform: translateY(0);
}

/* ============================================================================
   EMOJI PICKER
   ============================================================================ */
.emoji-picker {
    position: absolute;
    bottom: 60px;
    right: 70px;
    background: var(--color-card);
    padding: 10px;
    border-radius: 10px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    z-index: 100;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.emoji-picker span {
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
    text-align: center;
}

.emoji-picker span:hover {
    background: rgba(255, 202, 40, 0.2);
}

/* ============================================================================
   MODALS
   ============================================================================ */
.modal {
    display: none;
    position: fixed;
    z-index: var(--z-modal);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    overflow-y: auto;
    padding: 20px;
}

.modal[style*="display: block"],
.modal[style*="display:block"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--color-card);
    margin: auto;
    padding: 30px 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
    animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #ffd54f;
}

.close {
    position: sticky;
    top: 0;
    right: 0;
    float: right;
    font-size: 32px;
    font-weight: bold;
    color: var(--color-accent);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    background: var(--color-card);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 10px;
}

.close:hover,
.close:focus {
    color: #fff;
    background: var(--color-accent);
    transform: rotate(90deg);
}

.modal-content h2 {
    color: var(--color-accent);
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 700;
    clear: both;
}

/* ============================================================================
   PRICING GRID
   ============================================================================ */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 30px;
}

.pricing-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 25px 20px;
    position: relative;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.1);
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.pricing-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--color-accent);
    box-shadow: 0 10px 30px rgba(255, 202, 40, 0.2);
}

.pricing-card.featured {
    border: 2px solid var(--color-accent);
    background: rgba(255, 202, 40, 0.05);
}

.badge-best {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-accent);
    color: var(--color-bg);
    padding: 5px 15px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(255, 202, 40, 0.3);
}

.pricing-card h3 {
    font-size: 1.3rem;
    color: var(--color-accent);
    margin-bottom: 15px;
    font-weight: 600;
}

.price {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--color-accent);
    margin: 15px 0;
}

.price span {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: normal;
}

.savings {
    color: var(--color-success);
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.pricing-card ul {
    list-style: none;
    margin: 20px 0;
    flex-grow: 1;
}

.pricing-card li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 0.9rem;
    line-height: 1.4;
}

.pricing-card li:last-child {
    border-bottom: none;
}

.pricing-card button,
.btn-primary {
    background: linear-gradient(135deg, var(--color-accent), #ffd54f);
    color: var(--color-bg);
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-size: 0.95rem;
    margin-top: auto;
    font-family: inherit;
}

.pricing-card button:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 202, 40, 0.4);
    background: linear-gradient(135deg, #ffd54f, var(--color-accent));
}

/* ============================================================================
   BECOME INSTRUCTOR BUTTON
   ============================================================================ */
.btn-become-instructor {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 8px;
    transition: all 0.3s ease;
    width: 100%;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-family: inherit;
}

.btn-become-instructor:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.btn-become-instructor:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-upgrade {
    background: var(--gradient-accent);
    color: var(--color-bg);
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 202, 40, 0.4);
}

/* ============================================================================
   LIMIT BADGE
   ============================================================================ */
#limit-badge {
    position: fixed;
    top: 90px;
    right: 20px;
    background: rgba(28, 45, 69, 0.95);
    color: #fff;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: var(--z-limit-badge);
    border: 2px solid rgba(255, 202, 40, 0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    max-width: 280px;
    animation: fadeIn 0.5s ease-out;
}

#limit-badge.premium {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #152a40;
    border-color: #ffd700;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

#limit-badge a {
    text-decoration: underline;
    cursor: pointer;
    color: #ffca28;
}

#limit-badge a:hover {
    opacity: 0.8;
}

/* ============================================================================
   BLOG ACCESS
   ============================================================================ */
.blog-access-header {
    position: relative;
    display: inline-block;
}

.blog-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.blog-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.blog-dropdown-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    margin-top: 5px;
    min-width: 280px;
    z-index: var(--z-blog-dropdown);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.blog-dropdown-panel[style*="display: block"] {
    opacity: 1;
    transform: translateY(0);
}

.blog-dropdown-panel h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.blog-dropdown-panel a {
    background: rgba(255,255,255,0.9);
    color: #333;
    padding: 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    display: block;
    margin-bottom: 0.75rem;
}

.blog-dropdown-panel a:hover {
    background: white;
    transform: translateY(-2px);
}

.blog-dropdown-panel a:last-child {
    margin-bottom: 0;
}

/* ============================================================================
   DASHBOARD BUTTON
   ============================================================================ */
.btn-dashboard {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-family: inherit;
}

.btn-dashboard:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

/* ============================================================================
   FORM GROUPS (pour modals)
   ============================================================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--color-accent);
}

.form-group input,
.form-group textarea,
.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.08);
}

/* ============================================================================
   RESPONSIVE DESIGN - MOBILE (< 768px) - CORRECTION TOTALE
   ============================================================================ */
@media (max-width: 767px) {
    /* ÉVITER DÉBORDEMENT */
    body {
        overflow-x: hidden !important;
    }
    
    /* TOP BAR ULTRA-COMPACT */
    .top-bar {
        flex-direction: column;
        gap: 4px;
        padding: 6px 10px !important;
        min-height: auto !important;
        height: auto !important;
    }
    
    .top-bar-left {
        width: 100%;
        justify-content: center;
        order: 1;
        margin-bottom: 4px;
    }
    
    .top-bar-left a {
        font-size: 0.75rem !important;
        padding: 4px 8px !important;
    }
    
    .top-bar-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
        order: 2;
    }
    
    /* BOUTONS AUTH/PREMIUM COMPACTS */
    .btn-premium-header,
    .btn-auth-header {
        padding: 4px 8px !important;
        font-size: 0.7rem !important;
        order: 1;
    }
    
    .auth-buttons {
        gap: 4px;
        order: 2;
    }
    
    /* CORRECTION CRITIQUE : DRAPEAUX COMPACTS EN LIGNE */
    .language-switcher {
        display: flex !important;
        width: auto !important; /* CORRECTION : auto au lieu de 100% */
        max-width: 90vw !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 3px !important;
        padding: 4px !important;
        order: 3 !important;
        margin-top: 4px !important;
        background: rgba(255, 255, 255, 0.05) !important;
    }
    
    .lang-btn {
        font-size: 1.1rem !important; /* RÉDUIT */
        min-width: 28px !important;
        min-height: 28px !important;
        padding: 2px !important;
    }
    
    /* USER BADGE MINI EN HAUT DROITE */
    .user-badge {
        position: fixed !important;
        top: 6px !important;
        right: 6px !important;
        z-index: 10002 !important;
        font-size: 0.6rem !important;
        padding: 3px 5px !important;
        max-width: 100px !important;
        flex-direction: column !important;
        gap: 2px !important;
        background: rgba(28, 45, 69, 0.98) !important;
        backdrop-filter: blur(20px) !important;
    }
    
    .user-avatar {
        width: 18px !important;
        height: 18px !important;
    }
    
    .user-name {
        font-size: 0.65rem !important;
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .user-email {
        display: none !important;
    }
    
    .user-tier {
        font-size: 0.6rem !important;
        padding: 1px 3px !important;
    }
    
    .btn-logout,
    .btn-become-instructor,
    .btn-admin {
        font-size: 0.6rem !important;
        padding: 3px 5px !important;
        margin-top: 3px !important;
    }
    
    /* LIMIT BADGE EN BAS DROITE */
    #limit-badge {
        position: fixed !important;
        top: auto !important;
        bottom: 8px !important;
        right: 8px !important;
        left: auto !important;
        font-size: 0.65rem !important;
        padding: 5px 8px !important;
        max-width: 140px !important;
        z-index: 10001 !important;
        transform: none !important;
    }
    
    /* HEADER ULTRA-RÉDUIT */
    .header {
        padding-top: 50px !important; /* RÉDUIT de 80px à 50px */
        padding-bottom: 10px !important;
        margin-bottom: 8px !important;
    }
    
    .logo {
        max-width: 50px !important; /* RÉDUIT de 60px à 50px */
    }
    
    .title {
        font-size: 1.2rem !important;
    }
    
    .subtitle {
        font-size: 0.7rem !important;
    }
    
    /* STATS BAR ULTRA-COMPACTE */
    .stats-bar-center {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        margin-top: 10px;
        max-width: 100%;
    }
    
    .stat-item {
        padding: 6px 8px;
        min-width: auto;
    }
    
    .stat-number {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    /* CONTAINER PRINCIPAL */
    .container {
        margin-top: 10px !important; /* RÉDUIT de 20px à 10px */
        margin-bottom: 60px !important;
        padding: 6px !important;
        gap: 8px !important;
        flex-direction: column;
    }
    
    /* SIDEBAR COMPACTE */
    .sidebar {
        width: 100% !important;
        padding: 8px;
        position: static !important;
        max-height: none !important;
        margin-bottom: 8px;
    }
    
    .sidebar h3 {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    
    /* CORRECTION CRITIQUE : CHAT AREA VISIBLE */
    .chat-area {
        min-height: 400px !important; /* AUGMENTÉ */
        max-height: none !important;
        height: auto !important;
        margin-bottom: 10px;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .chat-messages {
        padding: 6px !important;
        flex: 1 !important;
        min-height: 250px !important; /* AUGMENTÉ */
        overflow-y: auto !important;
    }
    
    .chat-header {
        padding: 8px 10px !important;
        flex-wrap: wrap;
    }
    
    .chat-title {
        font-size: 0.85rem !important;
        flex: 1 1 100%;
        margin-bottom: 5px;
    }
    
    .formation-select {
        max-width: 100px !important;
        font-size: 0.65rem !important;
        padding: 3px 5px !important;
    }
    
    .chat-input-area {
        padding: 8px !important;
    }
    
    .chat-input {
        font-size: 0.8rem !important;
        padding: 6px 8px !important;
        min-height: 35px;
    }
    
    .send-button {
        width: 35px !important;
        height: 35px !important;
        font-size: 1rem !important;
    }
    
    .message-bubble {
        max-width: 92%;
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .message-bubble pre {
        font-size: 0.7rem;
        padding: 6px;
    }
    
    .suggestions {
        margin-top: 5px;
        gap: 4px;
    }
    
    .suggestion-chip {
        font-size: 0.65rem !important;
        padding: 4px 6px !important;
    }
    
    .quick-questions li {
        font-size: 0.65rem;
        padding: 5px;
    }
    
    .formations-list {
        max-height: 200px;
    }
    
    .formation-card-mini {
        padding: 6px;
    }
    
    .formation-title {
        font-size: 0.75rem;
    }
    
    .btn-select-formation {
        font-size: 0.65rem;
        padding: 4px 6px;
    }
    
    /* BLOG DROPDOWN */
    .blog-dropdown-panel {
        min-width: 240px;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        max-width: 85vw;
    }
    
    /* MODALS */
    .modal {
        padding: 6px;
    }
    
    .modal-content {
        width: 98%;
        padding: 12px 10px;
        max-height: 92vh;
    }
    
    .close {
        font-size: 22px;
        width: 28px;
        height: 28px;
    }
    
    .modal-content h2 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .pricing-card {
        padding: 12px 10px;
    }
    
    .price {
        font-size: 1.5rem;
    }
}

/* ============================================================================
   RESPONSIVE DESIGN - TABLETTE (768px - 1024px) - CORRECTION TOTALE
   ============================================================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    /* TOP BAR */
    .top-bar {
        padding: 8px 12px;
        flex-wrap: wrap;
        min-height: auto !important;
        gap: 6px;
    }
    
    .top-bar-left {
        order: 1;
        flex: 0 0 auto;
    }
    
    .top-bar-right {
        order: 2;
        flex: 1 1 auto;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .btn-premium-header {
        order: 1;
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    .auth-buttons {
        order: 2;
        gap: 5px;
    }
    
    .btn-auth-header {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    /* DRAPEAUX EN BAS */
    .language-switcher {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 6px;
        display: flex !important;
        gap: 6px !important;
    }
    
    .lang-btn {
        font-size: 1.5rem !important;
        padding: 4px !important;
    }
    
    /* HEADER PAR DÉFAUT (NON CONNECTÉ) */
    .header {
        padding-top: 150px !important;
        margin-bottom: 25px !important;
    }
    
    .logo {
        max-width: 90px !important;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .stats-bar-center {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-top: 25px;
    }
    
    .stat-item {
        min-width: 90px;
        padding: 10px 12px;
    }
    
    /* CONTAINER */
    .container {
        margin-top: 25px !important;
        padding: 10px !important;
        margin-bottom: 20px !important;
    }
    
    /* CORRECTION CRITIQUE : SIDEBAR NE DOIT PAS PRENDRE TOUT L'ESPACE */
    .sidebar {
        width: 35% !important; /* CORRECTION : 35% au lieu de 100% */
        max-width: 35% !important;
        padding: 12px;
        position: static !important;
        margin-right: 15px;
        flex-shrink: 0;
    }
    
    .sidebar h3 {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    /* Sections sidebar normales (pas en grille) */
    .quick-questions {
        display: block; /* CORRECTION : block au lieu de grid */
        max-height: 250px;
        overflow-y: auto;
    }
    
    .quick-questions li {
        font-size: 0.75rem;
        padding: 7px;
    }
    
    .formations-list {
        display: block; /* CORRECTION : block au lieu de grid */
        max-height: 300px;
        overflow-y: auto;
    }
    
    /* CORRECTION CRITIQUE : CHAT AREA VISIBLE ET PREND L'ESPACE */
    .chat-area {
        flex: 1 !important; /* CORRECTION : Prend l'espace restant */
        max-height: none !important;
        min-height: 450px !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .chat-messages {
        padding: 10px;
        min-height: 300px !important;
        flex: 1 !important;
        overflow-y: auto !important;
    }
    
    .message-bubble {
        max-width: 85%;
        padding: 10px 13px;
        font-size: 0.85rem;
    }
    
    .chat-input-area {
        padding: 10px;
    }
    
    .chat-input {
        font-size: 0.85rem;
        padding: 8px 10px;
    }
    
    .send-button {
        width: 42px;
        height: 42px;
        font-size: 1.15rem;
    }
    
    .formation-select {
        max-width: 150px !important;
        font-size: 0.75rem !important;
    }
    
    .suggestions {
        gap: 5px;
    }
    
    .suggestion-chip {
        font-size: 0.75rem;
        padding: 5px 8px;
    }
    
    /* USER BADGE QUAND CONNECTÉ */
    body.user-connected .header {
        padding-top: 90px !important;
        margin-bottom: 18px !important;
    }
    
    body.user-connected .user-badge {
        position: fixed !important;
        top: 75px !important;
        right: 12px !important;
        z-index: 10002 !important;
        max-width: 220px !important;
        box-shadow: 0 5px 20px rgba(0,0,0,0.5) !important;
        background: rgba(28, 45, 69, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        border: 2px solid rgba(255, 202, 40, 0.3) !important;
        font-size: 0.75rem !important;
        padding: 7px 9px !important;
    }
    
    body.user-connected .user-avatar {
        width: 26px !important;
        height: 26px !important;
    }
    
    /* BADGE LIMITES SOUS USER BADGE */
    body.user-connected #limit-badge {
        position: fixed !important;
        top: 165px !important;
        right: 12px !important;
        z-index: 10001 !important;
        max-width: 220px !important;
        font-size: 0.75rem !important;
        padding: 7px 10px !important;
    }
    
    /* DRAPEAUX EN BAS CENTRÉ QUAND CONNECTÉ */
    body.user-connected .language-switcher {
        position: fixed !important;
        bottom: 18px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 10000 !important;
        background: rgba(28, 45, 69, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        border: 2px solid rgba(255, 202, 40, 0.3) !important;
        padding: 8px !important;
        margin: 0 !important;
        width: auto !important;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.5) !important;
    }
    
    /* CONTAINER AVEC MARGE POUR DRAPEAUX */
    body.user-connected .container {
        margin-top: 18px !important;
        margin-bottom: 90px !important;
        padding-bottom: 18px !important;
    }
    
    /* CHAT AREA AJUSTÉ */
    body.user-connected .chat-area {
        max-height: none !important;
        min-height: 450px !important;
        margin-bottom: 18px !important;
    }
    
    /* SIDEBAR TAILLE RÉDUITE QUAND CONNECTÉ */
    body.user-connected .sidebar {
        width: 30% !important;
        max-width: 30% !important;
    }
    
    /* MODAL */
    .modal-content {
        width: 80%;
        padding: 18px;
    }
    
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* ============================================================================
   RESPONSIVE DESIGN - DESKTOP (> 1024px)
   ============================================================================ */
@media (min-width: 1025px) {
    /* Desktop parfait - conservation */
    .language-switcher {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 100000 !important;
        gap: 6px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        padding: 8px !important;
        border-radius: 12px !important;
        border: 1px solid rgba(255, 202, 40, 0.2) !important;
        order: 3 !important;
        margin-left: 15px !important;
        flex-wrap: nowrap !important;
        transform: none !important;
        width: auto !important;
        height: auto !important;
        min-width: auto !important;
        max-width: none !important;
    }
    
    .top-bar-right {
        display: flex !important;
        align-items: center !important;
        gap: 15px !important;
        flex-wrap: nowrap !important;
    }
    
    .btn-premium-header {
        order: 1 !important;
    }
    
    .auth-buttons {
        order: 2 !important;
    }
    
    .language-switcher {
        order: 3 !important;
    }
    
    /* CORRECTION : USER BADGE POSITION */
    body.user-connected .user-badge {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        z-index: var(--z-user-badge) !important;
    }
    
    /* CORRECTION : LIMIT BADGE VISIBLE EN DESKTOP CONNECTÉ */
    body.user-connected #limit-badge {
        position: fixed !important;
        top: 90px !important;
        right: 20px !important;
        z-index: var(--z-limit-badge) !important;
        max-width: 280px !important;
    }
    
    /* CORRECTION : BLOG NE CHEVAUCHE PAS */
    .blog-access-header {
        margin-right: 10px;
    }
    
    /* Sidebar large sur desktop connecté */
    body.user-connected .sidebar {
        width: 280px !important;
        max-width: 280px !important;
    }
}

/* ============================================================================
   GLOBAL RESPONSIVE CORRECTIONS
   ============================================================================ */
@media (max-width: 1024px) {
    /* Éviter débordement horizontal */
    body {
        overflow-x: hidden !important;
    }
    
    .container,
    .chat-area,
    .sidebar {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        padding: 25px 20px;
    }
    
    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .pricing-card {
        min-height: auto;
    }
    
    .modal-content h2 {
        font-size: 1.5rem;
    }
    
    .price {
        font-size: 2rem;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */
.formations-list:empty::after,
.sources-list:empty::after {
    content: "Aucun élément disponible";
    display: block;
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    font-style: italic;
}

.modal.modal-over-auth {
    z-index: 100002 !important;
}

.auth-modal.active + .modal {
    z-index: 100002 !important;
}

/* Direction RTL pour l'arabe */
body[dir="rtl"] {
    text-align: right;
}

body[dir="rtl"] .message.ai .message-bubble {
    direction: rtl;
    text-align: right;
}

body[dir="rtl"] .chat-input,
body[dir="rtl"] .form-input {
    direction: rtl;
    text-align: right;
}

/* Hide elements */
.hidden {
    display: none !important;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 202, 40, 0.3);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
