/* ═══════════════════════════════════════════════
   FootHealth — Diabetic Foot Screening
   Redesign: Agency-grade medical tech
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

:root {
    --bg-deepest: #040911;
    --bg-deep: #080f1f;
    --bg-surface: rgba(10, 20, 44, 0.65);
    --bg-elevated: rgba(14, 28, 55, 0.78);
    --accent: #00c2d6;
    --accent-dim: rgba(0, 194, 214, 0.10);
    --accent-glow: rgba(0, 194, 214, 0.22);
    --green: #22c792;
    --green-dim: rgba(34, 199, 146, 0.10);
    --amber: #e8a020;
    --amber-dim: rgba(232, 160, 32, 0.10);
    --red: #ee4054;
    --red-dim: rgba(238, 64, 84, 0.10);
    --text-primary: #eceff6;
    --text-secondary: #8797b0;
    --text-dim: #4e5e78;
    --border-glass: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.10);
    --border-accent: rgba(0, 194, 214, 0.20);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --font-heading: 'Geist', 'Noto Sans SC', sans-serif;
    --font-body: 'Noto Sans SC', 'Geist', sans-serif;
    --font-mono: 'Geist Mono', monospace;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --shadow-accent: 0 4px 24px rgba(0, 194, 214, 0.25);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-elevated: 0 2px 4px rgba(0, 0, 0, 0.5), 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

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

/* ═══════ Noise Texture ═══════ */
.noise-overlay {
    position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* ═══════ Ambient Orbs ═══════ */
.ambient-bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.ambient-orb { position: absolute; border-radius: 50%; filter: blur(140px); }
.ambient-orb:nth-child(1) {
    width: 680px; height: 680px; background: rgba(0, 194, 214, 0.07);
    top: -250px; right: -180px; animation: drift1 22s ease-in-out infinite;
}
.ambient-orb:nth-child(2) {
    width: 520px; height: 520px; background: rgba(99, 102, 241, 0.05);
    bottom: -200px; left: -120px; animation: drift2 26s ease-in-out infinite;
}
@keyframes drift1 { 0%,100%{transform:translate(0,0)} 33%{transform:translate(50px,-30px)} 66%{transform:translate(-20px,40px)} }
@keyframes drift2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-40px,-20px)} }

/* ═══════ App Shell ═══════ */
.app-container { position: relative; z-index: 1; max-width: 800px; margin: 0 auto; padding: 44px 20px 80px; }

/* ═══════ Header ═══════ */
.app-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 52px; padding: 18px 26px;
    background: var(--bg-surface); backdrop-filter: blur(40px) saturate(1.4); -webkit-backdrop-filter: blur(40px) saturate(1.4);
    border: 1px solid var(--border-glass); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #008499);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 194, 214, 0.30);
}
.brand-icon svg { width: 20px; height: 20px; }
.brand-name { font-family: var(--font-heading); font-size: 20px; font-weight: 600; letter-spacing: -0.4px; }
.brand-name em { font-style: normal; color: var(--accent); font-weight: 400; }
.header-badge {
    font-size: 11px; font-weight: 500; color: var(--accent); letter-spacing: 0.3px;
    background: var(--accent-dim); border: 1px solid var(--border-accent);
    padding: 5px 14px; border-radius: 100px;
}

