/* ============================================================================
   France Factures — feuille de style des pages publiques
   (login, activation, reset, TOTP, commande, erreurs, Digiteal)
   Tokens alignés sur la SPA : palette "Encre Marine + Or".
   Polices auto-hébergées (conformité CNIL — pas de CDN tiers).
   ============================================================================ */

@font-face {
    font-family: 'Inter Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
    font-family: 'Bricolage Grotesque Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 200 800;
    src: url('../fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2-variations');
}

:root {
    --marine-50:  #f2f4fb;
    --marine-100: #e2e7f7;
    --marine-200: #c9d2f0;
    --marine-300: #a5b3e4;
    --marine-500: #5468c2;
    --marine-600: #3d4fae;
    --marine-700: #32408f;
    --marine-800: #2b3674;
    --marine-900: #242c59;
    --marine-950: #161b3a;

    --gold:      #b9892f;
    --gold-soft: #f5eedb;

    --canvas: #f2f4fb;
    --panel:  #ffffff;
    --ink:    #0b1220;
    --sub:    #475569;
    --faint:  #7c879b;
    --edge:   #d8dfea;

    --pos: #16a34a;  --pos-soft: #e7f6ee;  --pos-edge: #b7e4c7;
    --neg: #dc2626;  --neg-soft: #fdeaea;  --neg-edge: #f5c2c2;

    --focus-ring: rgba(61, 79, 174, 0.25);
    --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 24px -14px rgba(15, 23, 42, 0.20);

    --font-sans: 'Inter Variable', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Bricolage Grotesque Variable', 'Inter Variable', system-ui, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    color: var(--ink);
    background: var(--canvas);
    min-height: 100vh;
}

/* ===== Monogramme (SVG inline dans les templates) ===== */
.brand-mark { display: inline-block; vertical-align: middle; }

/* ============================================================
   Layout "split" (login) : panneau marque à gauche, formulaire à droite
   ============================================================ */
.auth-split {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
@media (min-width: 900px) {
    .auth-split { flex-direction: row; }
}
.auth-brand {
    display: none;
    background: var(--marine-900);
    color: #fff;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 3.5rem;
    width: 44%;
    min-width: 380px;
}
.auth-brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    font-weight: 700;
    font-size: 1rem;
}
.auth-brand-logo small {
    display: block;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--marine-300);
}
.auth-brand-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.6vw, 2.15rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    max-width: 24ch;
}
.auth-brand-rule {
    width: 56px;
    height: 4px;
    border-radius: 2px;
    background: var(--gold);
    margin: 1.75rem 0;
}
.auth-brand-points {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    color: var(--marine-100);
    font-size: 0.95rem;
}
.auth-brand-points li {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    line-height: 1.45;
}
.auth-brand-points li::before {
    content: '';
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border-radius: 50%;
    background: var(--marine-700)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e9c46a' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E")
        center / 11px no-repeat;
}
.auth-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}
@media (min-width: 900px) {
    .auth-brand { display: flex; }
}

/* Bandeau marque compact (mobile, et pages à carte centrée) */
.auth-topbrand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1.4rem 1rem 0;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--marine-900);
}
@media (min-width: 900px) {
    .auth-split .auth-topbrand { display: none; }
}

/* ============================================================
   Layout "centré" (totp, reset, activation, erreurs, Digiteal)
   ============================================================ */
.auth-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* ===== Carte ===== */
.card {
    background: var(--panel);
    border: 1px solid var(--edge);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}
.auth-centered .card { margin-top: 1.5rem; }

/* ===== En-tête de carte ===== */
.logo { text-align: center; margin-bottom: 2rem; }
.logo h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--marine-900);
}
.logo p { color: var(--sub); font-size: 0.875rem; margin-top: 0.3rem; }

