/* style.css — Folder Archiver, mid-light professional */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Colors ── */
  --bg:        #f0f0ee;
  --surface:   #fafaf9;
  --surface2:  #f0f0ee;
  --border:    #d8d8d4;
  --border2:   #c8c8c4;
  --text:      #1a1a18;
  --muted:     #7a7a76;
  --accent:    #1a6b4a;
  --accent-bg: #e8f4ef;
  --danger:    #c0392b;
  --success:   #1a6b4a;
  --radius:    5px;

  /* ── Font families ── */
  --font-mono:    'Cascadia Code', 'Fira Code', 'Consolas', 'Menlo',
                  'DejaVu Sans Mono', ui-monospace, monospace;
  --font-ui:      'Segoe UI', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;

  /* ── Font sizes ── */
  --fs-base:   15px;
  --fs-xs:     0.7rem;
  --fs-sm:     0.8rem;
  --fs-md:     0.875rem;
  --fs-lg:     1rem;
  --fs-h1:     1.75rem;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  background: var(--bg);
  color: var(--text);
}

/* ── App shell ── */
.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 50fr 1px 50fr;
  overflow: hidden;
}

.divider { background: var(--border); }

.pane {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ════════════ LEFT PANE ════════════ */
.pane-left {
  background: var(--surface);
  padding: 36px 32px 28px;
  gap: 22px;
}

.header { flex-shrink: 0; }

.header-eyebrow {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-eyebrow::before {
  content: '';
  width: 16px; height: 1px;
  background: var(--border2);
  display: inline-block;
}

h1 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--fs-h1);
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}
h1 em { font-style: normal; color: var(--accent); }

.header-sub {
  margin-top: 7px;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.6;
}
.header-sub code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent);
}

/* Panel */
.panel {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.panel::-webkit-scrollbar { display: none; }

.panel-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-section:last-child { border-bottom: none; }

/* Drop zone */
.drop {
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
.drop:hover, .drop.active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.drop-icon {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 8px;
  opacity: 0.5;
}
.drop-main {
  font-family: var(--font-ui);
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.drop-hint {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.folder-info {
  display: none;
  margin-top: 12px;
  padding: 9px 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--fs-md);
  align-items: center;
  gap: 10px;
}
.folder-info.visible { display: flex; }
.folder-info-name { color: var(--text); font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-info-count { color: var(--accent); flex-shrink: 0; font-weight: 600; font-size: var(--fs-sm); }

/* Filename input */
.section-label {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.filename-row {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.filename-input {
  flex: 1;
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
}
.filename-input:focus { background: var(--accent-bg); }
.filename-ext {
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--muted);
  background: var(--surface2);
  border-left: 1px solid var(--border2);
  white-space: nowrap;
}

/* ── Dynamic button ── */
.btn-generate {
  position: relative;
  width: 100%;
  height: 46px;
  padding: 0 20px;
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: background 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Idle */
.btn-idle:hover { background: #155c3e; box-shadow: 0 2px 10px rgba(26,107,74,0.2); }
.btn-idle:active { transform: scale(0.99); }

/* Disabled (pre-file-select) */
.btn-generate:disabled.btn-idle {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
}

/* Working state */
.btn-working {
  cursor: not-allowed;
  background: #155c3e;
}

/* Progress fill sits behind text */
.btn-progress-track {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.btn-progress-fill {
  display: block;
  height: 100%;
  background: rgba(255,255,255,0.12);
  transition: width 0.25s ease;
}

/* Text layer */
.btn-text {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}
.btn-text-working {
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: none;
}
.btn-pct {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 700;
  opacity: 0.85;
  flex-shrink: 0;
}
.btn-file {
  font-size: var(--fs-xs);
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

/* Done state */
.btn-done { background: var(--accent); }
.btn-done:hover { background: #155c3e; }

/* Error state */
.btn-error { background: var(--danger); }
.btn-error:hover { background: #a93226; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════ RIGHT PANE ════════════ */
.pane-right {
  background: var(--bg);
  padding: 36px 32px 28px;
  gap: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.results-label {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.results-label-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.results-label-left::before {
  content: '';
  width: 16px; height: 1px;
  background: var(--border2);
  display: inline-block;
}
.results-label-count {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--accent);
  font-weight: 700;
}

#treeContainer {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}
#treeContainer::-webkit-scrollbar { display: none; }

/* Empty state */
.results-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}
.results-empty-icon { font-size: 2rem; opacity: 0.15; display: block; margin-bottom: 4px; }
.results-empty p { font-family: var(--font-ui); font-size: var(--fs-md); font-weight: 500; }
.results-empty-hint { font-size: var(--fs-sm) !important; opacity: 0.65; }

/* File tree */
.tree { font-family: var(--font-mono); font-size: var(--fs-sm); }

.tree-dir {
  margin-bottom: 2px;
}

.tree-dir-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-sm);
  user-select: none;
  transition: background 0.1s;
}
.tree-dir-header:hover { background: var(--surface); }

.tree-dir-arrow {
  font-size: 0.55rem;
  color: var(--muted);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.tree-dir.open > .tree-dir-header .tree-dir-arrow { transform: rotate(90deg); }

.tree-dir-icon { opacity: 0.5; flex-shrink: 0; }

.tree-dir-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tree-dir-count {
  font-size: 0.65rem;
  color: var(--muted);
  flex-shrink: 0;
}

.tree-children {
  display: none;
  padding-left: 20px;
  border-left: 1px solid var(--border);
  margin-left: 15px;
  margin-bottom: 2px;
}
.tree-dir.open > .tree-children { display: block; }

.tree-file {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--muted);
  font-size: var(--fs-sm);
  transition: background 0.1s;
}
.tree-file:hover { background: var(--surface); color: var(--text); }

.tree-file-icon { opacity: 0.4; flex-shrink: 0; font-size: 0.75rem; }
.tree-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-file-size {
  font-size: 0.65rem;
  color: var(--border2);
  flex-shrink: 0;
}
.tree-file:hover .tree-file-size { color: var(--muted); }

/* Success toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ════════════ MOBILE ════════════ */
@media (max-width: 700px) {
  html, body { overflow: auto; height: auto; }
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto auto; height: auto; overflow: visible; }
  .pane { height: auto; overflow: visible; }
  .pane-left  { padding: 24px 18px 20px; }
  .pane-right { padding: 20px 18px 32px; min-height: 50vh; }
  .divider { height: 1px; width: 100%; }
  h1 { font-size: 1.5rem; }
  .panel { overflow-y: visible; }
  #treeContainer { overflow-y: visible; min-height: 300px; }
}