/* ═══════ Progress ═══════ */
.progress-bar { display: flex; align-items: center; justify-content: center; margin-bottom: 52px; }
.progress-step {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    opacity: 0.20; transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
    cursor: pointer;
}
.progress-step:hover { opacity: 0.4; }
.progress-step.active { opacity: 1; }
.progress-step.done { opacity: 0.55; }
.step-ring {
    width: 42px; height: 42px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.02);
    font-size: 14px; font-weight: 600; color: var(--text-dim); font-family: var(--font-heading);
    transition: all 0.5s var(--ease-out);
}
.progress-step.active .step-ring {
    border-color: var(--accent); color: var(--accent); background: var(--accent-dim);
    box-shadow: 0 0 28px var(--accent-glow), inset 0 0 20px rgba(0,194,214,0.04);
}
.progress-step.done .step-ring { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.step-label { font-size: 11px; font-weight: 500; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px; transition: color 0.5s; }
.progress-step.active .step-label { color: var(--accent); }
.progress-step.done .step-label { color: var(--green); }
.progress-connector { width: 56px; height: 1px; background: rgba(255,255,255,0.04); margin: 0 6px 28px 6px; transition: background 0.5s; }
.progress-step.done + .progress-connector { background: rgba(34,199,146,0.25); }

/* ═══════ Panels ═══════ */
.step-panel { display: none; animation: enterPanel 0.5s var(--ease-out); }
.step-panel.active { display: block; }
@keyframes enterPanel { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════ Section Header ═══════ */
.section-header { text-align: left; margin-bottom: 36px; }
.section-header h2 { font-family: var(--font-heading); font-size: 30px; font-weight: 600; letter-spacing: -0.6px; margin-bottom: 6px; }
.section-header p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }

/* ═══════ Glass Cards ═══════ */
.card {
    background: var(--bg-surface); backdrop-filter: blur(40px) saturate(1.4); -webkit-backdrop-filter: blur(40px) saturate(1.4);
    border: 1px solid var(--border-glass); border-radius: var(--radius-md);
    padding: 26px; margin-bottom: 14px;
    box-shadow: var(--shadow-card);
    transition: border-color 0.4s, box-shadow 0.4s, transform 0.4s var(--ease-out);
}
.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-elevated), 0 0 0 1px rgba(255,255,255,0.03);
}
.card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border-glass); }
.card-header h3 { font-family: var(--font-heading); font-size: 15px; font-weight: 600; }
.card-header .icon-wrap { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.card-header .icon-wrap.accent { background: var(--accent-dim); color: var(--accent); }

/* ═══════ Photo Grid ═══════ */
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 28px; }
.photo-slot {
    position: relative; aspect-ratio: 1;
    border: 2px dashed rgba(255,255,255,0.06); border-radius: var(--radius-md);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; overflow: hidden;
    background: var(--bg-surface); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    transition: border-color 0.3s var(--ease-out), background 0.3s, transform 0.3s var(--ease-spring);
}
.photo-slot:hover {
    border-color: var(--accent); border-style: solid;
    background: var(--accent-dim); transform: scale(1.02);
}
.photo-slot.has-photo { border-style: solid; border-color: rgba(34,199,146,0.3); }
.photo-guide { display: flex; flex-direction: column; align-items: center; gap: 8px; transition: opacity 0.3s; }
.photo-guide svg { color: var(--text-dim); }
.photo-slot:hover .photo-guide svg { color: var(--accent); }
.photo-guide span { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.photo-label { font-size: 10px; font-weight: 600; color: var(--text-secondary); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.6px; }
.photo-input { display: none; }
.photo-preview { position: absolute; inset: 0; object-fit: cover; }
.photo-remove { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,0.7); border: none; color: #fff; cursor: pointer; font-size: 12px; display: none; align-items: center; justify-content: center; z-index: 1; transition: transform 0.2s var(--ease-spring); }
.photo-slot.has-photo .photo-remove { display: flex; }
.photo-remove:hover { transform: scale(1.15); background: var(--red); }

/* ═══════ Forms ═══════ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 28px; }
@media (max-width: 680px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 10px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.6px; }
.form-group .unit { font-weight: 400; text-transform: none; font-size: 10px; letter-spacing: 0; }
.input-field {
    width: 100%; padding: 13px 15px; background: rgba(0,0,0,0.35);
    border: 1.5px solid rgba(255,255,255,0.06); border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 16px; font-family: var(--font-mono); font-weight: 500;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s; outline: none;
}
.input-field:focus {
    border-color: var(--accent); background: rgba(0,0,0,0.5);
    box-shadow: 0 0 0 3px var(--accent-dim), 0 0 16px var(--accent-glow);
}
.input-field::placeholder { color: rgba(255,255,255,0.12); font-weight: 400; font-family: var(--font-body); }
.form-hint { display: block; font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Radio pills */
.radio-group { display: flex; gap: 6px; }
.radio-pill { flex: 1; text-align: center; padding: 10px 14px; border: 1.5px solid rgba(255,255,255,0.06); border-radius: 100px; cursor: pointer; font-size: 13px; font-weight: 500; background: rgba(255,255,255,0.02); transition: border-color 0.25s, background 0.25s, color 0.25s; }
.radio-pill:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.radio-pill input { display: none; }

/* ═══════ Toast ═══════ */
.toast-error {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: var(--red-dim); border: 1px solid rgba(238,64,84,0.25);
    color: var(--red); padding: 12px 22px; border-radius: 100px;
    font-size: 13px; font-weight: 500; z-index: 100; backdrop-filter: blur(20px);
    box-shadow: 0 4px 16px rgba(238,64,84,0.15);
    animation: toastPop 0.4s var(--ease-spring);
}
@keyframes toastPop { from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.95); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }

