/* ─────────────────────────────────────────────
   DupeFinder Pro for OneDrive — Stylesheet
   Dark theme matching the desktop .exe
   ───────────────────────────────────────────── */

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

:root {
  --bg:       #1a1d27;
  --bg2:      #242736;
  --bg3:      #2e3248;
  --accent:   #6c63ff;
  --accent2:  #a29bfe;
  --success:  #00b894;
  --danger:   #e17055;
  --warning:  #fdcb6e;
  --text:     #dfe6e9;
  --text2:    #b2bec3;
  --border:   #3d4166;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOP BAR ────────────────────────────────── */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg3);
  padding: 0 20px;
  height: 50px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-icon { font-size: 20px; color: var(--accent2); }
.brand-name { font-size: 16px; font-weight: 700; color: var(--accent2); }
.brand-sub  { font-size: 12px; color: var(--text2); }

#user-area  { display: flex; align-items: center; gap: 10px; }
#user-info  { display: flex; align-items: center; gap: 8px; }
#user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: none;
}
#user-name  { font-size: 13px; color: var(--text); }

/* ── PHASE PANEL ────────────────────────────── */
#phase-panel {
  display: flex;
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.phase-block {
  flex: 1;
  background: var(--bg2);
  padding: 10px 14px 8px;
}

.phase-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.phase-icon {
  font-size: 14px;
  width: 18px;
  flex-shrink: 0;
}
.phase-pending { color: #4a4f6a; }
.phase-active  { color: var(--warning); }
.phase-done    { color: var(--success); }

.phase-label { font-size: 12px; font-weight: 600; color: var(--text2); flex: 1; }
.phase-count { font-size: 11px; color: var(--success); margin-left: auto; }

.progress-track {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}
.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.ph1-fill { background: var(--warning); }
.ph2-fill { background: var(--accent); }
.ph3-fill { background: var(--success); }

.phase-msg { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── STATS ROW ──────────────────────────────── */
#stats-row {
  display: flex;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.stat-badge {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 16px;
  text-align: center;
  min-width: 110px;
}
.stat-badge.accent { border-color: var(--accent); }
.stat-val { font-size: 20px; font-weight: 700; color: var(--accent2); }
.stat-lbl { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* ── MAIN CONTENT ───────────────────────────── */
#main-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── SIGN-IN VIEW ───────────────────────────── */
#view-signin {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.signin-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.signin-logo { font-size: 40px; margin-bottom: 12px; color: var(--accent2); }
.signin-card h1 { font-size: 22px; color: var(--text); margin-bottom: 8px; }
.signin-desc {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.feature-list {
  list-style: none;
  text-align: left;
  margin: 0 auto 24px;
  max-width: 280px;
}
.feature-list li {
  font-size: 13px;
  color: var(--text2);
  padding: 3px 0;
}
.feature-list li::before { color: var(--success); }

.btn-large { width: 100%; padding: 12px 20px; font-size: 15px; }

.ms-logo { width: 18px; vertical-align: middle; margin-right: 8px; }

.signin-note {
  font-size: 11px;
  color: #6b7280;
  margin-top: 12px;
}

/* ── SCAN VIEW ──────────────────────────────── */
#view-scan {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#scan-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.scope-label { font-size: 12px; color: var(--text2); margin-bottom: 4px; display: block; }
.scope-options { display: flex; gap: 6px; flex-wrap: wrap; }

.radio-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.15s;
}
.radio-pill:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.radio-pill input { display: none; }

#folder-picker-row { margin-top: 6px; }
#scan-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── FILTER BAR ─────────────────────────────── */
#filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.filter-input { flex: 1; max-width: 400px; }

/* ── RESULTS ────────────────────────────────── */
#results-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.results-placeholder {
  color: var(--text2);
  font-size: 14px;
  text-align: center;
  padding: 40px;
}

.result-group {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg3);
  cursor: default;
  flex-wrap: wrap;
}

.group-num    { font-size: 12px; font-weight: 700; color: var(--accent2); }
.group-count  { font-size: 12px; color: var(--text2); }
.group-size   { font-size: 12px; color: var(--text2); }
.group-wasted { font-size: 12px; color: var(--warning); font-weight: 600; margin-left: auto; }
.btn-icon {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
}

.group-body { padding: 4px 0; }

.file-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover      { background: rgba(108, 99, 255, 0.05); }
.file-row.checked    { background: rgba(108, 99, 255, 0.12); }

.file-check-wrap {
  display: flex;
  align-items: center;
  padding-top: 3px;
  cursor: pointer;
}
.file-check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.file-info    { flex: 1; min-width: 0; }
.file-name    { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.file-path    { font-size: 11px; color: var(--text2); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta    { display: flex; gap: 12px; flex-wrap: wrap; }
.file-meta span { font-size: 11px; color: var(--text2); }

.newest-badge {
  display: inline-block;
  background: var(--success);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
.warn-badge {
  display: inline-block;
  background: var(--warning);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── BULK BAR ───────────────────────────────── */
#bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg3);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#bulk-count { font-size: 13px; font-weight: 600; color: var(--accent2); }
#bulk-size  { font-size: 12px; color: var(--text2); margin-left: auto; }

/* ── BUTTONS ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #ff7675; }

.btn-success { background: var(--success); color: #000; }
.btn-success:hover:not(:disabled) { background: #55efc4; }

.btn-ghost   { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled)   { background: var(--bg2); color: var(--text); }

/* ── TEXT INPUT ─────────────────────────────── */
.text-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 12px;
  font-size: 13px;
  outline: none;
  width: 100%;
}
.text-input:focus { border-color: var(--accent); }
.text-input::placeholder { color: var(--text2); }

/* ── BADGE ──────────────────────────────────── */
.badge {
  display: inline-block;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text2);
}

/* ── MODAL ──────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
}
#modal h2 { font-size: 17px; color: var(--danger); margin-bottom: 12px; }
#modal p  { font-size: 13px; color: var(--text); margin-bottom: 8px; line-height: 1.5; }
.modal-warning { color: var(--warning); font-size: 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* ── TOAST ──────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 380px;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 2000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: opacity 0.3s;
}
.toast-info    { background: var(--bg3);   color: var(--text);  border: 1px solid var(--border); }
.toast-success { background: var(--success); color: #000; }
.toast-error   { background: var(--danger);  color: #fff; }

/* ── UTILITIES ──────────────────────────────── */
.hidden { display: none !important; }
.view-center { display: flex; flex: 1; align-items: center; justify-content: center; }

/* ── SCROLLBAR ──────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }
