/* =====================================================
DISSERTA — ESPACE ÉLÈVE (assistant IA, crédits)
===================================================== */

.espace-hero {
background: linear-gradient(135deg, #1c2f7a 0%, #3a4fd6 55%, #7a5cf0 100%);
}

.espace-section {
margin-top: 34px;
}

.espace-grille {
display: grid;
grid-template-columns: minmax(0, 1fr) 280px;
gap: 22px;
align-items: start;
}

.espace-carte {
padding: 24px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
}

.espace-carte h2,
.espace-carte h3 {
margin: 0 0 6px;
font-family: 'Manrope', Arial, sans-serif;
color: var(--text);
letter-spacing: -0.4px;
}

.espace-carte > p {
margin: 0 0 18px;
color: var(--text-light);
}

/* Solde de crédits */

.espace-solde {
position: relative;
overflow: hidden;
color: #ffffff;
background: linear-gradient(140deg, #173b82, #2457d6 60%, #6c5ce7);
border: none;
}

.espace-solde::after {
content: "";
position: absolute;
right: -40px;
bottom: -40px;
width: 140px;
height: 140px;
border: 22px solid rgba(255, 255, 255, 0.08);
border-radius: 50%;
}

.espace-solde span {
font-size: 13px;
font-weight: 700;
letter-spacing: 1px;
text-transform: uppercase;
opacity: 0.8;
}

.espace-solde strong {
display: block;
margin: 4px 0 2px;
font-family: 'Manrope', Arial, sans-serif;
font-size: 46px;
line-height: 1.1;
}

.espace-carte.espace-solde p {
margin: 0 0 18px;
color: #ffffff;
opacity: 0.85;
}

.espace-solde .btn {
position: relative;
z-index: 1;
width: 100%;
justify-content: center;
background: #ffffff;
color: var(--primary-dark);
}

.espace-solde .btn:hover {
background: var(--primary-light);
color: var(--primary-dark);
}

/* Formulaires */

.espace-formulaire label {
display: block;
margin: 14px 0 7px;
font-size: 14px;
font-weight: 700;
}

.espace-formulaire textarea,
.espace-formulaire input,
.espace-formulaire select {
width: 100%;
padding: 13px 14px;
font: inherit;
font-size: 16px;
color: var(--text);
background: #f9fbfe;
border: 1px solid #dbe3ef;
border-radius: 12px;
}

.espace-formulaire textarea {
min-height: 120px;
resize: vertical;
}

.espace-formulaire textarea:focus,
.espace-formulaire input:focus,
.espace-formulaire select:focus {
outline: none;
background: #ffffff;
border-color: var(--primary);
box-shadow: 0 0 0 4px rgba(36, 87, 214, 0.12);
}

.espace-formulaire .btn {
margin-top: 18px;
border: none;
cursor: pointer;
}

.espace-formulaire .btn[disabled] {
opacity: 0.6;
cursor: wait;
}

.espace-aide {
margin: 8px 0 0;
font-size: 13px;
color: var(--muted);
}

/* Messages */

.espace-message {
display: flex;
gap: 10px;
padding: 13px 15px;
margin-bottom: 18px;
border-radius: 14px;
font-size: 14px;
overflow-wrap: anywhere;
}

.espace-message i {
margin-top: 3px;
}

.espace-message.erreur {
background: #fdecec;
color: #a12a2e;
}

.espace-message.succes {
background: #e6f6ef;
color: #0f6e4b;
}

.espace-message.info {
background: var(--primary-light);
color: var(--primary-dark);
}

/* Historique */

.espace-liste {
margin: 0;
padding: 0;
list-style: none;
}

.espace-liste li {
display: flex;
align-items: center;
gap: 14px;
padding: 14px 0;
border-top: 1px solid var(--border);
}

.espace-liste li:first-child {
border-top: none;
}

.espace-liste-icone {
flex: 0 0 42px;
height: 42px;
display: flex;
align-items: center;
justify-content: center;
color: var(--secondary);
background: #f0edff;
border-radius: 12px;
}

.espace-liste-texte {
flex: 1;
min-width: 0;
}

.espace-liste-texte a {
display: block;
color: var(--text);
font-weight: 700;
text-decoration: none;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.espace-liste-texte a:hover {
color: var(--primary);
}

.espace-liste-texte small {
color: var(--muted);
}

.espace-badge {
flex: 0 0 auto;
padding: 4px 10px;
font-size: 12px;
font-weight: 700;
border-radius: 999px;
background: #eef1f6;
color: var(--text-light);
white-space: nowrap;
}

.espace-badge.publie,
.espace-badge.valide {
background: #e6f6ef;
color: #0f6e4b;
}

.espace-badge.attente,
.espace-badge.en_attente {
background: #fff4e0;
color: #9a5b00;
}

.espace-badge.refuse {
background: #fdecec;
color: #a12a2e;
}

/* Packs */

.espace-packs {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 16px;
}

.espace-pack {
position: relative;
display: flex;
flex-direction: column;
padding: 22px 18px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
}

.espace-pack.populaire {
border: 2px solid var(--primary);
}

.espace-pack-etiquette {
position: absolute;
top: -11px;
left: 18px;
padding: 3px 10px;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.6px;
color: #ffffff;
background: var(--primary);
border-radius: 999px;
}

.espace-pack h3 {
margin: 0;
font-family: 'Manrope', Arial, sans-serif;
}

.espace-pack-credits {
margin: 10px 0 2px;
font-family: 'Manrope', Arial, sans-serif;
font-size: 34px;
font-weight: 800;
color: var(--primary-dark);
line-height: 1.1;
}

.espace-pack-credits small {
font-size: 14px;
font-weight: 700;
color: var(--text-light);
}

.espace-pack-prix {
margin: 6px 0 4px;
font-size: 18px;
font-weight: 800;
color: var(--text);
}

.espace-pack p {
margin: 0;
font-size: 14px;
color: var(--text-light);
}

/* Étapes de paiement */

.espace-etapes {
margin: 0;
padding: 0;
list-style: none;
counter-reset: etape;
}

.espace-etapes li {
position: relative;
padding: 0 0 16px 44px;
counter-increment: etape;
}

.espace-etapes li::before {
content: counter(etape);
position: absolute;
left: 0;
top: 0;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 14px;
color: var(--primary);
background: var(--primary-light);
border-radius: 50%;
}

.espace-numeros {
display: grid;
gap: 10px;
margin: 10px 0 0;
}

.espace-numero {
display: flex;
justify-content: space-between;
gap: 10px;
padding: 12px 14px;
background: #f9fbfe;
border: 1px dashed #c9d5ea;
border-radius: 12px;
}

.espace-numero strong {
font-family: 'Manrope', Arial, sans-serif;
letter-spacing: 0.5px;
}

/* Avantages (visiteur non connecté) */

.espace-avantages {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 16px;
}

.espace-avantage i {
width: 44px;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 12px;
font-size: 18px;
color: var(--primary);
background: var(--primary-light);
border-radius: 13px;
}

.espace-actions {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-top: 22px;
}

/* Lecture d'une dissertation */

.espace-dissertation h2 {
margin: 26px 0 10px;
font-family: 'Manrope', Arial, sans-serif;
font-size: 20px;
}

.espace-dissertation h2:first-of-type {
margin-top: 0;
}

.espace-dissertation p {
margin: 0 0 14px;
color: var(--text);
line-height: 1.85;
}

/* Attente pendant la génération */

.espace-chargement {
display: none;
margin-top: 14px;
font-size: 14px;
color: var(--text-light);
}

.espace-chargement.visible {
display: block;
}

/* Barre du bas sur mobile : 5 emplacements. Le lien « Télécharger »
   reste accessible via le bouton de l'application dans l'en-tête. */
.mobile-bottom-nav .mobile-nav-telecharger {
display: none;
}

@media (max-width: 900px) {
    .espace-grille {
        grid-template-columns: minmax(0, 1fr);
    }

    .espace-grille > .espace-solde {
        order: -1;
    }

    .espace-packs,
    .espace-avantages {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 480px) {
    .espace-carte {
        padding: 18px;
    }
}

/* WhatsApp (service client) */

.btn-whatsapp {
background: #1faa59;
}

.btn-whatsapp:hover {
background: #178a47;
}

.espace-aide-whatsapp {
margin-top: 20px;
padding-top: 18px;
border-top: 1px solid var(--border);
}

.espace-aide-whatsapp p {
margin: 0 0 12px;
font-size: 14px;
color: var(--text-light);
}

.footer-whatsapp {
display: inline-flex;
align-items: center;
gap: 10px;
margin-top: 16px;
padding: 10px 14px;
color: #0f6e3a;
background: #e5f7ec;
border-radius: 12px;
font-size: 13px;
text-decoration: none;
}

.footer-whatsapp i {
font-size: 22px;
color: #1faa59;
}

.footer-whatsapp strong {
display: block;
font-size: 14px;
}