/* ===== Alertes ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    line-height: 1.45;
}
.alert-error {
    background: var(--neg-soft);
    border: 1px solid var(--neg-edge);
    color: var(--neg);
}
.alert-success {
    background: var(--pos-soft);
    border: 1px solid var(--pos-edge);
    color: #15803d;
}
.alert-info {
    background: var(--marine-50);
    border: 1px solid var(--marine-200);
    color: var(--marine-800);
}

/* ===== Formulaires ===== */
.form-group { margin-bottom: 1.25rem; }
label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--sub);
    margin-bottom: 0.375rem;
}
input[type="email"], input[type="password"], input[type="text"] {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid #cdd6e4;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
input:focus {
    border-color: var(--marine-500);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
input:disabled { background: var(--marine-50); color: var(--sub); }
input::placeholder { color: var(--faint); }

/* Champ code TOTP */
.input-code {
    text-align: center;
    font-size: 1.5rem !important;
    letter-spacing: 0.5em;
    font-variant-numeric: tabular-nums;
}

.password-wrapper { position: relative; }
.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sub);
    font-size: 0.85rem;
    font-family: inherit;
}
.password-toggle:hover { color: var(--ink); }

/* ===== Boutons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    text-decoration: none;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.btn, .btn-primary { background: var(--marine-600); color: #fff; }
.btn:hover, .btn-primary:hover { background: var(--marine-700); }
.btn-secondary {
    background: var(--panel);
    color: var(--sub);
    border: 1px solid var(--edge);
}
.btn-secondary:hover { background: var(--marine-50); color: var(--ink); }

/* ===== Liens / textes secondaires ===== */
.links { text-align: center; margin-top: 1.5rem; }
.links a, .back {
    color: var(--marine-600);
    text-decoration: none;
    font-size: 0.875rem;
}
.links a:hover, .back:hover { text-decoration: underline; }
.links p { color: var(--sub); font-size: 0.875rem; margin-top: 0.75rem; }
.back { display: block; margin-top: 1.25rem; }

.desc { color: var(--sub); font-size: 0.9rem; margin-bottom: 1.5rem; line-height: 1.5; }
.icon { font-size: 2.25rem; margin-bottom: 1rem; }
.rules { margin-top: 1rem; font-size: 0.75rem; color: var(--faint); line-height: 1.6; }
.hint { margin-top: 0.4rem; font-size: 0.75rem; color: var(--faint); line-height: 1.5; }
.muted-note { text-align: center; color: var(--sub); font-size: 0.9rem; }

/* ===== Pages de résultat (paiement, erreurs) ===== */
.result-card { text-align: center; max-width: 440px; padding: 3rem 2.5rem; }
.result-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}
.result-icon svg { width: 32px; height: 32px; }
.result-icon-success { background: var(--pos-soft); color: var(--pos); }
.result-icon-error { background: var(--neg-soft); color: var(--neg); }
.result-card h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.5rem;
}
.result-card p { color: var(--sub); font-size: 0.95rem; line-height: 1.6; margin-bottom: 2rem; }
.result-card .btn { width: auto; padding: 0.65rem 1.5rem; font-size: 0.9rem; }

.error-code {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 700;
    color: var(--marine-200);
    line-height: 1;
}

/* ===== Pied de page discret ===== */
.auth-footer {
    margin-top: 1.75rem;
    text-align: center;
    color: var(--faint);
    font-size: 0.78rem;
}

/* ============================================================
   Page bon de commande (order.html)
   ============================================================ */
