/* FitScan Widget — Clean, modern sizing experience */

:root {
    --bg: #f5f7fa;
    --card: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.app {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* Header */
.header {
    text-align: center;
    padding: 24px 0 16px;
}
.logo {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.tagline {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Steps */
.steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px 0 24px;
}
.step {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    background: var(--card);
    border: 2px solid var(--border);
    transition: all 0.2s;
}
.step.active {
    color: var(--primary);
    border-color: var(--primary);
    background: #eff6ff;
}
.step.done {
    color: var(--success);
    border-color: var(--success);
    background: #ecfdf5;
}
.step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}
.step.active .step-num {
    background: var(--primary);
    color: white;
}
.step.done .step-num {
    background: var(--success);
    color: white;
}

/* Panels */
.panel {
    display: none;
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}
.panel.active { display: block; }

.panel h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}
.panel h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 24px 0 12px;
}
.hint {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 20px;
}

/* Form */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}
.form-row.compact {
    align-items: center;
    flex-wrap: wrap;
}
.form-group {
    flex: 1;
    min-width: 120px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.form-group small {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

input[type="number"], select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text);
    background: white;
    transition: border-color 0.2s;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

.input-unit {
    position: relative;
}
.input-unit input { padding-right: 44px; }
.unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-light);
    font-weight: 600;
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
    background: white;
    color: var(--text);
    border: 2px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--text-light);
    font-size: 13px;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Survey section */
.survey-section {
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.survey-section p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 12px;
}
.survey-section .btn-secondary { width: 100%; }

/* Primary result card */
.primary-result {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}
.primary-result .brand-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.primary-result .size-value {
    font-size: 48px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}
.primary-result .size-system {
    font-size: 14px;
    color: var(--text-light);
}
.primary-result .size-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
}
.primary-result .size-alt {
    font-size: 14px;
    color: var(--text);
}
.primary-result .size-alt strong { font-weight: 700; }
.primary-result .fit-desc {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-light);
    padding: 8px 16px;
    background: rgba(255,255,255,0.6);
    border-radius: 6px;
    display: inline-block;
}
.primary-result .confidence-bar {
    margin-top: 8px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}
.primary-result .confidence-fill {
    height: 100%;
    background: var(--success);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* Brand grid */
.brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.brand-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    transition: all 0.2s;
}
.brand-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}
.brand-card .bc-brand {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.brand-card .bc-size {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    margin: 4px 0;
}
.brand-card .bc-eu {
    font-size: 12px;
    color: var(--text-light);
}
.brand-card .bc-note {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 6px;
    line-height: 1.3;
}

/* Cross-brand */
.cross-brand-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}
.arrow-icon {
    font-size: 20px;
    color: var(--primary);
    padding-top: 24px;
}
.cross-result {
    margin-top: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    display: none;
}
.cross-result.visible { display: block; }

/* Product grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.product-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: all 0.2s;
}
.product-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}
.product-card .pc-brand {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}
.product-card .pc-name {
    font-size: 15px;
    font-weight: 600;
    margin: 4px 0 8px;
    line-height: 1.3;
}
.product-card .pc-size {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 4px;
}
.product-card .pc-fit {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.fit-bar {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}
.fit-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}
.fit-fill.excellent { background: var(--success); }
.fit-fill.good { background: #60a5fa; }
.fit-fill.fair { background: var(--warning); }
.fit-fill.poor { background: var(--danger); }
.fit-score {
    font-size: 12px;
    font-weight: 700;
    min-width: 36px;
    text-align: right;
}
.pc-notes {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.4;
}

/* Nav */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
}
.nav-buttons .btn-secondary, .nav-buttons .btn-primary {
    flex: 1;
    width: auto;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Feedback */
.feedback-box {
    display: none;
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}
.feedback-box.visible { display: block; }
.feedback-box h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.feedback-info { font-size: 13px; color: var(--text-light); margin-bottom: 12px; }
.feedback-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.fb-btn {
    padding: 8px 16px; border-radius: 20px; border: 2px solid var(--border);
    background: white; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: all 0.2s;
}
.fb-btn:hover { border-color: var(--primary); color: var(--primary); }
.fb-btn.fb-accurate:hover, .fb-btn.fb-accurate.selected {
    border-color: var(--success); color: var(--success); background: #ecfdf5;
}
.fb-btn.fb-small:hover, .fb-btn.fb-small.selected {
    border-color: var(--warning); color: var(--warning); background: #fffbeb;
}
.fb-btn.fb-large:hover, .fb-btn.fb-large.selected {
    border-color: var(--danger); color: var(--danger); background: #fef2f2;
}
.feedback-thanks {
    display: none; margin-top: 12px; padding: 12px;
    background: #ecfdf5; border-radius: 8px;
    color: var(--success); font-weight: 600; font-size: 14px;
}
.feedback-thanks.visible { display: block; }

/* Responsive */
@media (max-width: 500px) {
    .form-row { flex-direction: column; gap: 12px; }
    .brand-grid { grid-template-columns: repeat(2, 1fr); }
    .product-grid { grid-template-columns: 1fr; }
    .steps { gap: 4px; }
    .step { padding: 6px 10px; font-size: 12px; }
    .primary-result .size-value { font-size: 36px; }
}
