/* LocalVault Tools — Core Stylesheet */
:root {
  --bg: #0b1020;
  --bg-elevated: #121931;
  --bg-card: #161f3b;
  --bg-input: #0e1529;
  --border: rgba(148, 163, 184, 0.2);
  --border-strong: rgba(148, 163, 184, 0.36);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.14);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --shadow: 0 12px 32px rgba(2, 6, 23, 0.45);
  --radius: 14px;
  --radius-sm: 9px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f1f5f9;
  --border: rgba(15, 23, 42, 0.12);
  --border-strong: rgba(15, 23, 42, 0.24);
  --text: #0f172a;
  --text-muted: #475569;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-soft: rgba(2, 132, 199, 0.1);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.1);
  --warning: #d97706;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.12rem;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 600;
}

.trust-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.theme-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
}

/* Hero */
.hero {
  padding: 36px 0 22px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 3.2vw, 2.45rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.hero-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 720px;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.pill {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 999px;
}

/* Ad slots — hidden until activated by ads-config.js */
.ad-slot {
  display: none;
  margin: 18px auto;
  width: 100%;
  min-height: 90px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: var(--bg-elevated);
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.ad-slot.ad-slot--active {
  display: flex;
}

/* Tool Navigation Tabs */
.tool-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0 22px;
}

@media (max-width: 720px) {
  .tool-tabs {
    grid-template-columns: 1fr;
  }
}

.tool-tab {
  appearance: none;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}

.tool-tab:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.tool-tab.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--bg-card));
  box-shadow: 0 0 0 1px var(--accent);
}

.tool-tab-title {
  display: block;
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 3px;
}

.tool-tab-desc {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Workspace Card */
.tool-panel {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.tool-panel.is-active {
  display: block;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 0 0 4px;
  font-size: 1.32rem;
}

.panel-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Subtabs inside PDF Studio */
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.subtab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.subtab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.subpanel {
  display: none;
}

.subpanel.is-active {
  display: block;
}

/* Dropzone */
.dropzone {
  position: relative;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-input);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.dropzone-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
}

.dropzone-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Controls & Forms */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.92rem;
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

/* Buttons */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

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

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

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

.btn-secondary {
  background: var(--bg-input);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
  border-radius: 7px;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

/* File List */
.file-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
}

.file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.file-name {
  font-weight: 600;
  font-size: 0.92rem;
  word-break: break-all;
}

.file-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.file-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-info {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Status Banner */
.status-msg {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  display: none;
}

.status-msg.is-visible {
  display: block;
}

.status-msg.is-info {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text);
}

.status-msg.is-success {
  background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
  color: var(--success);
}

.status-msg.is-error {
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
}

/* Metrics Grid (STL Analyzer) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.metric-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 1.18rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Info / FAQ / SEO Content */
.content-section {
  margin: 34px 0;
}

.content-section h2 {
  font-size: 1.35rem;
  margin: 0 0 14px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.feature-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.feature-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.96rem;
}

.faq-item p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Legal Prose */
.prose {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 24px 0;
}

.prose h1 {
  margin-top: 0;
}

.prose h2 {
  margin-top: 24px;
  font-size: 1.18rem;
}

.prose p,
.prose li {
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 26px 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--accent);
}
