/* =========================================
   VARIABLES DE COULEURS ET THÈMES
   ========================================= */
:root {
    /* Mode Clair (Par défaut) */
    --bg: #f4f7f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #0080ff;
    --secondary: #00ffc3;
    --accent: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --input-bg: #f1f5f9;
    --border-color: #e2e8f0; /* Ajouté pour tes bordures */
}

body.dark-mode {
    /* Mode Sombre */
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc; /* Harmonisé avec le mode clair */
    --text-muted: #94a3b8;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --input-bg: #334155;
    --border-color: rgba(255, 255, 255, 0.1); /* Ajouté pour le dark mode */
}

body {scrollbar-width: none;}

/* =========================================
   COMPOSANTS AUTHENTIFICATION
   ========================================= */

.auth-tabs { 
    display: flex; 
    margin-bottom: 20px; 
    background: var(--input-bg); /* Utilise la couleur d'input pour le fond */
    border-radius: 12px;
    padding: 5px;
}

.tab-btn { 
    flex: 1; 
    padding: 12px; 
    background: none; 
    border: none; 
    color: var(--text-muted); 
    cursor: pointer; 
    transition: all 0.3s ease;
    border-radius: 10px;
    font-weight: 500;
}

/* Ton dégradé sur l'onglet actif */
.tab-btn.active { 
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #0f172a; /* Texte foncé pour le contraste sur le dégradé */
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 128, 255, 0.2);
}

.card {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: background 0.3s, color 0.3s;
    margin-bottom: 15px;
}

input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 10px;
    background: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--primary);
}
/* =========================================
   RÉGLAGES GÉNÉRAUX
   ========================================= */
* {
    box-sizing: border-box;
    transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* =========================================
   STYLES DE LA MODALE PUBLICITAIRE
========================================= */

/* Bouton pour lancer la pub */
.btn-pub {
    background: linear-gradient(135deg, #ff9d00, #ff5e00);
}

/* L'overlay global (fond flouté) */
.modal-sponsor-overlay {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-family: sans-serif;
}

/* Le bloc central qui contient tout */
.modal-sponsor-content {
    max-width: 400px;
    width: 90%;
    text-align: center;
    color: white;
    position: relative;
    padding: 20px;
}

/* Bouton fermer la croix (X) */
.modal-sponsor-close {
    position: absolute;
    right: 0px;
    top: -20px;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
    transition: 0.2s;
}

.modal-sponsor-close:hover {
    color: #ff9d00;
    transform: scale(1.1);
}

/* Titre principal */
.modal-sponsor-title {
    margin-bottom: 10px;
    color: #ff9d00;
    text-shadow: 0 2px 10px rgba(255,157,0,0.4);
}

/* Textes informatifs */
.modal-sponsor-status {
    margin-bottom: 20px;
    font-size: 1.1em;
}

.modal-sponsor-timer {
    font-weight: bold;
    color: #17a2b8;
    font-size: 1.3em;
}

.modal-sponsor-success {
    color: #28a745;
    font-size: 1.2em;
    font-weight: bold;
}

.modal-sponsor-disclaimer {
    font-size: 0.85em;
    color: #aaa;
    margin-bottom: 20px;
}

/* L'encart publicitaire (L'écran noir pour le moment) */
.modal-sponsor-box {
    background: #000000;
    border: 1px solid #111;
    border-radius: 8px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.9);
}

.modal-sponsor-box span {
    color: #333;
    font-size: 0.9em;
}

/* Bouton inactif (grisé) */
.modal-sponsor-waiting-btn {
    width: 100%;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-weight: bold;
    border: 1px solid rgba(255,255,255,0.2);
}

.modal-sponsor-waiting-btn.active-text {
    color: white;
}

/* Bouton Actif (Réclamer la récompense) */
.modal-sponsor-claim-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.1em;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
    animation: pulseAdBtn 1.5s infinite;
}

@keyframes pulseAdBtn {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}


/* Style basique pour la croix de fermeture */
.close:hover { color: #fff; }

/* =========================================
   BOUTON THÈME ET LOGO
   ========================================= */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--primary);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    font-size: 1.2rem;
    z-index: 1000;
}

.logo-box {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.6rem;
    margin: 0 auto 20px;
    box-shadow: 0 8px 16px rgba(0, 128, 255, 0.2);
}

/* =========================================
   CONTENEURS
   ========================================= */
.container {
    width: 100%;
    max-width: 750px;
    min-width: 400px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 28px;
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: var(--text-main);
}

/* Conteneur des notifications */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* Pour ne pas bloquer les clics derrière */
}

.toast {
    min-width: 280px;
    padding: 12px 20px;
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    border-left: 5px solid var(--primary);
    animation: slideInToast 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    pointer-events: auto;
}

