/* ============================================================
   CapClover Application v3 — Mobile-first, wizard-style
   ============================================================ */

:root {
    --orange: #2d6b4f;
    --orange-light: #4a9e75;
    --teal: #1b5e3b;
    --teal-dark: #134a2e;
    --navy: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --white: #ffffff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow: 0 4px 20px rgba(0,0,0,.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.12);
    --transition: .3s cubic-bezier(.4,0,.2,1);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    color: var(--navy);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- Particles ---- */
.particles {
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
.particle {
    position: absolute;
    border-radius: 50%;
    opacity: .15;
    animation: float linear infinite;
}
@keyframes float {
    0%   { transform: translateY(0) rotate(0deg); opacity: .15; }
    50%  { opacity: .25; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

/* ---- Top nav ---- */
.topnav {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px;
    background: #ffffff;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e2e8f0;
}
.nav-brand {
    display: flex; align-items: center; gap: 8px;
}
.nav-logo { height: 52px; }
.nav-name {
    font-size: 18px; font-weight: 600; color: #1a3a2a;
    letter-spacing: .5px;
}
.nav-trust {
    font-size: 12px; color: var(--teal);
    display: flex; align-items: center; gap: 6px;
}

/* ---- Progress ---- */
.progress-wrap {
    position: sticky; top: 60px; z-index: 99;
    background: rgba(15, 23, 42, .92);
    backdrop-filter: blur(12px);
    padding: 16px 20px 12px;
}
.progress-bar {
    height: 4px; background: rgba(255,255,255,.1);
    border-radius: 4px; overflow: hidden;
}
.progress-fill {
    height: 100%; width: 20%;
    background: linear-gradient(90deg, var(--teal), var(--orange));
    border-radius: 4px;
    transition: width .5s cubic-bezier(.4,0,.2,1);
}
.steps-indicator {
    display: flex; justify-content: space-between;
    margin-top: 12px;
}
.step-dot {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    flex: 1;
}
.step-dot .dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    border: 2px solid rgba(255,255,255,.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: var(--gray-400);
    transition: var(--transition);
}
.step-dot span {
    font-size: 10px; color: var(--gray-500);
    transition: var(--transition);
}
.step-dot.active .dot {
    background: var(--teal);
    border-color: var(--teal);
    color: white;
    box-shadow: 0 0 16px rgba(44,155,143,.4);
}
.step-dot.active span { color: var(--teal); font-weight: 600; }
.step-dot.done .dot {
    background: var(--orange);
    border-color: var(--orange);
    color: white;
}
.step-dot.done span { color: var(--orange-light); }

/* ---- Main ---- */
.main {
    position: relative; z-index: 1;
    max-width: 680px; margin: 0 auto;
    padding: 20px 16px 60px;
}

/* ---- Steps ---- */
.step {
    display: none;
    animation: slideIn .4s ease;
}
.step.active { display: block; }
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.step-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 20px;
}
.step-number {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    color: white; font-weight: 800; font-size: 20px;
    display: flex; align-items: center; justify-content: center;
}
.step-header h2 {
    font-size: 20px; font-weight: 700; color: white;
    line-height: 1.2;
}
.step-header p {
    font-size: 13px; color: var(--gray-400); margin-top: 2px;
}

/* ---- Cards ---- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

/* ---- Fields ---- */
.field-row {
    display: flex; gap: 12px;
    margin-bottom: 14px;
}
.field-row:last-child { margin-bottom: 0; }
.field { flex: 1; min-width: 0; }
.field.full { flex: 1 1 100%; }

.field-row.triple { display: flex; gap: 10px; }
.field-row.triple .field { flex: 1; }

label {
    display: block;
    font-size: 12px; font-weight: 600; color: var(--gray-600);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.optional { color: var(--gray-400); font-weight: 400; text-transform: none; letter-spacing: 0; }

.input-wrap {
    position: relative;
}
.input-wrap i {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--gray-400); font-size: 14px;
    pointer-events: none;
    transition: color var(--transition);
}

input, select {
    width: 100%;
    padding: 11px 12px 11px 38px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 15px; font-family: inherit;
    color: var(--navy);
    background: var(--gray-50);
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
}
.field-row.triple input { padding-left: 12px; }

input:focus, select:focus {
    border-color: var(--teal);
    background: white;
    box-shadow: 0 0 0 3px rgba(44,155,143,.12);
}
input:focus + .input-wrap i,
.input-wrap:focus-within i {
    color: var(--teal);
}

input.invalid, select.invalid {
    border-color: #ef4444;
    background: #fef2f2;
}
input.invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.12); }

select { cursor: pointer; }
.select-wrap::after {
    content: '\f107'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    color: var(--gray-400); font-size: 12px; pointer-events: none;
}

.field-hint {
    display: block;
    font-size: 11px; color: var(--gray-400); margin-top: 4px;
}
.field-hint i { margin-right: 3px; }

/* ---- Buttons ---- */
.step-actions {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 20px;
}
.btn-next, .btn-back, .btn-submit {
    padding: 14px 28px;
    border: none; border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 600; font-family: inherit;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: var(--transition);
}
.btn-next {
    background: linear-gradient(135deg, var(--teal), var(--teal-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(44,155,143,.3);
}
.btn-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(44,155,143,.4);
}
.btn-next:active { transform: translateY(0); }

.btn-back {
    background: transparent;
    color: var(--gray-400);
    border: 1.5px solid rgba(255,255,255,.15);
}
.btn-back:hover { border-color: rgba(255,255,255,.3); color: white; }

.btn-submit {
    background: linear-gradient(135deg, var(--orange), #e05a1a);
    color: white;
    box-shadow: 0 4px 14px rgba(27,94,59,.3);
    padding: 16px 32px;
    font-size: 16px;
}
.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(27,94,59,.4);
}
.btn-submit:disabled {
    opacity: .6; cursor: not-allowed; transform: none;
}

/* ---- Upload ---- */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.upload-drop {
    position: relative;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 24px 12px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}
.upload-drop:hover, .upload-drop.dragover {
    border-color: var(--teal);
    background: rgba(44,155,143,.04);
}
.upload-drop.has-file {
    border-color: #22c55e;
    border-style: solid;
    background: #f0fdf4;
}
.file-input {
    position: absolute; inset: 0;
    opacity: 0; cursor: pointer;
    padding: 0;
}
.upload-content { pointer-events: none; }
.upload-icon {
    font-size: 28px; color: var(--gray-400);
    margin-bottom: 8px;
    transition: var(--transition);
}
.upload-drop:hover .upload-icon { color: var(--teal); transform: translateY(-2px); }
.upload-content strong { display: block; font-size: 13px; color: var(--gray-600); }
.upload-content span { font-size: 11px; color: var(--gray-400); }
.upload-success {
    pointer-events: none;
    color: #16a34a; font-size: 13px;
}
.upload-success i { font-size: 28px; display: block; margin-bottom: 6px; }
.upload-success .file-name {
    font-size: 11px; color: var(--gray-500);
    word-break: break-all;
}
.upload-note {
    text-align: center; font-size: 12px; color: var(--gray-400);
    margin-top: 14px;
}
.upload-note i { margin-right: 4px; color: var(--teal); }

/* ---- Funding cards ---- */
.funding-cards { margin-top: 20px; }
.funding-cards h3 {
    font-size: 13px; text-transform: uppercase; letter-spacing: .5px;
    color: var(--gray-500); margin-bottom: 10px;
}
.funding-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.funding-option { cursor: pointer; }
.funding-option input { display: none; }
.funding-card {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 14px 10px;
    text-align: center;
    transition: var(--transition);
}
.funding-card i {
    font-size: 22px; color: var(--gray-400);
    display: block; margin-bottom: 6px;
    transition: var(--transition);
}
.funding-card strong { display: block; font-size: 12px; color: var(--gray-700); }
.funding-card span { font-size: 11px; color: var(--gray-400); }
.funding-option input:checked + .funding-card {
    border-color: var(--teal);
    background: rgba(44,155,143,.06);
}
.funding-option input:checked + .funding-card i { color: var(--teal); }
.funding-card:hover { border-color: var(--gray-300); }

/* ---- Review ---- */
.review-card { padding: 16px; }
.review-section { margin-bottom: 16px; }
.review-section:last-child { margin-bottom: 0; }
.review-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    color: var(--teal); letter-spacing: .5px;
    margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
}
.review-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px;
}
.review-item { font-size: 13px; }
.review-item .rlabel {
    color: var(--gray-400); font-size: 11px;
    display: block;
}
.review-item .rvalue { color: var(--navy); font-weight: 500; }

