/* =============================================
   Dictionary Maker — Global Styles
   Theme: Clean, light, professional
   ============================================= */

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

:root {
    --bg:           #f5f6f8;
    --surface:      #ffffff;
    --border:       #e2e5ea;
    --border-light: #eceef2;

    --accent:       #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft:  rgba(37, 99, 235, 0.07);

    --text:         #111827;
    --text-secondary: #6b7280;
    --text-muted:   #9ca3af;

    --success:      #16a34a;
    --danger:       #dc2626;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:    0 4px 14px rgba(0,0,0,0.09), 0 2px 4px rgba(0,0,0,0.04);
}

html, body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

/* ── Navbar ───────────────────────────────── */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
}

.nav-brand-link { text-decoration: none; color: inherit; }

.nav-link {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 2px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s;
}

.nav-link.active,
.nav-link:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-icon-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.nav-icon-btn:hover { background: var(--bg); color: var(--text); }

.nav-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
}

/* ── Home / Landing ───────────────────────── */
.home-main {
    max-width: 860px;
    margin: 0 auto;
    padding: 72px 24px 100px;
}

.hero-section {
    text-align: center;
    margin-bottom: 52px;
}

.hero-title {
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 800;
    letter-spacing: -0.8px;
    line-height: 1.2;
    color: var(--text);
}

.workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.workflow-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px 28px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow 0.2s, border-color 0.2s;
    box-shadow: var(--shadow-sm);
}

.workflow-card:hover {
    box-shadow: var(--shadow);
    border-color: #d1d5db;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 4px;
}

.card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon--light {
    background: #f3f4f6;
    border: 1px solid var(--border);
}

.card-icon--accent { background: var(--accent); }

.card-version {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 20px;
}

.card-badge {
    font-size: 10px;
    font-weight: 700;
    color: white;
    background: var(--accent);
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.card-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text);
}

.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
    flex: 1;
}

.card-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 14px;
    width: fit-content;
    transition: all 0.15s;
}

.card-action:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* ── Inner Pages ──────────────────────────── */
.page-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 48px 24px 100px;
}

.page-header { margin-bottom: 36px; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 16px;
    transition: color 0.15s;
}

.back-link:hover { color: var(--accent); }

.page-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.page-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
    margin-bottom: 6px;
}

.page-badge {
    font-size: 10px;
    font-weight: 700;
    color: white;
    background: var(--accent);
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── Steps ────────────────────────────────── */
.steps-container { display: flex; flex-direction: column; }

.step {
    display: flex;
    gap: 20px;
    padding: 28px 0;
    border-bottom: 1px solid var(--border-light);
    transition: opacity 0.25s;
}

.step:last-child { border-bottom: none; }

.step.locked {
    opacity: 0.35;
    pointer-events: none;
}

.step.active,
.step.done { opacity: 1; }

.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 36px;
}

.step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.step.active .step-num {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

.step.done .step-num {
    border-color: var(--success);
    background: var(--success);
    color: white;
}

.step-line {
    width: 2px;
    flex: 1;
    min-height: 20px;
    background: var(--border-light);
    margin-top: 6px;
}

.step-body {
    flex: 1;
    min-width: 0;
    padding-top: 5px;
}

.step-title {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.step-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 18px;
}

code {
    background: #f3f4f6;
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    color: var(--accent);
}

.section-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.input-method-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

/* ── Drop Zone ────────────────────────────── */
.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 36px 24px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 14px;
    gap: 8px;
    background: var(--bg);
    text-align: center;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.drop-zone--sm { padding: 22px 20px; }

.drop-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.drop-icon--sm { width: 36px; height: 36px; border-radius: 8px; }

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

.drop-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Buttons ──────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    line-height: 1;
}

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

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

.btn--outline {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn--outline:hover:not(:disabled) {
    color: var(--text);
    border-color: #9ca3af;
}

.btn--sm {
    padding: 6px 14px;
    font-size: 12.5px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn--sm:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

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

.step-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Status ───────────────────────────────── */
.status {
    margin-top: 10px;
    font-size: 13px;
    min-height: 18px;
    font-weight: 500;
}

.status.ok   { color: var(--success); }
.status.err  { color: var(--danger); }
.status.wait { color: var(--accent); }

/* ── Stats ────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: center;
}

.stat-val {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.5px;
}

.stat-key {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 500;
}

.other-types { font-size: 12.5px; color: var(--text-secondary); line-height: 2; }

.other-types span {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    color: var(--text);
}

.other-types span b { color: var(--accent); }

/* ── Result Panel ─────────────────────────── */
.result-panel {
    margin-top: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}

.result-row:last-child { border-bottom: none; }
.result-label { font-size: 13px; color: var(--text-secondary); }

.result-val {
    font-size: 15px;
    font-weight: 700;
    color: var(--success);
}

/* ── Downloads ────────────────────────────── */
.dl-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dl-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
    flex: 1;
    min-width: 180px;
}

.dl-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow);
}

.dl-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.7;
}

/* ── Method Cards ─────────────────────────── */
.method-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
}

.method-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    background: var(--surface);
    transition: all 0.15s;
}

.method-card:hover { border-color: var(--accent); background: var(--accent-soft); }

.method-card--selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.method-card-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.method-card--selected .method-card-icon {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: var(--accent);
}

.method-card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

.method-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.method-check {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.method-check--active {
    background: var(--accent);
    border-color: var(--accent);
}

.optional-badge {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 640px) {
    .workflow-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .step { gap: 14px; }
    .hero-title { font-size: 26px; }
}

/* ── Modal ────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.modal-visible {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 36px 32px 28px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    animation: modal-in 0.2s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #dcfce7;
    border: 1.5px solid #bbf7d0;
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.modal-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text);
}

.modal-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-downloads {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin: 8px 0 4px;
}

.modal-downloads .dl-btn {
    flex: unset;
    min-width: unset;
    width: 100%;
    justify-content: center;
}

.modal-close {
    margin-top: 4px;
    width: 100%;
    justify-content: center;
}

/* ── Nav Reset Button ─────────────────────── */
.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}


/* ── Survey source switcher + ODK XML form ─── */
.source-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 100%;
    flex-wrap: wrap;
}

.source-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}

.source-tab:hover { color: var(--text); }

.source-tab.active {
    background: var(--surface);
    color: var(--accent);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.source-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#srcExcel[hidden], #srcXml[hidden],
#authBasic[hidden], #authBearer[hidden], #authNote[hidden] { display: none; }

.field { margin-bottom: 14px; }

.field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.field-input {
    width: 100%;
    padding: 9px 12px;
    font-family: var(--font);
    font-size: 13.5px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input::placeholder { color: var(--text-muted); }

.field-input:hover { border-color: #9ca3af; }

.field-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.auth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.auth-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: -4px 0 14px;
}

#srcXml .btn { margin-top: 2px; }

@media (max-width: 640px) {
    .auth-grid { grid-template-columns: 1fr; }
    .source-tab { flex: 1; justify-content: center; }
}
