/* ============================================================
   ToolHaven — Premium CSS Design System
   ============================================================ */

/* ---- TOKENS ---- */
:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a24;
  --surface: #16161f;
  --surface2: #1e1e2a;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #e8e8f0;
  --text2: #9898b0;
  --text3: #606078;
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --accent-glow: rgba(99,102,241,0.25);
  --success: #10b981;
  --danger: #f43f5e;
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
  --font: 'Inter', system-ui, sans-serif;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="light"] {
  --bg: #f4f4f8;
  --bg2: #ffffff;
  --bg3: #eeeef4;
  --surface: #ffffff;
  --surface2: #f0f0f6;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.14);
  --text: #111118;
  --text2: #555568;
  --accent-glow: rgba(99,102,241,0.12);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.12);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }
input, select, textarea, button { font-family: var(--font); }

/* ---- LAYOUT ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- HEADER ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(10,10,15,0.8);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .header {
  background: rgba(244,244,248,0.85);
}
.nav {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo-icon { font-size: 1.4rem; }
.nav-links {
  display: flex;
  gap: 24px;
  flex: 1;
}
.nav-links a {
  color: var(--text2);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--text); }
.theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
  margin-left: auto;
}
.theme-toggle:hover { background: var(--surface); transform: rotate(20deg); }

/* ---- HERO ---- */
.hero {
  position: relative;
  padding: 100px 20px 80px;
  text-align: center;
  overflow: hidden;
}
.hero-content { position: relative; z-index: 2; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-glow);
  border: 1px solid rgba(99,102,241,0.3);
  color: #a5b4fc;
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 24px;
  animation: fadeInDown 0.6s ease;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 20px;
  animation: fadeInUp 0.7s ease;
}
.gradient-text {
  background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text2);
  max-width: 500px;
  margin: 0 auto 36px;
  animation: fadeInUp 0.8s ease;
}

/* SEARCH */
.search-bar {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  animation: fadeInUp 0.9s ease;
}
.search-bar input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 100px;
  padding: 16px 24px 16px 50px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  pointer-events: none;
}
.search-bar input::placeholder { color: var(--text2); }

/* ORBS */
.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
  animation: pulse 6s ease-in-out infinite alternate;
}
.orb1 { width: 500px; height: 500px; background: #6366f1; top: -200px; left: -100px; }
.orb2 { width: 400px; height: 400px; background: #a855f7; top: -100px; right: -100px; animation-delay: -2s; }
.orb3 { width: 300px; height: 300px; background: #ec4899; bottom: -100px; left: 50%; animation-delay: -4s; }

/* ---- AD SLOT ---- */
.ad-slot {
  min-height: 0;
  margin: 24px 0;
  text-align: center;
  overflow: hidden;
}
/* Only show placeholder in dev — remove this block before going live */
.ad-slot:empty { display: none; }

/* ---- MAIN CONTENT ---- */
.main-content { padding: 20px 0 60px; }

/* ---- SECTIONS ---- */
.tool-section { margin-bottom: 60px; }
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-icon { font-size: 1.4rem; }

/* ---- TOOLS GRID ---- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* ---- TOOL CARD ---- */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tool-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.tool-card--wide {
  grid-column: span 2;
}
@media (max-width: 768px) { .tool-card--wide { grid-column: span 1; } }

.tool-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.tool-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.tool-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.tool-header p {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.4;
}
.tool-body { display: flex; flex-direction: column; gap: 12px; }

/* ---- INPUTS ---- */
.input-group { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.input-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text2);
}
.input-row { display: flex; gap: 12px; }
input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="email"],
select,
textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg3);
  border-radius: 100px;
  height: 6px;
  padding: 0;
  border: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(99,102,241,0.4);
}
textarea { resize: vertical; min-height: 100px; }
select option { background: var(--bg2); color: var(--text); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.5);
}
.btn-ghost {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-sm { padding: 7px 13px; font-size: 0.8rem; border-radius: 8px; }
.btn-group { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- RESULT BOX ---- */
.result-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  display: none;
  animation: fadeIn 0.3s ease;
}
.result-box.show { display: block; }
.result-box.copyable { cursor: pointer; }
.result-box.copyable:hover { border-color: var(--accent); }
.result-box.copyable::after {
  content: "Click to copy";
  display: block;
  font-size: 0.7rem;
  color: var(--text2);
  margin-top: 8px;
}
.result-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
  margin-bottom: 6px;
}
.result-label { color: var(--text2); font-size: 0.82rem; }
.result-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.result-row strong { color: var(--text); }

