/* ============================================================
   ALL VERIFICATION — Master Stylesheet
   Design: white cards · navy header · teal accents
   All text is dark on white backgrounds — fully readable
   ============================================================ */

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

:root {
    /* Brand */
    --navy:      #0b1f3a;
    --navy-mid:  #132d52;
    --navy-soft: #1e3a5f;
    --blue:      #1a6bcc;
    --teal:      #00b4d8;
    --teal-light:#e0f7fc;

    /* State */
    --green:     #16a34a;
    --green-bg:  #f0fdf4;
    --green-bdr: #86efac;
    --red:       #dc2626;
    --red-bg:    #fef2f2;
    --red-bdr:   #fca5a5;
    --amber:     #d97706;

    /* Neutrals — text always dark on white */
    --text:      #111827;   /* headings  */
    --body:      #374151;   /* body copy */
    --muted:     #6b7280;   /* captions  */
    --border:    #d1d5db;
    --bg:        #f3f4f6;   /* page background */
    --white:     #ffffff;

    /* Sizes */
    --radius:    10px;
    --radius-lg: 16px;
    --shadow:    0 2px 12px rgba(0,0,0,.08);
    --shadow-md: 0 4px 24px rgba(0,0,0,.12);
}

/* ── Base ──────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--body);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

/*
 ┌─────────────────────────────────────────────────────────────┐
 │  BACKGROUND IMAGE                                           │
 │  Put your image in:  /public/img/bg.jpeg                   │
 │  Then add  class="has-bg"  to <body> in every .ejs file    │
 └─────────────────────────────────────────────────────────────┘
*/
body.has-bg {
    background:
        linear-gradient(160deg,
            rgba(11,31,58,0.92)  0%,
            rgba(19,45,82,0.85) 100%),
        url('/img/bg.png') center center / cover no-repeat fixed;
}

/* ── Header ────────────────────────────────────────────────── */
.site-header {
    background: var(--navy);
    height: 68px;
    padding: 0 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 200;
    box-shadow: 0 2px 16px rgba(0,0,0,.4);
}

/* Logo -------------------------------------------------- */
.site-logo {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; flex-shrink: 0;
}

/*
 ┌─────────────────────────────────────────────────────────────┐
 │  LOGO IMAGE                                                 │
 │  Put your logo in:  /public/img/logo.png  (white/light ver)│
 │  Then in each .ejs header replace the <div class="logo-mark">│
 │  block with:                                                │
 │      <img src="/img/logo.png" class="logo-img" alt="ALL VERIFICATION"> │
 └─────────────────────────────────────────────────────────────┘
*/
.logo-img {
    height: 40px; width: auto; object-fit: contain;
}
.logo-img-lg {
    height: 56px; width: auto; object-fit: contain;
}

/* Fallback letter-mark when no image */
.logo-mark {
    width: 40px; height: 40px;
    background: var(--teal);
    border-radius: 8px;
    display: grid; place-items: center;
    font-weight: 800; font-size: 20px;
    color: var(--navy); flex-shrink: 0;
    letter-spacing: -1px;
}

.logo-text {
    display: flex; flex-direction: column;
    line-height: 1.1;
}
.logo-text strong {
    color: var(--white);
    font-size: 15px; font-weight: 800;
    letter-spacing: .4px;
}
.logo-text span {
    color: var(--teal);
    font-size: 10px; font-weight: 600;
    letter-spacing: 1.5px; text-transform: uppercase;
}

/* Nav --------------------------------------------------- */
.site-nav { display: flex; align-items: center; gap: 32px; }
.site-nav a {
    color: rgba(255,255,255,.72);
    font-size: 14px; font-weight: 500;
    text-decoration: none;
    transition: color .15s;
}
.site-nav a:hover { color: var(--white); }

