/* ============================================================
   Misc Stash — Developer Toolbox
   Dark minimal theme, indigo accent (#6366f1)
   ============================================================ */

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

:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --bg-input: #1a1a1a;
  --bg-sidebar: #0f0f0f;
  --border: #222222;
  --border-focus: #6366f1;
  --text: #e4e4e7;
  --text-dim: #71717a;
  --text-bright: #fafafa;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-dim: rgba(99, 102, 241, 0.15);
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --radius: 8px;
  --sidebar-w: 240px;
  --transition: 0.2s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--accent);
}

.logo-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.nav-list {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-link {
  display: block;
  padding: 8px 20px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}

.nav-link:hover {
  color: var(--text);
  background: var(--accent-dim);
}

.nav-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-dim);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.privacy-notice {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* --- Main Content --- */
.main {
  margin-left: var(--sidebar-w);
  padding: 32px 32px 64px;
  max-width: 900px;
}

/* --- Tool Cards --- */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 32px;
  overflow: hidden;
}

.tool-title {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text-bright);
}

.tool-body {
  padding: 20px;
}

/* --- Inputs & Outputs --- */
.mono-input,
.mono-output {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition);
  resize: vertical;
}

.mono-input:focus {
  border-color: var(--border-focus);
}

.mono-output {
  background: #0d0d0d;
  cursor: default;
}

.textarea-output {
  min-height: 80px;
  margin-top: 12px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
  color: var(--text);
  gap: 6px;
}

.btn:hover {
  border-color: var(--text-dim);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-dim);
}

.btn-copy {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
  font-size: 0.8rem;
}

.btn-copy:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.btn-copy.copied {
  color: var(--success);
  border-color: var(--success);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* --- Controls --- */
.control-row {
  margin-bottom: 16px;
}

.control-row label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  outline: none;
  border: 1px solid var(--border);
}

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

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
}

.checkbox-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.checkbox-row label {
  font-size: 0.85rem;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.checkbox-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* --- Password specific --- */
.password-output-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.password-output-row input {
  flex: 1;
}

.password-strength {
  height: 4px;
  border-radius: 2px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.password-strength.str-weak { background: var(--error); width: 25%; }
.password-strength.str-fair { background: var(--warning); width: 50%; }
.password-strength.str-good { background: #84cc16; width: 75%; }
.password-strength.str-strong { background: var(--success); width: 100%; }

/* --- Error messages --- */
.error-msg {
  color: var(--error);
  font-size: 0.8rem;
  min-height: 1.2em;
  margin-top: 6px;
}

/* --- JSON output with syntax highlighting --- */
.json-output {
  margin-top: 12px;
  min-height: 60px;
  max-height: 500px;
  overflow: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 12px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.json-key { color: #818cf8; }
.json-string { color: #34d399; }
.json-number { color: #f59e0b; }
.json-boolean { color: #fb923c; }
.json-null { color: #71717a; }

/* --- Hash results --- */
.hash-results,
.color-results {
  margin-top: 16px;
}

.hash-row,
.color-row {
  margin-bottom: 10px;
}

.hash-row label,
.color-row label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hash-value-row {
  display: flex;
  gap: 6px;
}

.hash-value-row input {
  flex: 1;
  font-size: 0.78rem;
}

/* --- Color specific --- */
.color-input-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.color-input-row input {
  flex: 1;
}

.color-swatch {
  width: 48px;
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  flex-shrink: 0;
}

/* --- Timestamp specific --- */
.timestamp-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.timestamp-col label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.timestamp-col input {
  margin-bottom: 8px;
}

.ts-live {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
}

/* --- Diff specific --- */
.diff-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.diff-col label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.diff-output {
  margin-top: 16px;
  font-family: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.diff-line {
  padding: 2px 8px;
  border-radius: 2px;
}

.diff-added {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.diff-removed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.diff-same {
  color: var(--text-dim);
}

/* --- Hamburger (mobile) --- */
.hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: all var(--transition);
}

.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 90;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main {
    margin-left: 0;
    padding: 60px 16px 48px;
  }

  .timestamp-row,
  .diff-inputs {
    grid-template-columns: 1fr;
  }

  .checkbox-row {
    flex-direction: column;
    gap: 8px;
  }
}

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

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

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

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

/* --- Selection --- */
::selection {
  background: var(--accent);
  color: #fff;
}
