/* ============================================================
   Redact — Styles
   Screenshot Blur Tool
   ============================================================ */

/* ----- CSS Variables / Theme ----- */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --transition: 0.15s ease;
  --radius: 6px;
  --radius-sm: 4px;
  --topbar-h: 46px;
  --toolbar-h: 40px;
}

/* Fuchsia Glow — pink/fuchsia accent on deep plum */
[data-theme="dark"] {
  --bg: #0e0515;
  --surface: #170a24;
  --surface-alt: #1e1030;
  --surface-hover: #28163e;
  --border: #3a1e5c;
  --border-light: #4a2870;
  --text: #dcc8e8;
  --text-secondary: #a87ab8;
  --text-muted: #7a4a8a;
  --accent: #e879f9;
  --accent-hover: #f0a0ff;
  --accent-text: #0e0515;
  --success: #34d399;
  --badge-bg: rgba(255,255,255,0.06);
  --scrollbar-track: #170a24;
  --scrollbar-thumb: #3a1e5c;
  --scrollbar-thumb-hover: #5a2e80;
  --overlay-bg: rgba(8, 2, 14, 0.8);
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --region-fill: rgba(232, 121, 249, 0.15);
  --region-stroke: rgba(232, 121, 249, 0.7);
  --region-badge: rgba(232, 121, 249, 0.9);
}

[data-theme="light"] {
  --bg: #f4ecf8;
  --surface: #ffffff;
  --surface-alt: #f5eefa;
  --surface-hover: #ece0f4;
  --border: #d0b8e0;
  --border-light: #dfc8e8;
  --text: #2a1a3a;
  --text-secondary: #6a4878;
  --text-muted: #9a80aa;
  --accent: #c026d3;
  --accent-hover: #a21caf;
  --accent-text: #ffffff;
  --success: #059669;
  --badge-bg: rgba(0,0,0,0.04);
  --scrollbar-track: #f5eefa;
  --scrollbar-thumb: #c8a8d8;
  --scrollbar-thumb-hover: #b090c4;
  --overlay-bg: rgba(40, 10, 60, 0.3);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --region-fill: rgba(192, 38, 211, 0.15);
  --region-stroke: rgba(192, 38, 211, 0.7);
  --region-badge: rgba(192, 38, 211, 0.9);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ----- Scrollbar ----- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* ----- Topbar ----- */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 8px;
  z-index: 50;
  position: relative;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
}

.logo-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.topbar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--badge-bg);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  line-height: 1;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  padding: 6px 12px;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 5px 10px;
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 5px 8px;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-alt);
  color: var(--text);
}

.btn-sm {
  font-size: 12px;
  padding: 4px 8px;
}

/* ----- Theme Toggle ----- */
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }

/* ----- Welcome Screen ----- */
.welcome-screen {
  position: absolute;
  inset: var(--topbar-h) 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.welcome-content {
  max-width: 420px;
}

.welcome-icon {
  color: var(--accent);
  margin-bottom: 20px;
  opacity: 0.6;
}

.welcome-content h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.welcome-content p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.welcome-formats {
  font-size: 12px !important;
  color: var(--text-muted) !important;
  margin-bottom: 20px !important;
}

.welcome-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.welcome-buttons .btn {
  font-size: 13px;
  padding: 8px 18px;
}

/* ----- Drop Overlay ----- */
.drop-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

.drop-overlay.active {
  display: flex;
}

.drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  padding: 48px;
  border: 2px dashed var(--accent);
  border-radius: 16px;
  background: rgba(232, 121, 249, 0.05);
}

/* ----- Editor Panel ----- */
.editor-panel {
  position: absolute;
  inset: var(--topbar-h) 0 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ----- Toolbar ----- */
.toolbar {
  height: var(--toolbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 12px;
  flex-shrink: 0;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.file-info {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ----- Blur Control ----- */
.blur-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.blur-control label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.blur-step {
  font-size: 14px !important;
  font-weight: 600;
  padding: 2px 6px !important;
  line-height: 1;
  min-width: 22px;
  justify-content: center;
}

.blur-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 32px;
}

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}

.region-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ----- Canvas Container ----- */
.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Checkerboard transparency background */
  background-image:
    linear-gradient(45deg, var(--surface-alt) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-alt) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-alt) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-alt) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: var(--surface);
}

.canvas-container canvas {
  position: absolute;
}

#overlayCanvas {
  cursor: crosshair;
  touch-action: none;
}

/* ----- Toast ----- */
.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success {
  border-color: var(--success);
}

.toast.removing {
  animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .topbar-subtitle {
    display: none;
  }

  .privacy-badge {
    display: none;
  }

  .toolbar-left .file-info {
    max-width: 120px;
  }

  .blur-control {
    gap: 4px;
  }

  input[type="range"] {
    width: 60px;
  }
}

@media (max-width: 540px) {
  .topbar {
    padding: 0 8px;
    gap: 4px;
  }

  .topbar-right .btn span {
    display: none;
  }

  .toolbar {
    flex-wrap: wrap;
    height: auto;
    padding: 6px 8px;
    gap: 6px;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .file-info {
    max-width: 140px;
  }

  input[type="range"] {
    width: 50px;
  }
}