/* ── Flash messages ────────────────────────────────────────── */
.flash-message {
    display: flex; align-items: center;
    justify-content: space-between; gap: 16px;
    padding: 14px 24px;
    font-size: 14px; font-weight: 500;
    transition: opacity .4s ease;
}
.flash-message.error {
    background: var(--red-bg);
    color: var(--red);
    border-bottom: 2px solid var(--red-bdr);
}
.flash-message.success {
    background: var(--green-bg);
    color: var(--green);
    border-bottom: 2px solid var(--green-bdr);
}
.close-btn {
    background: none; border: none; cursor: pointer;
    font-size: 20px; line-height: 1;
    opacity: .5; color: inherit; flex-shrink: 0;
    transition: opacity .15s;
}
.close-btn:hover { opacity: 1; }

/* ── Hero banner ───────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
    padding: 64px 24px 56px;
    text-align: center;
}
.hero h1 {
    font-size: clamp(26px, 4vw, 44px);
    font-weight: 800; letter-spacing: -.5px;
    color: var(--white);
    margin-bottom: 14px;
}
.hero h1 span { color: var(--teal); }
.hero p {
    color: rgba(255,255,255,.72);
    font-size: 16px; max-width: 520px; margin: 0 auto;
}

/* ── Page body / wrappers ──────────────────────────────────── */
.page-wrap {
    max-width: 700px; margin: 0 auto;
    padding: 44px 16px 80px;
}

/* Legacy compat */
.container {
    min-height: calc(100vh - 68px);
    display: flex; justify-content: center;
    align-items: flex-start; padding: 40px 16px 80px;
}
.form-wrapper {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px; max-width: 640px; width: 100%;
    box-shadow: var(--shadow-md);
}

/* ── Card ──────────────────────────────────────────────────── */
.form-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.form-card-header {
    background: var(--navy);
    padding: 22px 32px;
    display: flex; align-items: center; gap: 14px;
}
.form-card-header .card-icon {
    width: 38px; height: 38px;
    background: var(--teal); border-radius: 8px;
    display: grid; place-items: center;
    font-size: 18px; flex-shrink: 0;
}
.form-card-header h2 {
    color: var(--white);
    font-size: 18px; font-weight: 700;
    letter-spacing: -.2px;
}
.form-card-body { padding: 36px 32px; }

/* ── Typography ────────────────────────────────────────────── */
h1 { color: var(--text); font-weight: 800; }
h2 { color: var(--text); font-weight: 700; }
h3 { color: var(--text); font-weight: 700; }

/* ── Form groups ───────────────────────────────────────────── */
.form-group { margin-bottom: 22px; }

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 12px; font-weight: 700;
    color: var(--muted);
    text-transform: uppercase; letter-spacing: .7px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit; font-size: 15px;
    color: var(--text);             /* ← always dark text */
    background: var(--white);       /* ← always white bg  */
    transition: border-color .18s, box-shadow .18s;
    outline: none;
}
input:focus, select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(26,107,204,.14);
}

/* ── Section divider label ─────────────────────────────────── */
.section-label {
    display: flex; align-items: center; gap: 10px;
    margin: 28px 0 18px;
    font-size: 11px; font-weight: 700;
    color: var(--muted);
    text-transform: uppercase; letter-spacing: 1px;
}
.section-label::before,
.section-label::after {
    content: ''; flex: 1; height: 1px;
    background: var(--border);
}

/* ── Top-up selector ───────────────────────────────────────── */
.topup-selector { display: flex; gap: 12px; flex-wrap: wrap; }

.topup-option {
    flex: 1; min-width: 130px;
    padding: 18px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    text-align: center; cursor: pointer;
    background: #f9fafb;
    transition: all .18s;
    user-select: none;
}
.topup-option:hover {
    border-color: var(--blue);
    background: #eff6ff;
}
.topup-option.selected {
    border-color: var(--navy);
    background: var(--navy);
}
.topup-option.selected .topup-name {
    color: var(--white);           /* white text on navy card */
}
.topup-name {
    font-size: 14px; font-weight: 700;
    color: var(--text);            /* dark text on light card */
    letter-spacing: .3px;
}
.topup-option input[type="radio"] { display: none; }

