/* =====================================================================
   Mentor Verify Portal – style.css
   Design tokens match the Flutter app's AppColors exactly.
   Mobile-first. Inter font.
   ===================================================================== */

/* ── Tokens (mirroring AppColors) ── */
:root {
    /* Brand */
    --primary:        #0036A5;
    --primary-dark:   #4F83F5;  /* dark-mode contrast variant */
    --primary-mid:    #1a56db;  /* gradient pair */
    --gold:           #F5C518;  /* logo star gold */

    /* Backgrounds */
    --bg:             #0F1117;
    --surface:        #1C1F2A;
    --surface-var:    #252836;

    /* Borders */
    --border:         #2A2D3A;
    --border-light:   rgba(255,255,255,0.07);

    /* Text */
    --text:           #E8EAF6;
    --text-muted:     #9E9E9E;
    --text-dim:       #4e566e;

    /* Semantic */
    --success:        #22c55e;
    --success-bg:     rgba(34,197,94,0.10);
    --success-border: rgba(34,197,94,0.22);
    --error:          #ef4444;
    --error-bg:       rgba(239,68,68,0.10);
    --error-border:   rgba(239,68,68,0.22);

    /* Elevation / glass */
    --glass:          rgba(28,31,42,0.80);
    --glow-blue:      rgba(0,54,165,0.22);
    --glow-gold:      rgba(245,197,24,0.12);

    /* Radius */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 24px;

    /* Font */
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;

    /* Ambient gradients — matches app's portfolio header blue → dark */
    background-image:
        radial-gradient(ellipse 90% 40% at 50% -10%, rgba(0,54,165,0.28) 0%, transparent 70%),
        radial-gradient(ellipse 50% 30% at 90% 100%, rgba(245,197,24,0.06) 0%, transparent 60%);
    background-attachment: fixed;
}

/* ── Utilities ── */
.hidden { display: none !important; }
.fw-700 { font-weight: 700; }
.muted  { color: var(--text-muted); font-size: 13px; line-height: 1.65; }

/* ── State Screens (loading / error / success) ── */
.state-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 24px;
    gap: 16px;
    z-index: 200;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 90% 40% at 50% -10%, rgba(0,54,165,0.22) 0%, transparent 70%);
    animation: slide-up 0.45s var(--ease) both;
}

.state-logo-wrap { margin-bottom: 4px; }

.state-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(0,54,165,0.4));
    animation: logo-pop 0.6s var(--ease) both;
}

.state-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.state-icon svg { width: 36px; height: 36px; }

.state-icon--success {
    background: var(--success-bg);
    border: 1.5px solid var(--success-border);
    color: var(--success);
}

.state-icon--error {
    background: var(--error-bg);
    border: 1.5px solid var(--error-border);
    color: var(--error);
}

.state-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.state-label {
    font-size: 14px;
    color: var(--text-muted);
}

.state-desc {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 360px;
    line-height: 1.7;
}

/* Spinner */
.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--primary-dark);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Success hash receipt */
.hash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px 20px;
    max-width: 400px;
    width: 100%;
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.9;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.hash-card strong {
    display: block;
    font-family: var(--font);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

/* ── App Header ── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15,17,23,0.88);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,54,165,0.5));
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.header-brand-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
}

.header-brand-sub {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* Expiry chip */
.expiry-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(79,131,245,0.12);
    border: 1px solid rgba(79,131,245,0.24);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--primary-dark);
}

.expiry-chip svg { width: 13px; height: 13px; }

/* ── Page Content ── */
.main-content {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px 72px;
}

/* ── Hero ── */
.hero {
    text-align: center;
    padding: 52px 20px 48px;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(0,54,165,0.12);
    border: 1px solid rgba(0,54,165,0.24);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 18px;
}

.hero-title {
    font-size: clamp(26px, 5vw, 42px);
    font-weight: 800;
    letter-spacing: -0.03em;
    /* Blue gradient → gold, mirroring app's SliverAppBar gradient */
    background: linear-gradient(120deg, #6fa3f7 0%, #ffffff 45%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 14px;
    line-height: 1.1;
}

.hero-body {
    font-size: 15px;
    color: var(--text-muted);
    max-width: 460px;
    margin: 0 auto;
    line-height: 1.75;
}

/* ── Grid ── */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 740px) {
    .grid {
        grid-template-columns: 1fr 1fr;
        align-items: start;
        gap: 20px;
    }
}

@media (min-width: 1024px) {
    .grid {
        grid-template-columns: 1.15fr 0.85fr;
        gap: 24px;
    }
}

