/**
 * Crypt - Styles.
 * Cohérent avec l'identité Spleen Creation (voir module QR Code).
 */

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

:root {
    --ink: #22303f;
    --ink-soft: #5b6b7a;
    --line: #e7ebef;
    --bg: #f4f6f8;
    --field: #fff;
    --accent: #2c3e50;
    --green: #1f9d63;
    --green-bg: #eaf6ef;
    --green-line: #cfe9db;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    padding: 18px;
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 690px;
    margin: 0 auto;
    background: white;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(16,32,48,.04), 0 10px 30px rgba(16,32,48,.07);
    overflow: hidden;
}

/* ---------- Header ---------- */
header {
    background: white;
    padding: 20px 28px;
    border-bottom: 1px solid var(--line);
}
.header-content { display: flex; align-items: center; gap: 18px; }
.header-logo a { display: block; transition: opacity .2s; }
.header-logo a:hover { opacity: .8; }
.logo-img { height: 38px; width: auto; display: block; }
.header-text { flex: 1; }

/* Wordmark « Crypt » : typographie resserrée */
header h1 {
    font-size: 1.5em;
    font-weight: 600;
    letter-spacing: -.4px;
    color: var(--ink);
    line-height: 1;
}
.subtitle { font-size: .84em; color: var(--ink-soft); font-weight: 400; margin: 5px 0 0; }

/* ---------- Layout ---------- */
.main-narrow { padding: 26px 28px; }

.card {
    background: #fbfcfd;
    padding: 24px;
    border-radius: 11px;
    border: 1px solid var(--line);
}
.card + .card { margin-top: 16px; }

/* ---------- Intro ---------- */
.intro { margin-bottom: 20px; }
.intro-lead { font-size: 1.05em; color: var(--ink); font-weight: 650; margin-bottom: 4px; letter-spacing: -.3px; white-space: nowrap; }
.intro-sub { font-size: .88em; color: var(--ink-soft); }

/* ---------- Form ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 550;
    color: var(--ink);
    font-size: .9em;
}
.form-group textarea,
.form-group select,
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #dbe1e7;
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    background: var(--field);
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
.form-group textarea { resize: vertical; min-height: 116px; line-height: 1.5; }
.form-group textarea:focus,
.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(44,62,80,.1);
}
.form-group select {
    cursor: pointer;
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235b6b7a' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    background-size: 11px;
    padding-right: 38px;
}
.form-group small { display: block; margin-top: 6px; color: #98a4b0; font-size: .78em; }
.counter { text-align: right; }

.checkbox {
    display: flex !important;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-weight: 550;
    color: var(--ink);
    margin-bottom: 0 !important;
    font-size: .92em;
}
.checkbox input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--accent); }
.password-wrap { margin-top: 12px; }

.reassurance {
    margin-top: 15px;
    display: block;
    text-align: center;
    font-size: .84em;
    line-height: 1.5;
    color: #3f6a52;
    background: var(--green-bg);
    border: 1px solid var(--green-line);
    border-radius: 9px;
    padding: 10px 14px;
}
.reassurance .ic { color: var(--green); width: 15px; height: 15px; vertical-align: -3px; margin-right: 5px; }

/* ---------- Comment ça marche (dépliable) ---------- */
.how {
    margin-top: 15px;
    background: var(--green-bg);
    border: 1px solid var(--green-line);
    border-radius: 9px;
    overflow: hidden;
}
.how summary {
    list-style: none;
    cursor: pointer;
    padding: 11px 14px;
    font-size: .84em;
    color: #3f6a52;
    display: flex;
    align-items: center;
    gap: 7px;
    user-select: none;
}
.how summary::-webkit-details-marker { display: none; }
.how summary .ic { color: var(--green); width: 15px; height: 15px; flex-shrink: 0; }
.how summary strong { color: #2f8258; text-decoration: underline; text-underline-offset: 2px; }
.how[open] summary { border-bottom: 1px solid var(--green-line); }
.how-body { padding: 16px 15px; background: #fff; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; gap: 11px; align-items: flex-start; }
.step-n {
    flex-shrink: 0;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: .74em; font-weight: 650;
    display: flex; align-items: center; justify-content: center;
    margin-top: 1px;
}
.steps li > div { font-size: .88em; color: var(--ink-soft); line-height: 1.5; }
.steps li strong { color: var(--ink); font-weight: 600; }
.how-note {
    margin-top: 14px;
    font-size: .84em;
    color: #3f6a52;
    background: var(--green-bg);
    border: 1px solid var(--green-line);
    border-radius: 8px;
    padding: 10px 12px;
}

/* ---------- Buttons ---------- */
.btn {
    padding: 11px 20px;
    border: none;
    border-radius: 9px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-family: inherit;
    letter-spacing: -.1px;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #34495e; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(44,62,80,.22); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: #eef1f4; color: var(--ink); }
.btn-secondary:hover { background: #e4e8ec; }
.btn-block { width: 100%; display: block; }

.hidden { display: none !important; }

/* ---------- Icons ---------- */
.ic { width: 20px; height: 20px; display: inline-block; vertical-align: middle; }
.state-badge {
    width: 60px; height: 60px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    background: #eef2f6;
    color: var(--accent);
}
.state-badge .ic { width: 28px; height: 28px; }
.badge-success { background: var(--green-bg); color: var(--green); }
.badge-muted   { background: #eef1f4; color: #8b98a5; }
.badge-warn    { background: #fdf4e7; color: #d0912f; }

/* ---------- Result ---------- */
.success-head { text-align: center; margin-bottom: 20px; }
.success-head h2 { color: var(--ink); font-size: 1.2em; font-weight: 650; letter-spacing: -.3px; }

.link-row { display: flex; gap: 8px; margin-bottom: 18px; }
.link-field {
    flex: 1;
    padding: 11px 13px;
    border: 1px solid #dbe1e7;
    border-radius: 9px;
    font-size: 12.5px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    background: var(--field);
    color: var(--ink);
}
.link-row .btn { white-space: nowrap; }

.qr-wrap { text-align: center; margin: 0 auto 18px; }
.qr-wrap #qrcode { display: inline-block; padding: 10px; background: white; border: 1px solid var(--line); border-radius: 10px; line-height: 0; }
.qr-wrap #qrcode img, .qr-wrap #qrcode canvas { display: block; }
.qr-wrap small { display: block; margin-top: 7px; color: #98a4b0; font-size: .78em; }

.info-list {
    list-style: none;
    background: white;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 18px;
}
.info-list li { padding: 4px 0 4px 24px; position: relative; font-size: .88em; color: var(--ink-soft); }
.info-list li strong { color: var(--ink); }
.info-list li::before {
    content: "";
    position: absolute; left: 0; top: 50%;
    width: 15px; height: 15px;
    margin-top: -7.5px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f9d63' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ---------- States (view) ---------- */
.state { text-align: center; }
.state h2 { color: var(--ink); font-size: 1.22em; font-weight: 650; margin-bottom: 8px; letter-spacing: -.3px; }
.state p { color: var(--ink-soft); margin-bottom: 18px; font-size: .92em; }
.state .info-list { text-align: left; margin: 0 auto 18px; max-width: 380px; }
.state .btn { min-width: 210px; }

.spinner {
    width: 34px; height: 34px;
    border: 3px solid #e4e9ee;
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.countdown { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Password ---------- */
.password-form { max-width: 340px; margin: 0 auto; }
.password-form input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #dbe1e7;
    border-radius: 9px;
    font-size: 15px;
    margin-bottom: 10px;
    text-align: center;
}
.password-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(44,62,80,.1); }
.error-text { color: #c0392b; font-size: .84em; margin-bottom: 10px; }
.hint { margin-top: 14px; color: #98a4b0; font-size: .82em; }

/* ---------- Message displayed ---------- */
.message-box {
    background: white;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--ink);
    min-height: 88px;
    margin-bottom: 14px;
}
.message-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.message-actions .btn { flex: 1; min-width: 140px; }

.burn-notice {
    display: flex; align-items: center; gap: 10px;
    background: var(--green-bg);
    border: 1px solid var(--green-line);
    border-radius: 10px;
    padding: 11px 14px;
    color: #2f8258;
    font-size: .86em;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .5s ease, transform .5s ease;
}
.burn-notice.show { opacity: 1; transform: translateY(0); }
.burn-check {
    flex-shrink: 0;
    width: 22px; height: 22px;
    background: var(--green); color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.burn-check .ic { width: 13px; height: 13px; }
.back-home { text-align: center; margin-top: 14px; }
.back-home a { color: #98a4b0; font-size: .86em; text-decoration: none; }
.back-home a:hover { color: var(--ink); }

/* ---------- Footer ---------- */
.crypt-footer {
    padding: 18px 28px 22px;
    border-top: 1px solid var(--line);
    text-align: center;
}
.footer-trust {
    display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px;
    margin-bottom: 12px;
}
.footer-trust span { font-size: .76em; color: #98a4b0; position: relative; }
.footer-trust span::before { content: "•"; margin-right: 16px; color: #d5dbe1; }
.footer-trust span:first-child::before { content: ""; margin: 0; }
.footer-cta p { font-size: .8em; color: #8b98a5; margin-bottom: 6px; }
.footer-link { font-size: .8em; color: var(--accent); font-weight: 600; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 22px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--ink); color: white;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: .88em; font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(16,32,48,.22);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    body { padding: 0; }
    .container { border-radius: 0; box-shadow: none; min-height: 100vh; }
    header { padding: 16px 18px; }
    .header-content { gap: 14px; }
    .logo-img { height: 32px; }
    .main-narrow { padding: 20px 16px; }
    .card { padding: 18px; }
    .intro-lead { white-space: normal; font-size: 1.02em; }
    .link-row { flex-direction: column; }
    .link-row .btn { width: 100%; }
    .crypt-footer { padding: 16px 18px; }
    .message-actions { flex-direction: column; }
    .message-actions .btn { width: 100%; }
}