/* ── Code inputs ───────────────────────────────────────────── */
.codes-section {
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px; margin: 8px 0 22px;
}
.codes-section h3 {
    font-size: 14px; font-weight: 700;
    color: var(--text); margin-bottom: 16px;
}

.code-input {
    font-family: 'Courier New', monospace;
    font-size: 17px; letter-spacing: 3px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    color: var(--text);            /* ← dark text always */
    background: var(--white);
    transition: all .18s; outline: none;
}
.code-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(26,107,204,.12);
}
.code-input.valid {
    border-color: var(--green);
    background: var(--green-bg);
    box-shadow: 0 0 0 3px rgba(22,163,74,.1);
}
.code-input.invalid {
    border-color: var(--red);
    background: var(--red-bg);
    box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}
.code-input:disabled {
    background: #f3f4f6; color: var(--muted);
    cursor: not-allowed; border-color: #e5e7eb;
}

.code-format-hint {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 12px 14px; border-radius: 8px;
    margin-bottom: 16px; font-size: 13px;
    color: #1d4ed8;                /* ← readable dark blue */
}
.code-format-example {
    font-family: 'Courier New', monospace;
    background: #dbeafe; padding: 2px 8px;
    border-radius: 4px; font-weight: 700;
    font-size: 13px; margin-left: 6px;
    color: #1e40af;
}
.code-required-note {
    color: var(--muted); font-size: 12px;
    margin-top: 5px; font-style: italic;
}
.code-validation-message {
    font-size: 12px; font-weight: 600;
    margin-top: 5px; min-height: 18px;
}
.code-validation-message.valid   { color: var(--green); }
.code-validation-message.invalid { color: var(--red);   }

/* ── Encrypt row ───────────────────────────────────────────── */
.encrypt-section {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--teal-light);
    border: 1.5px solid #b2ebf2;
    border-radius: var(--radius);
    margin-bottom: 22px;
}
.checkbox-label {
    display: flex; align-items: center;
    gap: 10px; font-size: 14px; font-weight: 500;
    cursor: pointer; flex: 1;
    color: var(--text);            /* ← dark text */
}
.checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--navy); cursor: pointer;
}
.neos-badge {
    background: var(--navy); color: var(--teal);
    font-size: 11px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
    letter-spacing: 1.2px;
}

/* ── Captcha ───────────────────────────────────────────────── */
.captcha-container { margin: 24px 0; }

/* ── Buttons ───────────────────────────────────────────────── */
.submit-btn {
    width: 100%; padding: 15px;
    background: var(--navy); color: var(--white);
    border: none; border-radius: var(--radius);
    font-family: inherit; font-size: 15px; font-weight: 700;
    letter-spacing: .4px; cursor: pointer;
    transition: all .2s; position: relative;
}
.submit-btn:hover:not(:disabled) {
    background: var(--navy-mid);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(11,31,58,.28);
}
.submit-btn:active { transform: none; }
.submit-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.submit-btn.loading { color: transparent; }
.submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,.35);
    border-top-color: var(--white);
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

.btn-primary, .btn-secondary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 13px 26px; border-radius: var(--radius);
    font-family: inherit; font-size: 14px; font-weight: 700;
    cursor: pointer; transition: all .18s;
    text-decoration: none; border: none;
}
.btn-primary {
    background: var(--navy); color: var(--white);
}
.btn-primary:hover {
    background: var(--navy-mid); transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(11,31,58,.25);
}
.btn-secondary {
    background: var(--white); color: var(--text);
    border: 2px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--navy); background: #f9fafb;
}

/* ── Field validation (form.js) ────────────────────────────── */
.field-error {
    color: var(--red); font-size: 12px;
    font-weight: 600; margin-top: 5px;
    padding-left: 2px;
}
.field-invalid {
    border-color: var(--red) !important;
    background: var(--red-bg) !important;
    box-shadow: 0 0 0 3px rgba(220,38,38,.1) !important;
}

/* ── Success page ──────────────────────────────────────────── */
.success-container, .error-container {
    min-height: calc(100vh - 68px);
    display: flex; justify-content: center;
    align-items: center; padding: 40px 16px;
    background: var(--bg);
}