/* ═══════ Buttons ═══════ */
.btn {
    padding: 13px 26px; border: none; border-radius: 100px;
    font-size: 14px; font-weight: 600; cursor: pointer; font-family: var(--font-body);
    display: inline-flex; align-items: center; gap: 7px; letter-spacing: 0.1px;
    transition: background 0.3s, box-shadow 0.3s, transform 0.25s var(--ease-spring), border-color 0.3s;
    outline: none;
}
.btn:focus-visible { box-shadow: 0 0 0 3px var(--accent-glow); }
.btn:disabled { opacity: 0.25; cursor: not-allowed; pointer-events: none; }
.btn-primary {
    background: var(--accent); color: #000;
    box-shadow: var(--shadow-accent);
}
.btn-primary:hover:not(:disabled) { background: #00d8ee; box-shadow: 0 6px 30px rgba(0, 194, 214, 0.35); transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: scale(0.96); box-shadow: 0 2px 12px rgba(0, 194, 214, 0.2); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1.5px solid rgba(255,255,255,0.06); }
.btn-ghost:hover { border-color: rgba(255,255,255,0.12); color: var(--text-primary); background: rgba(255,255,255,0.02); }
.btn-ghost:active { transform: scale(0.97); }
.btn-secondary { background: rgba(255,255,255,0.04); color: var(--text-primary); border: 1.5px solid rgba(255,255,255,0.06); }
.btn-secondary:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); }
.btn-secondary:active { transform: scale(0.97); }
.step-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.photo-counter { font-size: 12px; color: var(--text-dim); font-weight: 500; font-family: var(--font-mono); }

/* ═══════ Step 3 — Analysis ═══════ */
.analysis-container { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 400px; padding: 48px 20px; }
.analysis-orb {
    width: 128px; height: 128px; border-radius: 50%; margin-bottom: 28px;
    background: var(--accent-dim); border: 2px solid var(--border-accent);
    display: flex; align-items: center; justify-content: center; position: relative;
    box-shadow: 0 0 72px var(--accent-glow);
    animation: breathe 2.4s ease-in-out infinite;
}
.analysis-orb::after {
    content: ''; position: absolute; inset: -6px; border-radius: 50%;
    border: 2px solid transparent; border-top-color: var(--accent);
    animation: spin 1.6s linear infinite;
}
@keyframes breathe { 0%,100%{transform:scale(1);box-shadow:0 0 72px var(--accent-glow)} 50%{transform:scale(1.05);box-shadow:0 0 96px var(--accent-glow)} }
@keyframes spin { to { transform: rotate(360deg); } }
.analysis-icon { font-size: 42px; }
.analysis-title { font-family: var(--font-heading); font-size: 20px; font-weight: 500; margin-bottom: 24px; color: var(--text-secondary); }
.analysis-checklist { display: flex; flex-direction: column; gap: 4px; }
.check-item { font-size: 13px; color: var(--text-dim); display: flex; align-items: center; gap: 10px; padding: 8px 18px; border-radius: 100px; transition: all 0.4s; }
.check-item.active { color: var(--accent); background: var(--accent-dim); }
.check-item.done { color: var(--green); }
.check-mark { font-family: var(--font-mono); width: 18px; text-align: center; font-size: 14px; font-weight: 600; }

