/* ============================================================
   style.css — Styles de AllSparkAI
   ============================================================
   Thème sombre "atelier électrique" : fond nuit, cartes en
   relief, un seul accent chaud (l'étincelle ambre).
   Pas de framework CSS, pas de police externe (tout est local,
   on utilise la pile de polices du système).
   ============================================================ */

/* ----- Variables : toutes les couleurs à un seul endroit ----- */
:root {
    --fond: #0e1220;          /* Fond général, bleu nuit */
    --carte: #171d30;         /* Fond des cartes/panneaux */
    --bordure: #262f4d;       /* Bordures discrètes */
    --texte: #e8eaf2;         /* Texte principal */
    --texte-doux: #8b93ad;    /* Texte secondaire */
    --etincelle: #ffb454;     /* Accent principal (ambre) */
    --ok: #4ade80;            /* Vert = succès */
    --erreur: #f87171;        /* Rouge = erreur */
}

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

body {
    background: var(--fond);
    color: var(--texte);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

.conteneur { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ----- En-tête / navigation ----- */
header {
    border-bottom: 1px solid var(--bordure);
    padding: 16px 0;
}
header .conteneur { display: flex; align-items: center; justify-content: space-between; }

.logo {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-decoration: none;
    /* Le mot "Spark" prend un dégradé d'étincelle */
    color: var(--texte);
}
.logo span {
    background: linear-gradient(90deg, var(--etincelle), #ff7847);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

nav a {
    color: var(--texte-doux);
    text-decoration: none;
    margin-left: 18px;
    font-size: 0.95rem;
}
nav a:hover, nav a:focus { color: var(--etincelle); }

/* ----- Titres et sections ----- */
main { padding: 40px 0 80px; }
h1 { font-size: 2rem; margin-bottom: 8px; }
h2 { font-size: 1.3rem; margin: 32px 0 12px; }
.sous-titre { color: var(--texte-doux); margin-bottom: 32px; }

/* ----- Cartes ----- */
.carte {
    background: var(--carte);
    border: 1px solid var(--bordure);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

/* ----- Formulaires ----- */
label { display: block; margin-bottom: 6px; color: var(--texte-doux); font-size: 0.9rem; }

input[type="email"], input[type="password"], textarea {
    width: 100%;
    background: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    color: var(--texte);
    padding: 10px 12px;
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 16px;
}
input:focus, textarea:focus { outline: 2px solid var(--etincelle); border-color: transparent; }
textarea { min-height: 90px; resize: vertical; }

/* ----- Boutons ----- */
button, .bouton {
    display: inline-block;
    background: var(--etincelle);
    color: #1a1206;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .bouton:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: wait; }

.bouton-secondaire {
    background: transparent;
    color: var(--etincelle);
    border: 1px solid var(--etincelle);
}

/* ----- Badges de statut des jobs ----- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-pending    { background: #3b3413; color: var(--etincelle); }
.badge-processing { background: #14304a; color: #7dd3fc; }
.badge-done       { background: #123524; color: var(--ok); }
.badge-error      { background: #3b1515; color: var(--erreur); }

/* ----- Messages ----- */
.message-erreur { color: var(--erreur); margin-bottom: 16px; }
.message-ok     { color: var(--ok); margin-bottom: 16px; }

/* ----- Zone de résultat des générations ----- */
.resultat { margin-top: 16px; }
.resultat img { max-width: 100%; border-radius: 8px; border: 1px solid var(--bordure); }
.resultat pre {
    white-space: pre-wrap;       /* Retour à la ligne automatique */
    background: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    padding: 14px;
    font-family: inherit;
}

/* ----- Tableau de l'historique des jobs ----- */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--bordure); }
th { color: var(--texte-doux); font-weight: 600; }
td.prompt-cell { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----- Grille de tarifs ----- */
.grille-packs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
}
.pack { text-align: center; }
.pack .prix { font-size: 1.8rem; font-weight: 800; color: var(--etincelle); }
.pack .credits { color: var(--texte-doux); margin-bottom: 14px; }

/* ----- Solde de crédits (dashboard) ----- */
.solde {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--etincelle);
}

/* ----- Accueil : les 3 modules ----- */
.grille-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

/* ----- Accessibilité : moins d'animations si demandé ----- */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