.order-navbar {
    padding: 1.5rem 2rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.order-navbar img { height: 64px; width: auto; }

.order-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

.paid-banner {
    background: var(--pos-soft);
    border: 1px solid var(--pos-edge);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.paid-banner-text { display: flex; align-items: center; gap: 0.75rem; }
.paid-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pos);
    flex-shrink: 0;
}
.paid-banner strong { color: #15803d; font-size: 0.9rem; }
.paid-banner p { color: #166534; font-size: 0.85rem; margin-top: 0.15rem; }
.paid-banner a {
    padding: 0.55rem 1.25rem;
    background: var(--pos);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.paid-banner a:hover { background: #15803d; }

.order-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
}

/* Document */
.doc {
    background: var(--panel);
    border: 1px solid var(--edge);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.doc-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--edge);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.doc-ref {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--marine-900);
}
.doc-date {
    font-size: 0.82rem;
    color: var(--faint);
    margin-top: 0.1rem;
    font-variant-numeric: tabular-nums;
}
.status-badge {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
}
.status-pending { background: #fbf0dd; color: #a16207; }
.status-paid { background: var(--pos-soft); color: #15803d; }

.parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--edge);
}
.party { padding: 1.25rem 1.5rem; }
.party:first-child { border-right: 1px solid var(--edge); }
.party-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}
.party-name { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.party-detail { font-size: 0.82rem; color: var(--sub); line-height: 1.7; margin-top: 0.1rem; }

.line-items table { width: 100%; border-collapse: collapse; }
.line-items th {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--edge);
    text-align: left;
    background: var(--marine-50);
}
.line-items th:last-child { text-align: right; }
.line-items td {
    padding: 0.8rem 1.5rem;
    font-size: 0.88rem;
    color: var(--sub);
    border-bottom: 1px solid #eef1f7;
}
.line-items td:last-child {
    text-align: right;
    font-weight: 500;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.line-items tr:last-child td { border-bottom: none; }

.totals { border-top: 1px solid var(--edge); padding: 1rem 1.5rem 1.25rem; }
.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    font-size: 0.85rem;
    color: var(--faint);
}
.total-row span:last-child { font-variant-numeric: tabular-nums; color: var(--sub); }
.total-final {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.75rem 0.85rem 0.7rem;
    margin-top: 0.6rem;
    border-radius: 10px;
    background: var(--marine-900);
}
.total-final span:first-child { font-size: 0.85rem; font-weight: 600; color: var(--marine-100); }
.total-final span:last-child {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* Sidebar paiement */
.sidebar-card {
    background: var(--panel);
    border: 1px solid var(--edge);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
}
.sidebar-title {
    font-family: var(--font-display);
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--edge);
}

.pay-cta {
    display: block;
    text-align: center;
    padding: 0.85rem;
    background: var(--marine-600);
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    transition: background 0.15s;
}
.pay-cta:hover { background: var(--marine-700); }
.pay-secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 0.7rem;
    font-size: 0.78rem;
    color: var(--faint);
}
.pay-secure svg { width: 13px; height: 13px; flex-shrink: 0; }

.info-row { margin-bottom: 0.85rem; }
.info-row:last-of-type { margin-bottom: 0; }
.info-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.15rem;
}
.info-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.info-value.mono { letter-spacing: 0.03em; }
.info-divider { border: none; border-top: 1px solid #eef1f7; margin: 1.1rem 0; }
.info-note {
    margin-top: 1.25rem;
    padding: 0.85rem;
    background: var(--marine-50);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--sub);
    line-height: 1.6;
}

.order-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--edge);
    text-align: center;
    font-size: 0.75rem;
    color: var(--faint);
}

@media (max-width: 820px) {
    .order-layout { grid-template-columns: 1fr; }
    .order-container { padding: 1.5rem 1rem 2rem; }
}
@media (max-width: 520px) {
    .order-container { padding: 1.25rem 0.75rem 1.5rem; }
    .order-navbar { padding: 1rem 1rem 0; }
    .parties { grid-template-columns: 1fr; }
    .party:first-child { border-right: none; border-bottom: 1px solid var(--edge); }
    .doc-header { padding: 1rem; }
    .line-items th, .line-items td { padding-left: 1rem; padding-right: 1rem; }
    .totals { padding: 1rem; }
    .paid-banner { flex-direction: column; align-items: flex-start; }
    .total-final span:last-child { font-size: 1.15rem; }
}

@media print {
    body { background: #fff; }
    .order-navbar, .order-sidebar, .paid-banner a, .order-footer { display: none !important; }
    .order-layout { grid-template-columns: 1fr; }
    .doc { box-shadow: none; }
    .total-final { background: none; border-top: 2px solid var(--ink); border-radius: 0; padding-left: 0; padding-right: 0; }
    .total-final span:first-child { color: var(--ink); }
    .total-final span:last-child { color: var(--ink); }
}