/* ── Cards — matches app's Card(color: AppColors.surface) pattern ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    overflow: hidden;
    animation: slide-up 0.4s var(--ease) both;
    transition: border-color 0.2s;
}

.card:hover { border-color: rgba(79,131,245,0.18); }

.col-detail > .card + .card { margin-top: 16px; }

/* Card label (mirrors app's section header row pattern) */
.card-label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 14px 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--primary-dark);
    border-bottom: 1px solid var(--border);
    background: linear-gradient(90deg, rgba(0,54,165,0.10) 0%, transparent 100%);
}

.card-label svg { width: 15px; height: 15px; flex-shrink: 0; }

.card-body { padding: 20px; }

/* ── Field rows ── */
.field-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.field-row:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
}

.field-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.field-value {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.5;
}

/* Role tag — mirrors app's pill badge with primary color bg */
.role-tag {
    display: inline-block;
    background: rgba(0,54,165,0.15);
    border: 1px solid rgba(79,131,245,0.25);
    color: var(--primary-dark);
    border-radius: 8px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
}

/* Submission text block */
.sub-text-block {
    background: var(--surface-var);
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    padding: 14px;
    font-size: 13px;
    line-height: 1.8;
    color: #c5ceed;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Evidence label */
.ev-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin: 14px 0 6px;
}

.ev-label:first-child { margin-top: 0; }

/* Evidence link — matches app's launchUrl button style */
.ev-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: rgba(0,54,165,0.08);
    border: 1px solid rgba(79,131,245,0.18);
    border-radius: var(--r-md);
    text-decoration: none;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.18s var(--ease);
    margin-bottom: 6px;
    word-break: break-word;
}

.ev-link:hover {
    background: rgba(79,131,245,0.14);
    border-color: var(--primary-dark);
    transform: translateX(3px);
}

.ev-link svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.7; }

/* ── Sign card ── */
.sign-card {
    position: sticky;
    top: 68px;
}

/* ── Form ── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

input[type="text"] {
    background: var(--surface-var);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

input[type="text"]:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(79,131,245,0.15);
}

input[type="text"]::placeholder { color: var(--text-dim); }

/* ── Signature pad ── */
.sig-wrap {
    position: relative;
    background: var(--surface-var);
    border: 1.5px dashed var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    min-height: 170px;
    transition: border-color 0.2s;
}

.sig-wrap:hover,
.sig-wrap:focus-within {
    border-color: var(--primary-dark);
    border-style: solid;
}

#sig-canvas {
    display: block;
    width: 100%;
    height: 170px;
    cursor: crosshair;
    touch-action: none;
}

.sig-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
    color: var(--text-dim);
    font-size: 13px;
    transition: opacity 0.2s;
}

.sig-placeholder.hide { opacity: 0; }

.sig-clear {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.sig-clear:hover {
    background: rgba(255,255,255,0.11);
    color: var(--text);
}

/* ── Declaration / Checkboxes ── */
.declaration-box {
    background: var(--surface-var);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px;
    margin-bottom: 20px;
}

.declaration-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    user-select: none;
    margin-bottom: 10px;
}

.check-row:last-child { margin-bottom: 0; }

.check-row input[type="checkbox"] { display: none; }

.checkmark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 6px;
    border: 2px solid var(--border);
    background: var(--surface);
    margin-top: 1px;
    position: relative;
    transition: all 0.15s var(--ease);
}

.check-row input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.check-row input:checked + .checkmark::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4.5L4.5 8L11 1' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 12px;
}

.check-row input:checked ~ span:last-child { color: var(--text); }

/* ── Primary button — mirrors app's ElevatedButton(backgroundColor: #0036A5) ── */
.btn-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
    color: #fff;
    border: none;
    border-radius: var(--r-md);
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(0,54,165,0.35);
    transition: all 0.2s var(--ease);
    letter-spacing: -0.01em;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(0,54,165,0.45);
    background: linear-gradient(135deg, #004fd6 0%, #2563eb 100%);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(0,54,165,0.3);
}

.btn-primary:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Legal note ── */
.legal-note {
    margin-top: 14px;
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
    line-height: 1.7;
}

/* ── Footer ── */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px 20px 40px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-dim);
    flex-wrap: wrap;
    text-align: center;
}

.app-footer strong { color: var(--text-muted); }

.app-footer code {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 0.03em;
}

/* ── Animations ── */
@keyframes slide-up {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes logo-pop {
    0%   { transform: scale(0.7); opacity: 0; }
    65%  { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-pop { animation: logo-pop 0.5s var(--ease) both; }

/* ── Responsive tweaks ── */
@media (max-width: 480px) {
    .hero { padding: 32px 0 36px; }
    .card-body { padding: 16px; }
    .card-label { padding: 12px 16px; }
    .sign-card { position: static; }
    .hero-title { font-size: 26px; }
}