/* ═══════ Step 4 — Report ═══════ */
.risk-hero {
    display: flex; align-items: center; gap: 40px; padding: 36px;
    background: var(--bg-elevated); backdrop-filter: blur(40px) saturate(1.4); -webkit-backdrop-filter: blur(40px) saturate(1.4);
    border: 1px solid var(--border-glass); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated); margin-bottom: 14px; flex-wrap: wrap; justify-content: center;
}
.risk-gauge { position: relative; width: 144px; height: 144px; flex-shrink: 0; }
.risk-gauge svg { transform: rotate(-90deg); }
.risk-gauge-bg { fill: none; stroke: rgba(255,255,255,0.03); stroke-width: 7; }
.risk-gauge-fill { fill: none; stroke-width: 7; stroke-linecap: round; transition: all 1.4s var(--ease-out); }
.risk-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.risk-number { font-family: var(--font-mono); font-size: 38px; font-weight: 600; line-height: 1; }
.risk-unit { font-size: 10px; color: var(--text-dim); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.5px; }
.risk-info { text-align: center; }
.risk-badge { display: inline-block; font-family: var(--font-heading); font-size: 22px; font-weight: 600; padding: 8px 22px; border-radius: 100px; margin-bottom: 6px; }
.risk-badge.low { background: var(--green-dim); color: var(--green); }
.risk-badge.mid { background: var(--amber-dim); color: var(--amber); }
.risk-badge.high { background: var(--red-dim); color: var(--red); }
.risk-subtitle { font-size: 13px; color: var(--text-secondary); }
.flag-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.flag-tag { font-size: 11px; font-weight: 500; padding: 5px 13px; border-radius: 100px; background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(232,160,32,0.15); }

.photo-review { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.review-thumb { aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-glass); }
.review-thumb img { width: 100%; height: 100%; object-fit: cover; }
.analysis-text { font-size: 13px; line-height: 1.85; color: var(--text-secondary); }
.recommendations { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.recommendations li {
    padding: 12px 16px; background: rgba(255,255,255,0.015);
    border-left: 2px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px; color: var(--text-secondary); line-height: 1.7;
}
.summary-card { background: var(--accent-dim); border-color: rgba(0,194,214,0.12); }

/* ═══════ Footer ═══════ */
.app-footer { text-align: center; padding: 52px 0 0; }
.app-footer p { font-size: 11px; color: var(--text-dim); }

/* ═══════ Responsive ═══════ */
@media (max-width: 768px) {
    .app-container { padding: 20px 12px 60px; }
    .photo-grid { gap: 8px; }
    .photo-review { grid-template-columns: repeat(2, 1fr); }
    .risk-hero { flex-direction: column; padding: 24px; }
    .progress-connector { width: 28px; }
    .section-header h2 { font-size: 24px; }
    .section-header { text-align: center; }
}

/* ═══════ Print ═══════ */
@media print {
    body { background: #fff; color: #000; }
    .noise-overlay, .ambient-bg, .progress-bar, .app-header, .app-footer { display: none; }
    .card, .risk-hero { border: 1px solid #ccc; background: #fff; box-shadow: none; break-inside: avoid; }
    .card-header { border-bottom-color: #ddd; }
}

/* ═══════ Reduced Motion ═══════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
