/* ═══════════════════════════════════════════════════
   DysphoShare v2 — Design System
   ═══════════════════════════════════════════════════ */

:root {
    --font: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'IBM Plex Mono', 'Menlo', monospace;
    --bg:       #fdfdfd;
    --surface:  #ffffff;
    --subtle:   #f6f6f8;
    --border:   #e8e8ec;
    --border-h: #d0d0d8;
    --ink:      #111118;
    --ink-2:    #52525e;
    --ink-3:    #8c8c96;
    --ink-4:    #b4b4bc;
    --blue:     #2563eb;
    --blue-bg:  #eff5ff;
    --green:    #16a34a;
    --green-bg: #effaf3;
    --red:      #dc2626;
    --red-bg:   #fef2f2;
    --amber:    #d97706;
    --amber-bg: #fffbeb;
    --radius:   10px;
    --radius-s: 6px;
    --shadow-s: 0 1px 2px rgba(0,0,0,0.04);
    --shadow:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-l: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --tr:       0.15s ease;
    --nav-bg:   rgba(253,253,253,0.85);
    --content-w: 860px;
}

/* ── Dark Mode ── */
[data-theme="dark"] {
    --bg:       #0c0c10;
    --surface:  #16161d;
    --subtle:   #1c1c26;
    --border:   #2c2c3a;
    --border-h: #40405a;
    --ink:      #f0f0f4;
    --ink-2:    #b0b0c0;
    --ink-3:    #8888a0;
    --ink-4:    #5a5a72;
    --blue:     #6b9bff;
    --blue-bg:  rgba(107,155,255,0.12);
    --green:    #4ade80;
    --green-bg: rgba(74,222,128,0.12);
    --red:      #fb7185;
    --red-bg:   rgba(251,113,133,0.12);
    --amber:    #fbbf24;
    --amber-bg: rgba(251,191,36,0.1);
    --shadow-s: 0 1px 2px rgba(0,0,0,0.3);
    --shadow:   0 1px 3px rgba(0,0,0,0.4);
    --shadow-l: 0 4px 12px rgba(0,0,0,0.5);
    --nav-bg:   rgba(12,12,16,0.88);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; min-height: 100vh; transition: background 0.3s, color 0.3s; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
::selection { background: var(--blue); color: white; }

/* ── Nav ── */
nav { position: sticky; top: 0; z-index: 50; background: var(--nav-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav-inner { max-width: var(--content-w); margin: 0 auto; padding: 0 1.5rem; height: 56px; display: flex; align-items: center; justify-content: space-between; }
.nav-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.95rem; text-decoration: none; letter-spacing: -0.01em; }
.nav-brand svg { color: var(--blue); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-meta { font-size: 0.75rem; color: var(--ink-3); letter-spacing: 0.01em; }

/* ── Theme Toggle ── */
.theme-toggle { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--ink-3); transition: all var(--tr); }
.theme-toggle:hover { border-color: var(--border-h); color: var(--ink); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ── Main ── */
main { max-width: var(--content-w); margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
main.landing-main { max-width: none; padding: 0; }

/* ── Views ── */
.view { display: none; }
.view.active { display: block; animation: enter 0.35s ease; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ═══ PICK ═══ */
.pick-hero { margin-bottom: 2rem; }
.pick-hero h1 { font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.03em; }
.pick-sub { margin-top: 0.75rem; font-size: 1.05rem; color: var(--ink-2); line-height: 1.5; }
.pick-zone { width: 100%; background: var(--surface); border: 2px dashed var(--border); border-radius: var(--radius); padding: 3rem 2rem; transition: all var(--tr); }
.pick-zone:hover, .pick-zone:focus-visible { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.pick-zone-inner { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.pick-icon { width: 56px; height: 56px; border-radius: 14px; background: var(--blue-bg); display: flex; align-items: center; justify-content: center; color: var(--blue); transition: transform var(--tr); }
.pick-zone:hover .pick-icon { transform: translateY(-3px); }
.pick-label { font-weight: 600; font-size: 1rem; }
.pick-hint { font-size: 0.825rem; color: var(--ink-3); }
.pick-hint kbd { display: inline-block; padding: 2px 6px; background: var(--subtle); border: 1px solid var(--border); border-radius: 4px; font-family: var(--mono); font-size: 0.75rem; line-height: 1.4; }

/* ═══ DROP OVERLAY ═══ */
.global-drop-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(37,99,235,0.06); backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; }
.global-drop-overlay.active { display: flex; }
.drop-cta { display: flex; flex-direction: column; align-items: center; gap: 1rem; color: var(--blue); font-size: 1.1rem; font-weight: 600; position: relative; }
.drop-cta-ring { position: absolute; width: 160px; height: 160px; border: 2px dashed var(--blue); border-radius: 50%; opacity: 0.3; animation: ring-pulse 2s ease infinite; }
@keyframes ring-pulse { 0%, 100% { transform: scale(0.8); opacity: 0.2; } 50% { transform: scale(1.1); opacity: 0.35; } }

/* ═══ CONFIG ═══ */
.config-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1rem; }
.config-header h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.btn-text { background: none; border: none; color: var(--blue); font-weight: 600; font-size: 0.875rem; padding: 4px 8px; border-radius: var(--radius-s); transition: background var(--tr); }
.btn-text:hover { background: var(--blue-bg); }

.file-grid { display: grid; grid-template-columns: 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.file-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.875rem; background: var(--surface); transition: background var(--tr); }
.file-row:hover { background: var(--subtle); }

.file-row-icon { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.file-row-icon.cat-image { background: #fce7f3; color: #be185d; }
.file-row-icon.cat-video { background: #ede9fe; color: #7c3aed; }
.file-row-icon.cat-audio { background: #fef3c7; color: #b45309; }
.file-row-icon.cat-code  { background: #ecfdf5; color: #059669; }
.file-row-icon.cat-text  { background: var(--blue-bg); color: var(--blue); }
.file-row-icon.cat-pdf   { background: var(--red-bg); color: var(--red); }
.file-row-icon.cat-file  { background: var(--subtle); color: var(--ink-3); }
.file-row-icon.cat-zip   { background: #fff7ed; color: #c2410c; }

[data-theme="dark"] .file-row-icon.cat-image { background: rgba(190,24,93,0.18); color: #f472b6; }
[data-theme="dark"] .file-row-icon.cat-video { background: rgba(124,58,237,0.18); color: #a78bfa; }
[data-theme="dark"] .file-row-icon.cat-audio { background: rgba(180,83,9,0.18); color: #fbbf24; }
[data-theme="dark"] .file-row-icon.cat-code  { background: rgba(5,150,105,0.18); color: #4ade80; }
[data-theme="dark"] .file-row-icon.cat-zip   { background: rgba(194,65,12,0.18); color: #fb923c; }

.file-row-info { flex: 1; min-width: 0; }
.file-row-name { font-size: 0.875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row-size { font-size: 0.75rem; color: var(--ink-3); font-family: var(--mono); }
.file-row-thumb { width: 32px; height: 32px; border-radius: 5px; object-fit: cover; flex-shrink: 0; }
.file-row-rm { width: 36px; height: 36px; border-radius: 6px; border: none; background: transparent; color: var(--ink-4); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all var(--tr); }
.file-row-rm:hover { background: var(--red-bg); color: var(--red); }
.file-row-rm svg { width: 15px; height: 15px; }

/* Config Panel */
.config-panel { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.config-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.config-row:last-child { border-bottom: none; }
.config-row label { font-size: 0.875rem; font-weight: 600; flex-shrink: 0; white-space: nowrap; }
.cfg-label-wrap { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; min-width: 0; }
.cfg-hint { font-size: 0.72rem; color: var(--ink-3); font-weight: 400; white-space: normal; line-height: 1.35; }

.seg-group { display: flex; background: var(--subtle); border-radius: var(--radius-s); padding: 2px; gap: 2px; }
.seg { padding: 7px 12px; font-size: 0.8rem; font-weight: 600; border: none; background: transparent; color: var(--ink-3); border-radius: 4px; transition: all var(--tr); white-space: nowrap; min-height: 36px; }
.seg:hover { color: var(--ink-2); }
.seg.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-s); }

.cfg-input { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-s); font-size: 0.85rem; background: var(--surface); color: var(--ink); text-align: right; transition: border-color var(--tr); max-width: 280px; }
.cfg-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.cfg-input::placeholder { color: var(--ink-4); }
[data-theme="dark"] .cfg-input::placeholder { color: var(--ink-3); }

.toggle-chip { padding: 7px 16px; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--ink-3); border-radius: 20px; transition: all var(--tr); min-height: 36px; }
.toggle-chip:hover { border-color: var(--border-h); }
.toggle-chip.on { background: var(--red-bg); border-color: transparent; color: var(--red); }

/* Upload Btn */
.btn-upload { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 24px; background: var(--ink); color: var(--bg); border: none; border-radius: var(--radius); font-size: 0.95rem; font-weight: 600; transition: all var(--tr); box-shadow: var(--shadow); }
.btn-upload:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: var(--shadow-l); }
.btn-upload:active { transform: translateY(0); }
.btn-upload:disabled { opacity: 0.4; pointer-events: none; }

/* ═══ UPLOAD VIEW ═══ */
.upload-status { margin-bottom: 1.5rem; }
.upload-status h2 { font-size: 1.1rem; font-weight: 700; }
.upload-sub { font-size: 0.875rem; color: var(--ink-2); margin-top: 0.25rem; }

.upload-files { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.upload-file-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.875rem; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 0.85rem; position: relative; overflow: hidden; }
.upload-file-row:last-child { border-bottom: none; }
.upload-file-row .uf-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--blue-bg); width: 0%; transition: width 0.3s ease; z-index: 0; }
.upload-file-row .uf-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; position: relative; z-index: 1; }
.upload-file-row .uf-status { font-size: 0.75rem; font-family: var(--mono); color: var(--ink-3); flex-shrink: 0; position: relative; z-index: 1; }
.upload-file-row .uf-status.done { color: var(--green); }
.upload-file-row .uf-status.active { color: var(--blue); }
.upload-file-row .uf-status.error { color: var(--red); }

.upload-bar-wrap { margin-bottom: 1rem; }
.upload-bar { height: 4px; background: var(--subtle); border-radius: 2px; overflow: hidden; }
.upload-bar-fill { height: 100%; width: 0%; background: var(--blue); border-radius: 2px; transition: width 0.3s ease; }
.upload-bar-meta { display: flex; justify-content: space-between; font-size: 0.75rem; font-family: var(--mono); color: var(--ink-3); margin-top: 6px; }

.btn-cancel { display: flex; align-items: center; gap: 6px; margin: 0 auto; padding: 10px 24px; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-s); font-size: 0.85rem; font-weight: 500; color: var(--ink-2); transition: all var(--tr); min-height: 44px; }
.btn-cancel:hover { background: var(--red-bg); color: var(--red); border-color: transparent; }

/* ═══ DONE ═══ */
.done-check { width: 64px; height: 64px; border-radius: 50%; background: var(--green-bg); color: var(--green); display: flex; align-items: center; justify-content: center; margin: 0 auto 1.25rem; animation: check-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.4); }
@keyframes check-pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
.done-title { text-align: center; font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; }
.done-link-box { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem; }
.done-link-input { flex: 1; padding: 10px 14px; border: none; background: var(--subtle); font-family: var(--mono); font-size: 0.825rem; color: var(--ink); min-width: 0; outline: none; }
.btn-copy { padding: 10px 18px; background: var(--ink); color: var(--bg); border: none; font-size: 0.85rem; font-weight: 600; transition: background var(--tr); flex-shrink: 0; }
.btn-copy:hover { opacity: 0.85; }
.btn-copy.copied { background: var(--green); color: white; }
.qr-wrap { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.qr-wrap canvas { border-radius: var(--radius-s); border: 1px solid var(--border); }
.btn-new { display: block; margin: 0 auto; font-size: 0.9rem; }

/* ── Alerts ── */
.alert-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius-s); font-size: 0.85rem; font-weight: 500; margin-bottom: 0.75rem; }
.alert-bar svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-bar.warn { background: var(--amber-bg); color: var(--amber); }
.alert-bar.info { background: var(--blue-bg); color: var(--blue); }
.alert-bar.ok   { background: var(--green-bg); color: var(--green); }
.alert-bar.err  { background: var(--red-bg); color: var(--red); }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(16px); background: var(--ink); color: var(--bg); padding: 10px 20px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 100; box-shadow: var(--shadow-l); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Lightbox ── */
.lightbox { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,0.9); display: none; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox.active { display: flex; animation: enter 0.2s ease; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 8px; object-fit: contain; }

/* ── Folder badge ── */
.folder-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; background: var(--blue-bg); color: var(--blue); border-radius: 20px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em; }
.folder-badge svg { width: 13px; height: 13px; }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 560px) {
    main { padding: 1.5rem 1rem 3rem; }
    .pick-hero h1 { font-size: 1.75rem; }
    .seg { padding: 8px 10px; font-size: 0.75rem; min-height: 40px; }
    .config-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .cfg-input { max-width: 100%; text-align: left; }
    .seg-group { flex-wrap: wrap; }
    .nav-meta { display: none; }
    .done-link-box { flex-direction: column; }
    .btn-copy { width: 100%; min-height: 44px; }
    .btn-upload { min-height: 48px; }
    .pick-zone { padding: 2.5rem 1.5rem; }
    .file-row-rm { width: 44px; height: 44px; }
    .toggle-chip { min-height: 40px; padding: 8px 18px; }
}
