/* ── Chatbot Questionnaire Web — Stylesheet ── */
/* Design tokens ported from desktop QSS */

:root {
    --bg-page: #F8FAFC;
    --color-primary: #2563EB;
    --color-primary-hover: #1D4ED8;
    --color-primary-disabled: #BFDBFE;
    --color-success: #10B981;
    --color-success-hover: #059669;
    --color-danger: #EF4444;
    --color-danger-hover: #DC2626;
    --color-warning: #F59E0B;
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --text-placeholder: #94A3B8;
    --border-color: #E2E8F0;
    --card-bg: #FFFFFF;
    --nav-bg: #EFF6FF;
    --nav-border: #BFDBFE;
    --font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
    font-family: var(--font-family);
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Login page ── */

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 32px;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    color: var(--text-muted);
}

.login-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 16px;
}

/* ── Progress bar ── */

.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border-color);
    z-index: 100;
}

.progress-bar {
    height: 100%;
    background: var(--color-primary);
    transition: width 0.4s ease;
    border-radius: 0 2px 2px 0;
}

/* ── Wizard container ── */

.wizard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 740px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 20px 100px;
}

.screen { display: flex; flex-direction: column; flex: 1; }

.screen-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.center-content {
    align-items: center;
    text-align: center;
    justify-content: center;
    padding-top: 40px;
}

/* ── Typography ── */

.title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Cards ── */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

/* ── Forms ── */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group:last-child { margin-bottom: 0; }

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font-family);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input::placeholder, textarea::placeholder {
    color: var(--text-placeholder);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.select-input {
    max-width: 240px;
}

.field-error {
    font-size: 13px;
    color: var(--color-danger);
    min-height: 18px;
}

.error-message {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: var(--color-danger);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 12px;
}

/* ── Buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-family);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 140px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }

.btn-secondary {
    background: transparent;
    color: var(--color-primary);
    border: 1.5px solid var(--color-primary);
}

.btn-secondary:hover:not(:disabled) { background: rgba(37, 99, 235, 0.06); }

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover:not(:disabled) { background: var(--color-success-hover); }

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover:not(:disabled) { background: var(--color-danger-hover); }

.btn-skip {
    background: transparent;
    color: var(--text-muted);
    font-weight: 500;
    min-width: auto;
    padding: 10px 16px;
}

.btn-skip:hover { color: var(--text-secondary); background: rgba(0,0,0,0.04); }

.btn-full { width: 100%; }

/* ── Nav bar ── */

.nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background: var(--nav-bg);
    border-top: 2px solid var(--nav-border);
    z-index: 50;
}

.nav-spacer { flex: 1; }

/* ── Language selector ── */

.language-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
}

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

/* ── Niche grid ── */

.niche-counter {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.niche-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.niche-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.niche-item:hover { border-color: var(--color-primary); }

.niche-item.selected {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.04);
}

.niche-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.niche-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

/* ── Question screen ── */

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-counter {
    font-size: 13px;
    color: var(--text-muted);
}

.question-text {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.help-text {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 8px;
}

/* Radio & checkbox options */

.option-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
}

.option-item:hover { border-color: var(--color-primary); background: rgba(37, 99, 235, 0.02); }

.option-item.selected {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.06);
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

/* ── Review screen ── */

.review-section {
    margin-bottom: 16px;
}

.review-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--nav-bg);
    border: 1px solid var(--nav-border);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.review-section-header .chevron {
    transition: transform 0.2s;
    font-size: 12px;
}

.review-section-header.collapsed .chevron { transform: rotate(-90deg); }

.review-section-body {
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    overflow: hidden;
}

.review-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.review-item:last-child { border-bottom: none; }

.review-item-label {
    color: var(--text-secondary);
    flex: 1;
}

.review-item-value {
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    max-width: 50%;
}

.review-item-value.not-filled {
    color: var(--text-placeholder);
    font-style: italic;
}

/* ── Verification screen ── */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.verification-pair {
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 12px;
}

.verification-pair .vp-question {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.verification-pair .vp-answer {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--bg-page);
    border-radius: var(--radius-sm);
}