.success-wrapper, .error-wrapper {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 56px 48px; max-width: 520px; width: 100%;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.success-icon {
    width: 84px; height: 84px;
    background: var(--green-bg);
    border: 3px solid var(--green);
    color: var(--green);
    border-radius: 50%;
    display: flex; align-items: center;
    justify-content: center;
    margin: 0 auto 28px;
    font-size: 38px;
}

.success-wrapper h1 {
    color: var(--text); font-size: 30px;
    font-weight: 800; margin-bottom: 12px;
}
.message {
    color: var(--body); font-size: 15px;
    line-height: 1.7; margin-bottom: 28px;
}
.email-confirmation {
    display: inline-flex; align-items: center; gap: 8px;
    background: #eff6ff; border: 1px solid #bfdbfe;
    padding: 10px 18px; border-radius: 100px;
    font-size: 14px; font-weight: 600;
    color: #1d4ed8;                /* ← dark blue, readable */
    margin-bottom: 32px;
}
.email-confirmation strong { color: var(--blue); }
.new-verification { margin-top: 20px; }
.new-verification a {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--navy); color: var(--white);
    text-decoration: none; padding: 13px 28px;
    border-radius: var(--radius); font-size: 15px;
    font-weight: 700; transition: all .2s;
}
.new-verification a:hover {
    background: var(--navy-mid); transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(11,31,58,.25);
}

/* ── Error page ────────────────────────────────────────────── */
.error-icon {
    width: 84px; height: 84px;
    background: var(--red-bg);
    border: 3px solid var(--red);
    color: var(--red);
    border-radius: 50%;
    display: flex; align-items: center;
    justify-content: center;
    margin: 0 auto 28px;
    font-size: 38px; font-weight: 700;
}
.error-wrapper h1 {
    color: var(--text); font-size: 28px;
    font-weight: 800; margin-bottom: 12px;
}
.error-message {
    color: var(--body); font-size: 15px;
    line-height: 1.7; margin-bottom: 32px;
}
.error-actions {
    display: flex; gap: 12px;
    justify-content: center; flex-wrap: wrap;
}

/* ── Admin panel ───────────────────────────────────────────── */
.admin-container { max-width: 960px; margin: 0 auto; padding: 40px 16px 80px; }

.admin-wrapper {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.admin-header-bar {
    background: var(--navy);
    padding: 22px 32px;
    display: flex; align-items: center; justify-content: space-between;
}
.admin-header-bar h1 {
    color: var(--white); font-size: 20px; font-weight: 700;
}
.admin-badge {
    background: rgba(0,180,216,.18); color: var(--teal);
    padding: 5px 14px; border-radius: 100px;
    font-size: 11px; font-weight: 700; letter-spacing: .8px;
    border: 1px solid rgba(0,180,216,.3);
    text-transform: uppercase;
}
.admin-body { padding: 32px; }

.email-section {
    background: #f9fafb;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 22px; margin-bottom: 28px;
}
.email-section h3 {
    font-size: 14px; font-weight: 700;
    color: var(--text); margin-bottom: 14px;
}

.codes-toolbar {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 16px;
}
.codes-toolbar h3 { font-size: 15px; font-weight: 700; color: var(--text); }

.add-code-btn {
    background: var(--navy); color: var(--white);
    border: none; padding: 9px 18px; border-radius: 8px;
    font-family: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all .2s;
    display: flex; align-items: center; gap: 6px;
}
.add-code-btn:hover { background: var(--navy-mid); transform: translateY(-1px); }

.code-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px; margin-bottom: 20px;
}
.code-check-card {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px; transition: all .2s;
}
.code-check-card.valid   { border-color: var(--green); background: var(--green-bg); }
.code-check-card.invalid { border-color: var(--red);   background: var(--red-bg);   }