.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
.toast.info { border-left-color: var(--primary); }

@keyframes slideInToast {
    from { transform: translateY(-100%) scale(0.8); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.toast.fade-out {
    animation: fadeOutToast 0.5s forwards;
}

@keyframes fadeOutToast {
    to { opacity: 0; transform: translateY(-20px) scale(0.9); }
}

/* =========================================
   SOLDE ET STATS
   ========================================= */
.balance-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.balance-value {
    font-size: 3.2rem;
    font-weight: 800;
    margin: 10px 0;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 20px 0;
}

.stat-card {
    background: var(--input-bg);
    padding: 14px;
    border-radius: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: background 0.1s ease; /* Transition plus rapide pour la barre */
    position: relative;
    z-index: 1;
}

.stat-card b {
    display: block;
    font-size: 1.1rem;
    color: var(--primary);
    margin-top: 4px;
    position: relative;
    z-index: 2;
}

/* =========================================
   INDICATEURS DE RENDEMENT
   ========================================= */
#status {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--primary);
}

.status-warning {
    color: var(--accent) !important;
    animation: pulse-warn 1.5s infinite;
}

@keyframes pulse-warn {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.yield-badge {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    margin: 10px 0;
    display: inline-block;
}
.hidden { display: none; }

@keyframes pulse-warn {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(245, 158, 11, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

#activity-btn {
    animation: pulse-warn 1.5s infinite;
    background: var(--accent) !important;
    border: none;
    color: white;
    margin-top: 15px;
}

/* =========================================
   BOUTONS ET INPUTS
   ========================================= */
.btn {
    width: 100%;
    border: none;
    border-radius: 16px;
    padding: 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 12px;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 128, 255, 0.3);
}

.btn-primary:active { transform: scale(0.97); }

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

.btn-mine {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: white;
    margin-top: 10px;
}

.btn-mine.active {
    background: var(--danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.tab-btn {
    flex: 1;
    padding: 10px;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(0, 255, 195, 0.1);
}

/* L'onglet actif avec le dégradé */
.active-tab {
    background: linear-gradient(to right, var(--primary), var(--secondary)) !important;
    color: var(--bg-dark) !important;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 255, 195, 0.2);
}

input {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--input-bg);
    color: var(--text);
    margin-bottom: 15px;
    font-size: 1rem;
    outline: none;
}

input:focus {
    border-color: var(--primary);
}

/* =========================================
   CHAT WINDOW
   ========================================= */

#chat-display {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Aligne tout le contenu à gauche */
    text-align: left;
    background: var(--input-bg);
    padding: 12px;
    border-radius: 8px;
    max-height: 200px;
    min-height:75px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

/* Scrollbar fine pour ne pas casser l'alignement */
#chat-display::-webkit-scrollbar {
    width: 4px;
}
#chat-display::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}


.msg { margin-bottom: 10px; line-height: 1.4; }
.msg b { color: var(--primary); margin-right: 4px; }

/* =========================================
   MODALS (STYLES IOS-LIKE)
   ========================================= */
.modal {
    position: fixed;
    max-width: 750px;
    margin:auto;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top-left-radius: 32px;
    border-top-right-radius: 32px;
    padding: 40px 24px 24px;
    box-shadow: 0 -15px 50px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transform: translateY(105%);
    transition: transform 0.4s cubic-bezier(0.32, 1, 0.23, 1);
}

.modal.active { transform: translateY(0); }

.modal h3 {
    margin-top: 0;
    font-size: 1.3rem;
    margin-bottom: 20px;
}

.modal-overlay {
    display: flex;
    align-items: flex-end; /* Aligne la modale en bas */
    justify-content: center;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px); /* Effet de flou classe */

}

.modal-overlay.active {
    visibility: visible;
    opacity: 1;
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: rgba(128, 128, 128, 0.4);
    border-radius: 10px;
    margin: -20px auto 15px;
}

/* Modifie ton .modal.active pour qu'il soit déclenché par l'overlay */
.modal-overlay.active .modal {
    transform: translateY(0);
}

/* Optionnel : ajoute un petit effet au survol des initiales dans le chat */
#chat-display span[onclick] {
    transition: opacity 0.2s;
}
#chat-display span[onclick]:hover {
    opacity: 0.7;
    text-decoration: underline;
}


.history-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    border-left: 4px solid transparent;
    margin-bottom: 8px; /* Espacement entre les lignes */
}

/* On utilise l'icône comme repère visuel à gauche */
.history-icon {
    font-size: 1.2rem;
    margin-right: 12px;
}

.history-item.received { border-left-color: var(--success); }
.history-item.sent { border-left-color: var(--danger); }

.history-details { 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; /* Prend l'espace restant */
}

