@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

/* ===== DARK THEME (DEFAULT) ===== */
:root {
  --bg-primary: #0b0f0c;
  --bg-secondary: #0e1310;
  --bg-card: #111713;
  --bg-card-hover: #161e18;
  --bg-input: #111713;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --green: #16a34a;
  --green-hover: #15803d;
  --green-light: #4ade80;
  --green-dark: #14532d;
  --green-glow: rgba(22, 163, 74, 0.12);
  --success: #16a34a;
  --error: #ef4444;
  --warning: #f59e0b;
  --border: #1f2a22;
  --border-hover: #2a3b2e;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.3);
  --transition: 0.15s ease;
  --max-width: 960px;
  --navbar-bg: rgba(11, 15, 12, 0.9);
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-card: #f3f4f6;
  --bg-card-hover: #e5e7eb;
  --bg-input: #f3f4f6;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --green: #16a34a;
  --green-hover: #15803d;
  --green-light: #22c55e;
  --green-dark: #14532d;
  --green-glow: rgba(22, 163, 74, 0.08);
  --border: #e5e7eb;
  --border-hover: #d1d5db;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
  --navbar-bg: rgba(255, 255, 255, 0.9);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

a {
  color: var(--green);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--green-hover); }
a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

/* ===== NAVBAR ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 1rem;
}

.navbar-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}

.navbar-logo .logo-icon {
  color: var(--green);
  font-size: 1.125rem;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-extract-form {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 32px;
  overflow: hidden;
  transition: border-color var(--transition);
}

.nav-extract-form:focus-within {
  border-color: var(--green);
}

.nav-extract-form input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0 0.5rem 0 0.75rem;
  font-size: 0.8125rem;
  width: 90px;
  outline: none;
}

.nav-extract-form input::placeholder {
  color: var(--text-secondary);
}

.nav-extract-form button {
  background: var(--green);
  color: #fff;
  border: none;
  height: 100%;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}

.nav-extract-form button:hover {
  background: var(--green-hover);
}

.navbar-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}

.navbar-links a {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color var(--transition);
  position: relative;
}

.navbar-links a:hover {
  color: var(--text-primary);
}

.navbar-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--green);
  transition: width var(--transition);
}

.navbar-links a:hover::after { width: 100%; }

/* ===== DROPDOWN ===== */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0;
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-menu li {
  list-style: none;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-dropdown-menu a::after {
  display: none; /* No underline on dropdown items */
}

.nav-dropdown-menu a:hover {
  background: var(--bg-card-hover);
  color: var(--green);
}

/* ===== CONTAINER ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 3rem 1.25rem 1.5rem;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.hero p {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ===== FORM SECTION ===== */
.form-section {
  padding: 1.5rem 1.25rem 3rem;
}

.form-card {
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.form-card label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-card textarea {
  width: 100%;
  min-height: 160px;
  padding: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, monospace;
  font-size: 0.875rem;
  resize: vertical;
  transition: border-color var(--transition);
  line-height: 1.6;
}

.form-card textarea:focus {
  outline: none;
  border-color: var(--green);
}

.form-card textarea::placeholder {
  color: var(--text-muted);
}

.form-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
  align-items: flex-end;
}

.form-group { flex: 1; }

.form-card select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.875rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color var(--transition);
}

.form-card select:focus {
  outline: none;
  border-color: var(--green);
}

.char-count {
  text-align: right;
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.char-count.warning { color: var(--warning); }
.char-count.error { color: var(--error); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--green);
  color: #fff;
}

.btn-primary:hover {
  background: var(--green-hover);
}

.btn-primary:active { transform: scale(0.98); }

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.btn-full { width: 100%; }

/* ===== RESULT ===== */
.result-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: none;
}

.result-box.show { display: block; }
.result-box.success { border-color: var(--green); }
.result-box.error { border-color: var(--error); }

.result-url {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.result-url input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--green);
  font-family: 'Inter', monospace;
  font-size: 0.8125rem;
  outline: none;
}