/* BMI meter */
.bmi-bar { height: 8px; border-radius: 100px; margin: 8px 0 4px; position: relative; overflow: hidden; }
.bmi-bar-track { height: 100%; border-radius: 100px; background: linear-gradient(90deg, #10b981 0%, #f59e0b 50%, #f43f5e 100%); }
.bmi-marker {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #6366f1;
  transform: translateX(-50%);
  transition: left 0.5s ease;
}

/* ---- QR ---- */
.qr-result { text-align: center; padding: 12px 0; display: none; }
.qr-result.show { display: block; }
.qr-result img { border-radius: 8px; max-width: 100%; }

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-box span {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-box small { font-size: 0.72rem; color: var(--text2); }

/* ---- CHECKBOX GRID ---- */
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text2);
  cursor: pointer;
}
.checkbox-label input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---- DIFF ---- */
.diff-line { padding: 2px 8px; border-radius: 4px; }
.diff-add { background: rgba(16,185,129,0.15); color: #34d399; }
.diff-del { background: rgba(244,63,94,0.15); color: #fb7185; }
.diff-same { color: var(--text2); }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--success);
  color: #fff;
  padding: 12px 24px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 999;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---- FOOTER ---- */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 60px 0 0;
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 40px;
}
.footer-brand { display: flex; flex-direction: column; gap: 10px; }
.footer-brand p { color: var(--text2); font-size: 0.85rem; max-width: 260px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links h4 { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.footer-links a { color: var(--text2); font-size: 0.85rem; transition: color var(--transition); }
.footer-links a:hover { color: var(--text); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text2);
}

/* ---- SEARCH HIDDEN ---- */
.tool-card.hidden { display: none; }

/* ---- ANIMATIONS ---- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { from { transform: scale(1); opacity: 0.12; } to { transform: scale(1.08); opacity: 0.18; } }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 100px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: span 2; }
}
@media (max-width: 600px) {
  .tools-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-brand { grid-column: span 1; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .input-row { flex-direction: column; }
}

/* ---- PRINT STYLES ---- */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .header, .footer, .ad-slot, .theme-toggle, .btn, .hero-orb, .cookie-banner { display: none !important; }
  .tool-card { border: 1px solid #ccc !important; box-shadow: none !important; background: #fff !important; color: #000 !important; }
  .result-box { background: #f8f9fa !important; border: 1px solid #ddd !important; color: #000 !important; }
}

/* ---- COOKIE & ADSENSE CONSENT BANNER ---- */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  font-size: 0.85rem;
  color: var(--text2);
  backdrop-filter: blur(12px);
  animation: fadeInUp 0.4s ease forwards;
}
.cookie-banner p { margin-bottom: 12px; line-height: 1.5; }
.cookie-banner a { color: var(--accent); text-decoration: underline; }
.cookie-buttons { display: flex; gap: 8px; justify-content: flex-end; }

/* ---- AD CONTAINER ENHANCEMENT ---- */
/* ---- AD CONTAINER & CLS PREVENTION ---- */
.ad-slot {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: var(--surface2);
  border: 1px dashed var(--border);
  transition: all 0.3s ease;
}
.ad-slot ins.adsbygoogle {
  display: block;
  width: 100%;
}
.ad-slot-pending::after {
  content: '⚡ Sponsor Advertisement Area';
  font-size: 0.75rem;
  color: var(--text2);
  opacity: 0.5;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Sticky Bottom Mobile Anchor Ad Unit */
.sticky-ad-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
  margin: 0;
  min-height: 50px;
  max-height: 70px;
  border-radius: 0;
}

/* ---- PRESET PILL BUTTONS ---- */
.preset-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
}
.preset-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.preset-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.preset-pill:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---- SEO LOOKUP TABLES & GUIDES ---- */
.seo-guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 28px 0;
}
.seo-guide-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.seo-guide-card p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text2);
  margin-bottom: 16px;
}
.seo-table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
}
.seo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.seo-table th {
  background: var(--surface2);
  color: var(--text);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.seo-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}
.seo-table tr:last-child td {
  border-bottom: none;
}

/* ---- FAQ SECTION ---- */
.faq-section {
  margin: 36px 0;
}
.faq-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
}
.faq-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.faq-item p {
  font-size: 0.86rem;
  color: var(--text2);
  line-height: 1.55;
  margin: 0;
}




