* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.tab-btn {
    flex: 1;
    padding: 15px 30px;
    border: none;
    background: transparent;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    color: #6c757d;
}

.tab-btn:hover {
    background: #e9ecef;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.tab-content {
    padding: 30px;
    min-height: 600px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Chat styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
}

.message {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 10px;
    max-width: 80%;
    animation: fadeIn 0.3s;
}

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

.message.user {
    background: #667eea;
    color: white;
    margin-left: auto;
}

.message.assistant {
 white-space: pre-wrap;
 line-height: 1.6;
font-family: system-ui, -apple-system, sans-serif;
    background: white;
    border: 1px solid #e9ecef;
}

.message.system {
    background-color: #fee2e2; /* Fond rouge clair */
    color: #991b1b; /* Texte rouge foncé */
    border-left: 4px solid #ef4444;
    padding: 10px;
    margin: 10px 0;
    border-radius: 6px;
    font-size: 0.9em;
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input textarea {
    flex: 1;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    resize: none;
    font-family: inherit;
    font-size: 1em;
}

.chat-input textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Input section */
.input-section {
    margin-bottom: 30px;
}

.input-section textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    margin-bottom: 10px;
    font-family: inherit;
    font-size: 1em;
    resize: vertical;
}

.input-section select {
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    margin-bottom: 10px;
    margin-right: 10px;
}

.input-section select:focus,
.input-section textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

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

/* Result container */
.result-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    min-height: 300px;
}

.result-container img {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.result-container pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    line-height: 1.6;
}

.result-container code {
    font-family: 'Courier New', monospace;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        border-bottom: 1px solid #e9ecef;
    }
    
    .message {
        max-width: 95%;
    }
    
    .chat-input {
        flex-direction: column;
    }
}
/* --- Boutons d'action (Copier / Télécharger) --- */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.message:hover .action-buttons {
    opacity: 1;
}

.btn-action {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.85em;
    color: #555;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: #f5f5f5;
    border-color: #ccc;
    color: #333;
    transform: translateY(-1px);
}

.btn-action:active {
    transform: translateY(0);
}
/* --- CORRECTION SALUT EN BLEU MARINE--- */
.user-greeting {
    color: #1e3a5f !important; /* Bleu marine profond, contraste excellent sur blanc */
    font-weight: 600;
    text-shadow: none; /* L'ombre n'est plus nécessaire sur fond clair */
}

/* --- BOUTON BOUTIQUE --- */
.btn-shop {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); /* Dégradé vert/teal visible */
    color: #0f3a2d;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-shop:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    color: #0a281e;
    text-decoration: none;
}

/* Ajustement responsive si besoin */
@media (max-width: 768px) {
    .top-bar {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
    .btn-shop, .btn-recharge {
        padding: 6px 12px;
        font-size: 0.9em;
    }
}
/* --- TOP BAR RESPONSIVE --- */
.top-bar-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap; /* Permet le passage à la ligne sur mobile */
    justify-content: center; /* Centre les éléments, même sur 2 lignes */
    gap: 10px;
    padding: 10px 0;
    overflow: visible; /* Empêche le contenu d'être coupé */
}

.top-item {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s;
}

.top-item:hover { opacity: 0.85; text-decoration: none; }

.badge-plan { background: #e9f7ef; color: #27ae60; border: 1px solid #27ae60; }
.badge-pro { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

.user-greeting {
    color: #1e3a5f !important;
    font-weight: 600;
    text-shadow: none;
}

/* --- OPTIMISATION MOBILE --- */
@media (max-width: 768px) {
    .top-bar-container {
        gap: 8px;
        padding: 8px 0;
    }
    .top-item {
        font-size: 0.8em; /* Police légèrement réduite */
        padding: 5px 10px; /* Espacement interne adapté aux doigts */
    }
}

/* style.css */

.btn-new-chat {
    display: inline-flex;
    align-items: center;
    gap: 8px; /* Espace entre l'icône et le texte */
    padding: 8px 16px;
    background-color: #ffffff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-left: 15px; /* Espace par rapport au titre */
}

.btn-new-chat:hover {
    background-color: #f0f4f8;
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-1px);
}

.btn-new-chat svg {
    width: 18px;
    height: 18px;
}

/* Ajustement pour mobile si nécessaire */
@media (max-width: 768px) {
    .btn-new-chat span {
        display: none; /* Cache le texte sur petit écran, garde l'icône */
    }
    .btn-new-chat {
        padding: 8px;
    }
}
