/* ====== DSD Converter — CSS ====== */
:root {
    --bg: #f6f9fc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-secondary: #64748b;
    --accent: #4f8cff;
    --accent-hover: #3a75e8;
    --green: #34d399;
    --red: #f87171;
    --orange: #fbbf24;
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.back-link { color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
.back-link:hover { color: var(--text); }
.topbar-title { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.user-badge { font-size: 0.85rem; color: var(--text-secondary); }
.btn-logout {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-secondary); padding: 0.35rem 0.85rem;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 0.8rem; transition: all 0.2s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

.container { max-width: 720px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.hero { text-align: center; margin-bottom: 2rem; }
.hero h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.5rem; }
.hero-desc { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.7; }
.hero-desc .note {
    display: inline-block; margin-top: 0.25rem; padding: 0.2rem 0.6rem;
    background: rgba(79, 140, 255, 0.12); color: var(--accent);
    border-radius: 4px; font-size: 0.8rem;
}

.tab-bar {
    display: flex; gap: 4px; background: #f1f5f9;
    border-radius: var(--radius); padding: 4px; margin-bottom: 1.5rem;
}
.tab-btn {
    flex: 1; background: transparent; border: none; color: var(--text-secondary);
    padding: 0.7rem 1rem; border-radius: calc(var(--radius) - 4px);
    cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--accent); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; margin-bottom: 1rem; }

.drop-zone { text-align: center; cursor: pointer; transition: all 0.2s; border-style: dashed; border-width: 2px; }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: var(--surface-hover); }
.drop-icon { color: var(--text-secondary); margin-bottom: 1rem; }
.drop-text { font-size: 1rem; margin-bottom: 0.3rem; }
.drop-hint { font-size: 0.85rem; color: var(--text-secondary); }
.btn-primary {
    margin-top: 1rem; background: var(--accent); color: #fff; border: none;
    padding: 0.7rem 1.8rem; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
    background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border); padding: 0.5rem 1.2rem;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem; transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--text-secondary); color: var(--text); }
.file-name { margin-left: 0.5rem; color: var(--green); font-size: 0.85rem; }

/* ── File select area ── */
.file-select-area { padding: 1.25rem 1.5rem; }
.file-select-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.file-select-row:last-child { margin-bottom: 0; }
.btn-file-select {
    display: inline-flex; align-items: center; gap: 0.4rem; flex-shrink: 0;
    background: transparent; border: 1px solid var(--border);
    color: var(--text); padding: 0.55rem 1rem;
    border-radius: var(--radius-sm); cursor: pointer;
    font-size: 0.85rem; font-weight: 500; transition: all 0.2s;
}
.btn-file-select:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon { font-size: 1rem; }

/* ── Summary card ── */
.summary-card { padding: 1.25rem 1.5rem; border-color: var(--accent); }
.summary-files { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.summary-item { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.summary-label { font-weight: 600; min-width: 4rem; }
.summary-value { color: var(--text); }
.summary-mode {
    font-size: 0.8rem; color: var(--accent); font-weight: 500;
    padding: 0.3rem 0.6rem; background: rgba(79, 140, 255, 0.1);
    border-radius: 4px; display: inline-block;
}

/* ── Convert button area ── */
.convert-area { text-align: center; }
.btn-convert {
    background: var(--accent); color: #fff; border: none;
    padding: 0.9rem 3rem; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 1.05rem; font-weight: 600;
    transition: all 0.2s;
}
.btn-convert:hover:not(:disabled) { background: var(--accent-hover); }
.btn-convert:disabled { opacity: 0.35; cursor: not-allowed; }
.convert-hint { margin-top: 0.6rem; font-size: 0.8rem; color: var(--text-secondary); }

.progress-panel { padding: 1.5rem; }
.progress-info { display: flex; justify-content: space-between; margin-bottom: 0.75rem; font-size: 0.9rem; }
.progress-file { color: var(--text); }
.progress-status { color: var(--accent); }
.progress-bar-bg { width: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { width: 0%; height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s ease; }

.validation-card h3 { font-size: 0.95rem; margin-bottom: 0.75rem; color: var(--text-secondary); }
.validation-item { font-size: 0.85rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.validation-item:last-child { border-bottom: none; }
.validation-warn { color: var(--orange); }
.validation-err { color: var(--red); }

.result-card { text-align: center; border-color: var(--green); }
.result-icon { font-size: 2.5rem; color: var(--green); margin-bottom: 0.5rem; }
.result-msg { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }
.btn-download {
    display: inline-block; background: var(--green); color: #000;
    padding: 0.7rem 2rem; border-radius: var(--radius-sm);
    text-decoration: none; font-weight: 600; font-size: 0.95rem; transition: opacity 0.2s;
}
.btn-download:hover { opacity: 0.85; }

.btn-save-folder {
    display: inline-block; background: var(--accent); color: #fff;
    border: none; padding: 0.8rem 2rem; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 1rem; font-weight: 600;
    transition: background 0.2s;
}
.btn-save-folder:hover { background: var(--accent-hover); }

.file-list { text-align: left; margin-top: 1rem; padding: 1rem; background: var(--surface-hover); border-radius: var(--radius-sm); }
.file-list ul { margin: 0; padding: 0; }

.fallback-download { margin-top: 1rem; padding: 1rem; background: rgba(251, 191, 36, 0.1); border-radius: var(--radius-sm); border: 1px solid rgba(251, 191, 36, 0.3); }

.result-detail { font-size: 0.85rem; color: var(--text-secondary); }
.result-detail .file-row { padding: 0.3rem 0; }

.error-card { text-align: center; border-color: var(--red); }
.error-icon { font-size: 2rem; color: var(--red); margin-bottom: 0.5rem; }
#errorMessage { color: var(--red); font-size: 0.95rem; }

.footer { text-align: center; color: var(--text-secondary); font-size: 0.8rem; padding: 2rem 0; }

@media (max-width: 600px) {
    .topbar { padding: 0 1rem; }
    .container { padding: 1.5rem 1rem 3rem; }
    .hero h2 { font-size: 1.3rem; }
    .card { padding: 1.5rem; }
}