.code-display {
    font-family: 'Courier New', monospace;
    font-size: 14px; font-weight: 700;
    color: var(--text);            /* ← always readable */
    margin-bottom: 10px; padding: 8px 10px;
    background: #f3f4f6; border-radius: 6px;
    text-align: center; letter-spacing: 2px;
}
.code-status {
    display: flex; align-items: center;
    justify-content: space-between; margin-bottom: 10px;
}
.status-badge {
    padding: 3px 12px; border-radius: 100px;
    font-size: 11px; font-weight: 700; letter-spacing: .5px;
}
.status-badge.valid   { background: var(--green); color: var(--white); }
.status-badge.invalid { background: var(--red);   color: var(--white); }

.toggle-switch { position: relative; display: inline-block; width: 48px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--red); transition: .3s; border-radius: 24px;
}
.toggle-slider:before {
    content: ''; position: absolute;
    height: 18px; width: 18px; left: 3px; bottom: 3px;
    background: var(--white); transition: .3s; border-radius: 50%;
}
input:checked + .toggle-slider { background: var(--green); }
input:checked + .toggle-slider:before { transform: translateX(24px); }

.code-actions { display: flex; gap: 8px; margin-top: 10px; }
.action-btn {
    flex: 1; padding: 8px; border: none; border-radius: 6px;
    font-family: inherit; font-size: 12px; font-weight: 700;
    cursor: pointer; transition: all .2s;
    color: var(--white);
}
.action-btn.valid   { background: var(--green); }
.action-btn.invalid { background: var(--red);   }
.action-btn:hover   { opacity: .85; transform: translateY(-1px); }

.summary-section {
    background: var(--navy);
    border-radius: var(--radius);
    padding: 24px; margin: 20px 0;
    display: flex; justify-content: space-around; text-align: center;
}
.summary-item { flex: 1; }
.summary-value {
    font-size: 36px; font-weight: 800;
    color: var(--white);           /* ← white on navy = readable */
}
.summary-label {
    font-size: 11px; font-weight: 600;
    color: rgba(255,255,255,.6);
    text-transform: uppercase; letter-spacing: .6px; margin-top: 4px;
}

.email-preview {
    background: #f9fafb;
    border-left: 4px solid var(--blue);
    border-radius: 0 8px 8px 0;
    padding: 16px 18px; margin: 20px 0;
    font-family: 'Courier New', monospace;
    font-size: 13px; line-height: 1.7;
    white-space: pre-wrap;
    color: var(--text);            /* ← dark text always */
}

.send-btn {
    width: 100%; padding: 16px;
    background: var(--navy); color: var(--white);
    border: none; border-radius: var(--radius);
    font-family: inherit; font-size: 16px; font-weight: 700;
    cursor: pointer; transition: all .2s;
}
.send-btn:hover:not(:disabled) {
    background: var(--navy-mid); transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(11,31,58,.28);
}
.send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
    background: var(--navy);
    padding: 32px 24px;
    text-align: center;
}
.site-footer p {
    color: rgba(255,255,255,.5);
    font-size: 13px;
}
.site-footer a { color: var(--teal); text-decoration: none; }
.site-footer a:hover { color: var(--white); }

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.form-card, .form-wrapper,
.success-wrapper, .error-wrapper,
.admin-wrapper { animation: fadeUp .35s ease both; }

@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.success-icon, .error-icon { animation: scaleIn .35s .1s ease both; }

/* ── Loading overlay ───────────────────────────────────────── */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,.9);
    display: none; justify-content: center; align-items: center;
    z-index: 2000;
}
.loading-overlay.show { display: flex; }
.loading-spinner {
    width: 44px; height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
    .site-header  { padding: 0 20px; height: 60px; }
    .site-nav     { gap: 18px; }
    .site-nav a   { font-size: 13px; }

    .form-card-body, .admin-body { padding: 24px 18px; }
    .form-wrapper  { padding: 28px 18px; }
    .success-wrapper, .error-wrapper { padding: 40px 24px; }

    .hero h1 { font-size: 24px; }
    .topup-selector { flex-direction: column; }
    .summary-section { flex-direction: column; gap: 20px; }
    .code-check-grid { grid-template-columns: 1fr; }
    .error-actions { flex-direction: column; align-items: center; }
}
