/* iKnowhy — monochrome, premium */
:root {
  --bg: #0A0A0A;
  --surface: #111111;
  --surface-hover: #1A1A1A;
  --border: #222222;
  --text: #FFFFFF;
  --muted: #888888;
  --accent: #FFFFFF;
  --btn-primary-bg: #FFFFFF;
  --btn-primary-text: #0A0A0A;
  --btn-outline-border: #FFFFFF;
  --btn-outline-text: #FFFFFF;
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", "Consolas", monospace;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

html.light {
  --bg: #FFFFFF;
  --surface: #F5F5F5;
  --surface-hover: #EBEBEB;
  --border: #E0E0E0;
  --text: #0A0A0A;
  --muted: #666666;
  --accent: #0A0A0A;
  --btn-primary-bg: #0A0A0A;
  --btn-primary-text: #FFFFFF;
  --btn-outline-border: #0A0A0A;
  --btn-outline-text: #0A0A0A;
}

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

html { font-size: 16px; }

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

/* Navigation */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo-img {
    height: 28px;
    width: auto;
    object-fit: contain;
  }

/* Theme-aware logo/icon visibility */
.logo-light { display: none !important; }
.logo-dark { display: inline-block !important; }
html.light .logo-light { display: inline-block !important; }
html.light .logo-dark { display: none !important; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.15rem;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}
.theme-toggle:hover { color: var(--text); }

.nav-links { display: flex; gap: 1.5rem; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

/* Main content */
main {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
}

.hero-logo {
    height: 48px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin-bottom: 2rem;
  }

.hero h1 {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.highlight {
  color: var(--accent);
}

.subtitle {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 650px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.cta-row { display: flex; gap: 1rem; justify-content: center; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}
.btn-primary:hover {
  opacity: 0.85;
}

.btn-secondary {
  background: transparent;
  color: var(--btn-outline-text);
  border: 1px solid var(--btn-outline-border);
}
.btn-secondary:hover {
  background: var(--surface);
}

/* Features */
.features { padding: 3rem 0; }
.features h2 {
  text-align: center;
  font-size: 1.75rem;
  color: var(--text);
  margin-bottom: 2rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--muted); }

.feature-card h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

.feature-card code {
  font-family: var(--font-mono);
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85rem;
  color: var(--text);
}

/* Pricing */
.pricing { padding: 3rem 0; }
.pricing h2 {
  text-align: center;
  font-size: 1.75rem;
  color: var(--text);
  margin-bottom: 2rem;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
}
.price-card.featured {
  border-color: var(--text);
  border-width: 2px;
}

.price-card h3 {
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.price {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.5rem;
}
.price span {
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
}

.price-card ul {
  list-style: none;
  margin-bottom: 1.5rem;
  text-align: left;
}

.price-card li {
  padding: 0.4rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.price-card li:last-child { border-bottom: none; }
.price-card li::before {
  content: "✓ ";
  color: var(--text);
}

/* Dashboard */
.dashboard { padding: 1rem 0; }
.dashboard h1 {
  font-size: 1.75rem;
  color: var(--text);
  margin-bottom: 1.5rem;
}
.dashboard h2 {
  font-size: 1.25rem;
  color: var(--text);
  margin: 1.5rem 0 1rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Tables */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

tbody tr:hover { background: var(--surface-hover); }

td code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
}

td.empty {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
}

/* Hint box */
.hint {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.hint code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  word-break: break-all;
}

.refresh-note {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.6;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
  main { padding: 1rem; }
  .hero h1 { font-size: 1.75rem; }
  .topbar { padding: 0.75rem 1rem; }
  .stats-row { grid-template-columns: 1fr; }
}

/* Auth pages */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 3rem 0;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2.5rem;
}

.auth-card h1 {
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.form-group input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--text);
}

.form-group input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.form-error {
  background: #3a1111;
  border: 1px solid #661a1a;
  color: #ff6b6b;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

html.light .form-error {
  background: #fff0f0;
  border-color: #ffc7c7;
  color: #cc0000;
}

.auth-submit {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem;
  font-size: 0.95rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-footer a {
  color: var(--text);
  text-decoration: underline;
}

/* Nav signup button */
.nav-signup {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text) !important;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-weight: 600;
}

.nav-signup:hover {
  opacity: 0.85;
}

/* Account page */
.account-page { padding: 1rem 0; }

.account-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.account-header h1 {
  font-size: 1.75rem;
  color: var(--text);
}

.plan-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.plan-free {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.plan-pro {
  background: var(--text);
  color: var(--bg);
}

.account-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child { border-bottom: none; }

.info-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.info-value {
  font-size: 0.85rem;
  color: var(--text);
  font-family: var(--font-mono);
}

.account-section {
  margin-bottom: 2rem;
}

.account-section h2 {
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 1rem;
}

.key-masked, .key-full {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.key-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-sm:hover {
  background: var(--surface-hover);
}

.empty-state {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1.5rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.upgrade-cta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}

.upgrade-cta p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.success-banner {
  background: #0a2a0a;
  border: 1px solid #1a4a1a;
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.success-banner p {
  color: #4ade80;
  font-size: 0.9rem;
}

html.light .success-banner {
  background: #f0fff0;
  border-color: #b8e6b8;
}

html.light .success-banner p {
  color: #166534;
}

.danger-zone {
  border: 1px solid #661a1a;
  border-radius: 8px;
  padding: 1.5rem;
}

html.light .danger-zone {
  border-color: #ffc7c7;
}

.danger-zone h2 {
  color: #ff6b6b;
}

html.light .danger-zone h2 {
  color: #cc0000;
}

.danger-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.danger-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.danger-item strong {
  font-size: 0.9rem;
  color: var(--text);
}

.danger-item p {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.btn-danger {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid #661a1a;
  border-radius: 6px;
  color: #ff6b6b;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-danger:hover {
  background: #3a1111;
}

html.light .btn-danger {
  border-color: #ffc7c7;
  color: #cc0000;
}

html.light .btn-danger:hover {
  background: #fff0f0;
}

/* Quickstart section */
.quickstart { max-width: 780px; margin: 0 auto 5rem; padding: 0 1.5rem; text-align: center; }
.code-block { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.5rem; overflow-x: auto; }
.code-block pre { margin: 0; }
.code-block code { font-family: var(--font-mono, 'Courier New', monospace); font-size: 0.82rem; line-height: 1.7; color: var(--text); white-space: pre; }


.btn-danger-sm {
  background: transparent;
  color: #ef4444;
  border: 1px solid #ef4444;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}
.btn-danger-sm:hover { background: #ef4444; color: #fff; }