/* ---- Auth ---- */
.auth-card { padding: 0; overflow: hidden; }
.auth-toggle {
    padding: 14px 20px;
    display: flex; align-items: center; gap: 10px;
    cursor: pointer;
    font-size: 13px; font-weight: 600; color: var(--gray-600);
    transition: var(--transition);
}
.auth-toggle:hover { background: var(--gray-50); }
.auth-toggle .toggle-icon { margin-left: auto; transition: transform var(--transition); }
.auth-toggle.open .toggle-icon { transform: rotate(180deg); }
.auth-text {
    max-height: 0; overflow: hidden;
    transition: max-height .4s ease, padding .4s ease;
    font-size: 11px; line-height: 1.6; color: var(--gray-500);
    padding: 0 20px;
    border-top: 1px solid transparent;
}
.auth-text.open {
    max-height: 400px;
    padding: 14px 20px;
    border-top-color: var(--gray-200);
}

/* ---- Signature ---- */
.sig-label {
    text-transform: none; font-size: 14px; font-weight: 600;
    color: var(--gray-700); margin-bottom: 8px; letter-spacing: 0;
}
.sig-input {
    padding: 14px 16px; font-size: 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}
.sig-input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(44,155,143,.12);
}
.sig-preview {
    font-family: 'Dancing Script', cursive;
    font-size: 32px; color: #1e3a8a;
    padding: 16px;
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    min-height: 60px;
    text-align: center;
    transition: var(--transition);
}

