/* ===== components.css — All reusable UI components ===== */

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(var(--color-surface), .85);
}
[data-theme="dark"] .site-header {
  background: rgba(20,24,39,.85);
}
[data-theme="light"] .site-header,
:root:not([data-theme]) .site-header {
  background: rgba(255,255,255,.85);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-text);
  text-decoration: none;
}
.logo svg, .logo img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
  padding: 0;
  margin: 0;
}
.nav-links a {
  font-size: .925rem;
  font-weight: 500;
  color: var(--color-text-muted);
  padding: var(--space-0) 0;
  position: relative;
  transition: color var(--duration) var(--ease);
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--color-primary);
  border-radius: 1px;
  transition: width var(--duration) var(--ease);
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-primary);
}
.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after {
  width: 100%;
}

/* ---------- Theme Toggle ---------- */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-1);
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  transition: all var(--duration) var(--ease);
}
.theme-toggle:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-soft);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-5) 0;
  color: var(--color-text-muted);
  font-size: .875rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.footer-links {
  display: flex;
  gap: var(--space-3);
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-links a {
  color: var(--color-text-muted);
  font-weight: 500;
}
.footer-links a:hover { color: var(--color-primary); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: .65rem 1.35rem;
  border-radius: var(--radius);
  font-size: .925rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--duration) var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm), 0 0 0 0 rgba(99,102,241,0);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow), 0 0 16px rgba(99,102,241,.2);
  color: #fff;
}

.btn-secondary {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border: 1px solid transparent;
}
.btn-secondary:hover {
  border-color: var(--color-primary);
  background: rgba(99,102,241,.12);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

.btn-icon {
  padding: .55rem;
  min-width: 38px;
  justify-content: center;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: var(--space-6) 0;
}
.hero h1 {
  margin-bottom: var(--space-2);
}
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 52ch;
  margin: 0 auto var(--space-4);
}
.hero-ctas {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Cards ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--duration-slow) var(--ease);
  box-shadow: var(--shadow-sm);
}
.card:hover {
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--color-primary);
  transform: translateY(-3px);
}
.card-icon {
  width: 48px;
  height: 48px;
  background: var(--color-primary-soft);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
  color: var(--color-primary);
  font-size: 1.25rem;
}
.card h3 {
  margin-bottom: var(--space-1);
}
.card p {
  color: var(--color-text-muted);
  font-size: .925rem;
}

/* ---------- Tool Cards Grid ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-3);
}

/* ---------- Feature Grid ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
}
.feature-item {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
.feature-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--color-primary-soft);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: .95rem;
}
.feature-item h3 {
  font-size: 1rem;
  margin-bottom: .2rem;
}
.feature-item p {
  font-size: .875rem;
  color: var(--color-text-muted);
}

/* ---------- Steps ---------- */
.steps-list {
  display: flex;
  gap: var(--space-4);
  list-style: none;
  padding: 0;
  counter-reset: steps;
}
.steps-list li {
  flex: 1;
  counter-increment: steps;
  position: relative;
  padding-left: 3rem;
}
.steps-list li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: .925rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.steps-list h3 {
  font-size: 1rem;
  margin-bottom: .2rem;
}
.steps-list p {
  font-size: .875rem;
  color: var(--color-text-muted);
}

/* ---------- Section ---------- */
.section {
  padding: var(--space-6) 0;
}
.section-header {
  margin-bottom: var(--space-4);
}
.section-header h2 {
  margin-bottom: var(--space-1);
}
.section-header p {
  color: var(--color-text-muted);
}

/* ---------- FAQ ---------- */
.faq-list {
  max-width: 740px;
}
.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) 0;
}
.faq-item h3 {
  font-size: 1.05rem;
  margin-bottom: var(--space-1);
  color: var(--color-text);
}
.faq-item p {
  color: var(--color-text-muted);
  font-size: .925rem;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .75rem;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-success {
  background: rgba(16,185,129,.1);
  color: #059669;
}
[data-theme="dark"] .badge-success {
  color: #34d399;
}

/* ---------- Two-Panel Editor ---------- */
.editor-shell {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.editor-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 420px;
}

.editor-panel {
  display: flex;
  flex-direction: column;
}
.editor-panel + .editor-panel {
  border-left: 1px solid var(--color-border);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-elevated);
  min-height: 44px;
}
.panel-label {
  font-size: .825rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
}

.panel-tabs {
  display: flex;
  gap: 2px;
  background: var(--color-code-bg);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.panel-tab {
  padding: .3rem .8rem;
  border-radius: 4px;
  font-size: .8rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-family: inherit;
}
.panel-tab[aria-selected="true"],
.panel-tab.active {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.editor-textarea {
  flex: 1;
  width: 100%;
  border: none;
  resize: none;
  padding: var(--space-2);
  font-family: var(--font-mono);
  font-size: .9rem;
  line-height: 1.6;
  background: transparent;
  color: var(--color-text);
  outline: none;
  min-height: 380px;
}
.editor-textarea::placeholder {
  color: var(--color-text-muted);
  opacity: .6;
}

.output-area {
  flex: 1;
  padding: var(--space-2);
  font-family: var(--font-mono);
  font-size: .9rem;
  line-height: 1.6;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text);
  min-height: 380px;
}

.preview-frame {
  flex: 1;
  width: 100%;
  border: none;
  min-height: 380px;
  background: var(--color-bg);
}

/* ---------- Toolbar ---------- */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-2);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-elevated);
  flex-wrap: wrap;
  gap: var(--space-1);
}
.toolbar-stats {
  font-size: .8rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.toolbar-actions {
  display: flex;
  gap: var(--space-1);
}

/* ---------- Toast notification ---------- */
.toast {
  position: fixed;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--color-text);
  color: var(--color-bg);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transition: all var(--duration-slow) var(--ease);
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---------- Content sections (tool pages) ---------- */
.content-section {
  padding: var(--space-5) 0;
  border-top: 1px solid var(--color-border);
}
.content-section h2 {
  margin-bottom: var(--space-2);
}
.content-section p,
.content-section li {
  color: var(--color-text-muted);
  font-size: .925rem;
  line-height: 1.75;
}
.content-section p + p {
  margin-top: var(--space-2);
}
.content-section ol,
.content-section ul {
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
}
.content-section li + li {
  margin-top: var(--space-1);
}

/* ---------- Syntax table ---------- */
.syntax-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  margin-top: var(--space-2);
}
.syntax-table th,
.syntax-table td {
  text-align: left;
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.syntax-table th {
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface-elevated);
}
.syntax-table td {
  color: var(--color-text-muted);
}
.syntax-table code {
  background: var(--color-code-bg);
  padding: .15em .4em;
  border-radius: 4px;
  font-size: .85em;
}

/* ---------- Privacy callout ---------- */
.privacy-callout {
  background: var(--color-primary-soft);
  border-left: 3px solid var(--color-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: var(--space-2);
}
.privacy-callout p {
  color: var(--color-text);
  font-size: .925rem;
}

/* ---------- Related tool CTA ---------- */
.related-tool {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  transition: all var(--duration-slow) var(--ease);
}
.related-tool:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
}
