:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #131c31;
  --bg-card: rgba(23, 34, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --glow-cyan: rgba(6, 182, 212, 0.25);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --border-color: rgba(0, 0, 0, 0.08);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --glow-cyan: rgba(6, 182, 212, 0.15);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(59, 130, 246, 0.06) 0%, transparent 40%);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Nav */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(10, 15, 29, 0.8);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

[data-theme="light"] header {
  background: rgba(248, 250, 252, 0.85);
}

.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--glow-cyan);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-coffee {
  background: #ffdd00;
  color: #000000;
  font-weight: 700;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
  box-shadow: 0 2px 10px rgba(255, 221, 0, 0.25);
}

.btn-coffee:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 221, 0, 0.4);
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--accent-cyan), #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 680px;
  margin: 0 auto 2.5rem;
}

/* Search & Filters */
.search-box-wrapper {
  max-width: 580px;
  margin: 0 auto 2rem;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.95rem 1.25rem 0.95rem 3rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--glow-cyan);
}

.search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 3rem;
}

.chip {
  padding: 0.45rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.chip:hover, .chip.active {
  background: var(--accent-cyan);
  color: #000000;
  font-weight: 600;
  border-color: var(--accent-cyan);
}

/* Featured Live Interactive Calculator */
.featured-calculator {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  backdrop-filter: blur(16px);
  margin-bottom: 3.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.calc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 768px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
}

.input-group {
  margin-bottom: 1.25rem;
}

.input-label-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.input-control-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.num-input {
  flex: 1;
  padding: 0.65rem 0.9rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 600;
}

.range-slider {
  flex: 2;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

/* Results Display Box */
.result-card {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(59, 130, 246, 0.04));
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.result-metric {
  margin-bottom: 1rem;
}

.result-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  font-weight: 700;
}

.result-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  margin-top: 0.2rem;
}

/* Calculator Directory Cards Grid */
.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 4rem;
}

.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.calc-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-cyan);
  box-shadow: 0 10px 25px var(--glow-cyan);
}

.calc-card-cat {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.calc-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.calc-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex: 1;
  margin-bottom: 1rem;
}

.calc-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Affiliate & Monetization Banner */
.affiliate-section {
  background: linear-gradient(135deg, rgba(19, 28, 49, 0.9), rgba(10, 15, 29, 0.95));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
  justify-content: space-between;
}

.affiliate-content h4 {
  font-size: 1.25rem;
  color: var(--accent-amber);
  margin-bottom: 0.4rem;
}

.affiliate-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 600px;
}

.btn-affiliate {
  background: linear-gradient(135deg, var(--accent-amber), #ea580c);
  color: #000;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: var(--transition);
}

.btn-affiliate:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.35);
}

/* Footer */
footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 2.5rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

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

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