.history-date { font-size: 0.7rem; opacity: 0.5; margin-top: 2px; }

/* Style pour le nom du produit sous le titre */
.history-product {
    font-size: 0.75rem;
    color: var(--accent); /* Ou une couleur qui ressort un peu */
    opacity: 0.8;
}

.history-amount { font-weight: bold; white-space: nowrap; }

.history-filters {
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 10px;
}

.filter-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 7px;
    transition: 0.3s;
    opacity: 0.6;
}

.filter-btn.active {
    background: var(--primary); /* Ou ta couleur principale */
    opacity: 1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}


.btn-archive {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-archive:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: white;
}

/* =========================================
   BARRE UTILISATEUR ET DÉCONNEXION
   ========================================= */
.user-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--input-bg);
    padding: 10px 16px;
    border-radius: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    width: 100%;
}

.username-color{
    font-weight:bold;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#display-username {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    opacity: 0.8;
}

#logout-btn {
    display: flex;
    align-items: center;
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    border: 1.5px solid var(--danger);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#logout-btn:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

#logout-btn:active {
    transform: scale(0.92);
}

/* =========================================
   UTILS
   ========================================= */
.hidden { display: none !important; }

/* Scrollbar Custom */
#chat-window::-webkit-scrollbar { width: 4px; }
#chat-window::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }


#auth-form input {
    width: 100%;
    padding-right: 45px; /* Laisse de la place pour l'icône 👁️ */
}

.auth-tabs { 
    display: flex; 
    margin-bottom: 20px; 
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 4px;
}

.tab-btn { 
    flex: 1; 
    padding: 12px; 
    background: none; 
    border: none; 
    cursor: pointer; 
    transition: all 0.3s ease;
    border-radius: 6px;
}

/* Application de ton dégradé sur l'onglet sélectionné */
.tab-btn.active { 
    opacity: 1; 
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--bg-dark); /* Pour que le texte soit lisible sur le dégradé */
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-google { 
    background: white; 
    color: #444; 
    border: none; 
    font-weight: bold; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    transition: transform 0.2s;
}

.btn-google:active { transform: scale(0.98); }

.separator { text-align: center; margin: 15px 0; opacity: 0.5; font-size: 0.8rem; position: relative; }
.separator::before, .separator::after { content: ""; position: absolute; top: 50%; width: 40%; height: 1px; background: rgba(255,255,255,0.1); }
.separator::before { left: 0; } .separator::after { right: 0; }



.auth-tabs {
    display: flex;
    gap: 10px;
    background: var(--input-bg);
    padding: 6px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: 0.3s;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #0f172a; /* Texte sombre pour contraste */
    font-weight: bold;
}

 /* Style du bouton Info flottant */
    .info-btn-top {
        position: fixed;
        top: 20px;
        left: 20px; /* Positionné à gauche. Remplace par 'right: 20px;' si ton bouton jour/nuit est à gauche */
        width: 44px;
        height: 44px;
        background: rgba(30, 30, 47, 0.8);
        border: 1px solid rgba(255, 157, 0, 0.4);
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #ff9d00;
        cursor: pointer;
        transition: all 0.3s ease;
        backdrop-filter: blur(5px);
        z-index: 1000;
        text-decoration: none;
    }

    .info-btn-top:hover {
        background: rgba(255, 157, 0, 0.2);
        box-shadow: 0 0 15px rgba(255, 157, 0, 0.6);
        transform: scale(1.1);
        color: #ffffff;
        border-color: #ff9d00;
    }

    .info-btn-top svg {
        width: 22px;
        height: 22px;
    }
    
    
    .crypto-panel {
        background: rgba(30, 30, 47, 0.8);
        border: 1px solid #ff9d00;
        border-radius: 12px;
        padding: 20px;
        text-align: center;
        max-width: 300px;
        margin: 20px auto;
        color: white;
        font-family: 'Segoe UI', sans-serif;
    }

    .btn-crypto {
        background: #ff9d00;
        color: #12121c;
        border: none;
        padding: 10px 20px;
        border-radius: 8px;
        font-weight: bold;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        transition: 0.3s;
    }

    .btn-crypto:hover {
        background: #ffb74d;
        box-shadow: 0 0 15px rgba(255, 157, 0, 0.4);
    }

    .balance-display {
        font-size: 24px;
        font-weight: bold;
        color: #ff9d00;
        margin: 10px 0;
        padding: 10px;
        background: rgba(0,0,0,0.3);
        border-radius: 8px;
    }

    .wallet-address {
        font-size: 12px;
        color: #aaa;
        word-break: break-all;
    }

    .network-status {
        font-size: 12px;
        margin-top: 5px;
    }
    
    .network-ok { 
        color: #28a745; 
    }
    
    .network-error { 
        color: #dc3545;
    }