.verification-pair .vp-source {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.verification-pair .vp-actions {
    display: flex;
    gap: 10px;
}

.verification-pair .vp-actions .btn { min-width: 120px; }

.verification-pair.confirmed {
    border-color: var(--color-success);
    background: rgba(16, 185, 129, 0.03);
}

.verification-pair.corrected {
    border-color: var(--color-warning);
    background: rgba(245, 158, 11, 0.03);
}

.correction-input {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.correction-input input, .correction-input textarea {
    flex: 1;
}

.verification-summary-card {
    background: var(--card-bg);
    border: 2px solid var(--color-success);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
}

.verification-summary-card .vs-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 16px 0;
}

.verification-summary-card .vs-stat {
    text-align: center;
}

.verification-summary-card .vs-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
}

.verification-summary-card .vs-stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Confirmation screen ── */

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--color-success);
    color: white;
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.client-code {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
    background: var(--nav-bg);
    padding: 8px 20px;
    border-radius: var(--radius-md);
    margin: 8px 0;
}

/* ── Responsive ── */

@media (max-width: 640px) {
    .niche-grid { grid-template-columns: 1fr; }
    .wizard-container { padding: 20px 16px 100px; }
    .nav-bar { padding: 12px 16px; }
    .title { font-size: 20px; }
}

/* ── Dark theme ── */

[data-theme="dark"] {
    --bg-page: #0F172A;
    --color-primary: #3B82F6;
    --color-primary-hover: #60A5FA;
    --color-primary-disabled: #1E3A5F;
    --color-success: #34D399;
    --color-success-hover: #10B981;
    --color-danger: #F87171;
    --color-danger-hover: #EF4444;
    --color-warning: #FBBF24;
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --text-placeholder: #64748B;
    --border-color: #334155;
    --card-bg: #1E293B;
    --nav-bg: #1E293B;
    --nav-border: #334155;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}

[data-theme="dark"] .error-message {
    background: #3B1818;
    border-color: #7F1D1D;
}

/* ── Theme toggle ── */

.theme-toggle {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-card);
}

.theme-toggle:hover {
    border-color: var(--color-primary);
    transform: scale(1.05);
}

/* ── Pre-wizard screens ── */

.pre-wizard-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.disclaimer-icon {
    color: var(--color-warning);
}

/* Language selection buttons */

.language-buttons {
    display: flex;
    gap: 16px;
    margin-top: 16px;
}

.btn-language {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 40px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 160px;
}

.btn-language:hover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.04);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.lang-flag {
    font-size: 36px;
}

.lang-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Disclaimer card */

.disclaimer-card {
    background: var(--card-bg);
    border: 1.5px solid var(--color-warning);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: left;
    max-width: 560px;
    box-shadow: var(--shadow-card);
}

.disclaimer-card p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.disclaimer-sub {
    font-size: 13px !important;
    color: var(--text-muted) !important;
}

.disclaimer-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.disclaimer-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

/* Resume choice */

.resume-progress {
    font-size: 14px;
    color: var(--text-muted);
    background: var(--nav-bg);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    margin: 4px 0;
}

.resume-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    max-width: 440px;
    width: 100%;
}

.resume-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    text-align: left;
    min-width: auto;
    border-radius: var(--radius-lg);
}

.resume-btn-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.resume-btn-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.resume-btn-text strong {
    font-size: 15px;
}

.resume-btn-text small {
    font-size: 13px;
    opacity: 0.8;
    font-weight: 400;
}

/* ── Verification progress ── */

.verification-progress-bar {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 16px 0 8px;
}

.verification-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.verification-progress-step .step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.verification-progress-step.active .step-dot {
    background: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
    animation: pulse-dot 1.5s ease infinite;
}

.verification-progress-step.completed .step-dot {
    background: var(--color-success);
}

.verification-progress-step .step-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.verification-progress-step.active .step-label {
    color: var(--color-primary);
    font-weight: 600;
}

.verification-progress-step.completed .step-label {
    color: var(--color-success);
}

.verification-progress-fill-container {
    width: 100%;
    max-width: 300px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin: 0 auto 12px;
    overflow: hidden;
}

.verification-progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width 0.6s ease;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2); }
    50% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.1); }
}

/* Verification pair fade-in */

.vp-fade-in {
    animation: fadeSlideIn 0.4s ease forwards;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.vp-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 4px;
}

#verificationStatus {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 400px;
    text-align: center;
}

/* ── Responsive additions ── */

@media (max-width: 640px) {
    .language-buttons { flex-direction: column; align-items: center; }
    .btn-language { min-width: 200px; padding: 20px 32px; }
    .resume-buttons { max-width: 100%; }
    .theme-toggle { top: 8px; right: 8px; width: 36px; height: 36px; font-size: 16px; }
}