.consent-check {
    display: flex; align-items: flex-start; gap: 10px;
    margin-top: 16px;
    cursor: pointer;
    font-size: 13px; color: var(--gray-600);
    text-transform: none; letter-spacing: 0; font-weight: 400;
}
.consent-check input[type="checkbox"] {
    width: 18px; height: 18px; flex-shrink: 0;
    margin-top: 1px; padding: 0;
    accent-color: var(--teal);
}

/* ---- Success ---- */
.success-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center; justify-content: center;
    padding: 20px;
}
.success-overlay.show { display: flex; }
.success-content {
    background: white;
    border-radius: 20px;
    padding: 48px 32px;
    text-align: center;
    max-width: 420px; width: 100%;
    animation: popIn .5s cubic-bezier(.17,.67,.35,1.25);
}
@keyframes popIn {
    from { opacity: 0; transform: scale(.8); }
    to   { opacity: 1; transform: scale(1); }
}
.success-check {
    width: 72px; height: 72px; margin: 0 auto 20px;
}
.success-check svg {
    width: 100%; height: 100%;
}
.success-check circle {
    stroke: #22c55e; stroke-width: 2;
    stroke-dasharray: 166; stroke-dashoffset: 166;
    animation: stroke .6s ease forwards;
}
.success-check path {
    stroke: #22c55e; stroke-width: 3;
    stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 48; stroke-dashoffset: 48;
    animation: stroke .3s ease .5s forwards;
}
@keyframes stroke {
    to { stroke-dashoffset: 0; }
}
.success-content h2 { font-size: 22px; color: var(--navy); margin-bottom: 8px; }
.success-content p { font-size: 14px; color: var(--gray-500); margin-bottom: 8px; }
.success-email { font-size: 12px !important; }
.success-content .btn-next { margin-top: 20px; display: inline-flex; }

/* ---- Mobile responsive ---- */
@media (max-width: 640px) {
    .field-row { flex-direction: column; gap: 10px; }
    .field-row.triple { flex-direction: row; }
    .upload-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .funding-grid { grid-template-columns: 1fr; gap: 8px; }
    .review-grid { grid-template-columns: 1fr; }
    .step-header h2 { font-size: 18px; }
    .main { padding: 16px 12px 50px; }
    .card { padding: 20px 16px; }
    .btn-next, .btn-submit { padding: 14px 20px; font-size: 14px; }
    .step-dot span { font-size: 9px; }
    .step-dot .dot { width: 28px; height: 28px; font-size: 10px; }
    .sig-preview { font-size: 26px; }
    .topnav { padding: 10px 14px; }
    .nav-logo { height: 42px; }
    .nav-name { font-size: 15px; }
    .progress-wrap { padding: 12px 14px 8px; top: 52px; }
}

@media (max-width: 380px) {
    .upload-grid { grid-template-columns: 1fr; }
    .field-row.triple { flex-direction: column; }
}

/* ---- Shake animation for validation ---- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%  { transform: translateX(-6px); }
    75%  { transform: translateX(6px); }
}
.shake { animation: shake .3s ease; }

/* ---- Pulse for submit button ---- */
@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(27,94,59,.3); }
    50%      { box-shadow: 0 4px 30px rgba(27,94,59,.5); }
}
.btn-submit:not(:disabled) { animation: pulse 2s infinite; }
