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

:root {
  --bg:           #0d0b14;
  --surface:      #13102a;
  --surface2:     #1a1535;
  --border:       #2e2060;
  --border2:      #4a3480;
  --accent:       #9b5cff;
  --accent-dim:   #7b3de8;
  --accent-glow:  rgba(155, 92, 255, 0.15);
  --text:         #eee8ff;
  --text-muted:   #7a6aa0;
  --text-dim:     #c4b8e8;
  --danger:       #ff5a5a;
  --success:      #4aefb0;
  --info:         #a87dff;
  --radius:       10px;
  --radius-lg:    16px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Syne', sans-serif; }
body { display: flex; flex-direction: column; min-height: 100vh; }

body::before {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% -10%, rgba(120, 60, 255, 0.12) 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}

.app { position: relative; z-index: 1; max-width: 860px; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; width: 100%; flex: 1; }

header { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 2.5rem; animation: fadeUp 0.5s ease both; }
.logo { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.logo span { color: var(--accent); }
.tagline {
  font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted);
  letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px;
  border: 1px solid var(--border2); border-radius: 4px; white-space: nowrap;
}

/* Drop Zone */
.drop-zone {
  border: 1.5px dashed var(--border2); border-radius: var(--radius-lg);
  padding: 3rem 2rem; text-align: center; cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  background: var(--surface); margin-bottom: 1rem;
  position: relative; overflow: hidden; animation: fadeUp 0.5s 0.1s ease both;
}
.drop-zone::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(120, 60, 255, 0.07) 0%, transparent 70%);
  pointer-events: none;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: #1c1640; transform: scale(1.005); }
.drop-icon {
  width: 56px; height: 56px; background: var(--surface2); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem; border: 1px solid var(--border); font-size: 26px;
  transition: background 0.2s, transform 0.2s;
}
.drop-zone:hover .drop-icon, .drop-zone.drag-over .drop-icon {
  background: var(--accent-glow); transform: scale(1.1) rotate(-4deg);
}
.drop-zone h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.drop-zone p { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-muted); }
.drop-zone .hint {
  margin-top: 1.2rem; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(155, 92, 255, 0.08); border: 1px solid rgba(155, 92, 255, 0.2);
  border-radius: 6px; padding: 5px 12px;
  font-family: 'DM Mono', monospace; font-size: 11px; color: var(--accent);
}
#folder-input { display: none; }

/* Notice */
.notice {
  font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted);
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 14px; margin-bottom: 1rem; align-items: center; gap: 8px; display: none;
}
.notice.visible { display: flex; }

/* Folder list */
.section-label {
  font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px;
  display: none; align-items: center; gap: 8px;
}
.section-label.visible { display: flex; }
.count-badge {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; padding: 1px 8px; font-size: 10px; color: var(--text-dim);
}

.folder-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1.5rem; }

.folder-item {
  display: grid; grid-template-columns: 40px 1fr auto auto 28px;
  align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px;
  transition: border-color 0.15s; animation: slideIn 0.25s ease both;
}
.folder-item:hover { border-color: var(--border2); }
.folder-item.state-processing { border-color: rgba(168,125,255,0.4); }
.folder-item.state-done       { border-color: rgba(74,239,176,0.3); }
.folder-item.state-error      { border-color: rgba(255,90,90,0.3); }

.folder-icon-wrap {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: rgba(155, 92, 255, 0.1); border: 1px solid rgba(155, 92, 255, 0.2); flex-shrink: 0;
}
.folder-info { overflow: hidden; }
.folder-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.folder-meta { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.folder-size { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted); text-align: right; white-space: nowrap; }

.folder-status {
  font-family: 'DM Mono', monospace; font-size: 11px; white-space: nowrap;
  padding: 3px 8px; border-radius: 5px; text-align: center; min-width: 90px;
}
.folder-status.pending    { color: var(--text-muted); background: var(--surface2); }
.folder-status.processing { color: var(--info); background: rgba(168,125,255,0.1); animation: pulse 1s ease-in-out infinite; }
.folder-status.done       { color: var(--success); background: rgba(74,239,176,0.08); }
.folder-status.error      { color: var(--danger); background: rgba(255,90,90,0.08); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.remove-btn {
  background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px;
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.remove-btn:hover { background: rgba(255,90,90,0.1); color: var(--danger); }

.item-progress { grid-column: 1 / -1; height: 2px; background: var(--border); border-radius: 2px; overflow: hidden; display: none; }
.item-progress-bar { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.2s; width: 0%; }
.folder-item.state-processing .item-progress { display: block; }

/* Actions */
.actions-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; animation: fadeUp 0.5s 0.2s ease both; margin-bottom: 1.5rem; }

.btn-compress {
  background: var(--accent); color: #fff; border: none; border-radius: var(--radius);
  padding: 11px 22px; font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  transition: background 0.15s, transform 0.1s, opacity 0.15s; letter-spacing: 0.02em;
  box-shadow: 0 0 20px rgba(155, 92, 255, 0.25);
}
.btn-compress:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.btn-compress:hover:not(:disabled) { background: var(--accent-dim); transform: translateY(-1px); }
.btn-compress:active:not(:disabled) { transform: scale(0.98); }

.btn-add {
  background: transparent; color: var(--accent);
  border: 1px dashed rgba(155, 92, 255, 0.4); border-radius: var(--radius);
  padding: 10px 16px; font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 600;
  cursor: pointer; display: none; align-items: center; gap: 6px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-add.visible { display: flex; }
.btn-add:hover { border-color: var(--accent); background: var(--accent-glow); }

.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border2); border-radius: var(--radius);
  padding: 10px 16px; font-family: 'Syne', sans-serif; font-size: 13px;
  cursor: pointer; display: none; align-items: center; gap: 6px;
  transition: border-color 0.1s, color 0.1s, background 0.1s;
}
.btn-ghost.visible { display: flex; }
.btn-ghost:hover { border-color: var(--danger); color: var(--danger); background: rgba(255,90,90,0.06); }

.stats-bar {
  margin-left: auto; font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-muted);
  display: none; gap: 16px; align-items: center;
}
.stats-bar.visible { display: flex; }
.stat-item strong { color: var(--text-dim); font-weight: 500; }

/* Global progress */
.global-progress { display: none; margin-bottom: 1rem; }
.gp-label { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.gp-bar-wrap { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.gp-bar { height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); border-radius: 2px; transition: width 0.3s; width: 0%; }

/* Terminal */
.terminal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: none; animation: fadeUp 0.3s ease both; }
.terminal-header { background: var(--surface2); border-bottom: 1px solid var(--border); padding: 8px 14px; display: flex; align-items: center; gap: 8px; }
.terminal-dots { display: flex; gap: 5px; }
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.d1 { background: #ff5f57; } .d2 { background: #febc2e; } .d3 { background: #28c840; }
.terminal-title { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted); margin-left: 4px; }
.terminal-body {
  padding: 14px 16px; max-height: 200px; overflow-y: auto;
  font-family: 'DM Mono', monospace; font-size: 12px; line-height: 1.8;
  scrollbar-width: thin; scrollbar-color: var(--border2) transparent;
}
.log-line { display: flex; gap: 8px; }
.log-time    { color: var(--text-muted); flex-shrink: 0; }
.log-ok      { color: var(--success); }
.log-err     { color: var(--danger); }
.log-info    { color: var(--accent); }
.log-neutral { color: var(--text-dim); }

@keyframes fadeUp  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }

footer { position: relative; z-index: 1; text-align: center; font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-muted); padding: 1rem; border-top: 1px solid var(--border); }
footer span { color: var(--accent); }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