.result-url .btn { flex-shrink: 0; padding: 0.5rem 0.85rem; font-size: 0.8125rem; }

.result-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.result-expiry {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.error-message {
  color: var(--error);
  font-size: 0.8125rem;
  font-weight: 500;
}

/* ===== FEATURES ===== */
.features {
  padding: 3rem 1.25rem;
  border-top: 1px solid var(--border);
}

.section-header {
  text-align: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.feature-card {
  text-align: center;
  padding: 1.25rem 1rem;
}

.feature-icon {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--green);
}

.feature-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.feature-card p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===== FAQ ===== */
.faq {
  padding: 3rem 1.25rem;
  border-top: 1px solid var(--border);
}

.faq-list {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-item:first-child {
  border-top: 1px solid var(--border);
}

.faq-question {
  width: 100%;
  padding: 1rem 0;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: color var(--transition);
}

.faq-question:hover { color: var(--green); }

.faq-question:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.faq-item.open .faq-question { color: var(--green); }

.faq-chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  color: var(--text-muted);
}

.faq-item.open .faq-chevron { transform: rotate(180deg); color: var(--green); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.faq-item.open .faq-answer {
  max-height: 400px;
}

.faq-answer-inner {
  padding: 0 0 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ===== SEO CONTENT ===== */
.seo-content {
  padding: 3rem 1.25rem;
  border-top: 1px solid var(--border);
}

.seo-content-inner {
  max-width: 800px;
  margin: 0 auto;
}

.seo-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.seo-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--text-primary);
}

.seo-content p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.seo-content ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.seo-content li {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  line-height: 1.7;
}

/* ===== PASTE VIEW ===== */
.view-container {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

.view-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.view-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.view-code-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.view-code-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--green);
  font-family: 'Inter', monospace;
}

.view-expiry {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.view-expiry .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}

.view-actions {
  display: flex;
  gap: 0.4rem;
}

.view-body {
  padding: 1.25rem;
}

.view-body pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 70vh;
  overflow-y: auto;
}

/* Loading & Error */
.loading-state, .error-state {
  text-align: center;
  padding: 4rem 1.25rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-state p { color: var(--text-secondary); font-size: 0.875rem; }

.error-state h2 {
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
  color: var(--error);
}

.error-state p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* ===== FOOTER ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.25rem;
  margin-top: 2rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-brand {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: color var(--transition);
}

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

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== TOOL PAGES ===== */
.tool-hero {
  text-align: center;
  padding: 2.5rem 1.25rem 1.5rem;
}

.tool-hero h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.tool-hero p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.tool-card {
  max-width: 640px;
  margin: 0 auto 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.tool-card textarea,
.tool-card input[type="text"],
.tool-card input[type="number"] {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Inter', monospace;
  font-size: 0.875rem;
  resize: vertical;
  transition: border-color var(--transition);
  line-height: 1.6;
}

.tool-card textarea:focus,
.tool-card input:focus {
  outline: none;
  border-color: var(--green);
}

.tool-output {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Courier New', monospace;
  font-size: 0.8125rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 48px;
  max-height: 400px;
  overflow-y: auto;
}

/* ===== LEGAL PAGES ===== */
.legal-page {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1.25rem 2rem;
}

.legal-page h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.legal-page .last-updated {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.legal-page h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.legal-page p, .legal-page li {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.legal-page ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .navbar-links { display: none; }
  .hero { padding: 2.5rem 1rem 1rem; }
  .hero h1 { font-size: 1.75rem; }
  .form-card { padding: 1rem; }
  .form-row { flex-direction: column; }
  .features-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .footer-inner { flex-direction: column; text-align: center; }
  .view-header { flex-direction: column; align-items: flex-start; }
  .view-actions { width: 100%; }
  .view-actions .btn { flex: 1; }
  .result-url { flex-direction: column; }
  .result-url input { width: 100%; }
  .result-url .btn { width: 100%; }
}

@media (min-width: 641px) and (max-width: 900px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  .navbar, .footer, .btn, .theme-toggle { display: none; }
  body { background: #fff; color: #000; }
}
