/* ==========================================================================
   1. VARIABLES & CORE STYLES
   ========================================================================== */
:root {
  --primary: #635bff;
  --primary-dark: #5148e5;
  --primary-light: rgba(99, 91, 255, 0.1);
  --text: #101828;
  --muted: #667085;
  --background: #f7f8fc;
  --card: rgba(255, 255, 255, 0.85);
  --border: rgba(16, 24, 40, 0.08);
  --white: #ffffff;
  
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 8px;
  
  --shadow-sm: 0 2px 4px rgba(16, 24, 40, 0.02);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, 0.05);
  --shadow-hover: 0 20px 40px rgba(99, 91, 255, 0.15);
}

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

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

body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--background);
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.container {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 0 16px;
}

/* Background Animated Blobs */
body::before,
body::after {
  content: "";
  position: fixed;
  width: 450px;
  height: 450px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  z-index: -1;
  animation: float 10s ease-in-out infinite;
}

body::before {
  background: #8b5cf6;
  top: -180px;
  left: -120px;
}

body::after {
  background: #635bff;
  bottom: -220px;
  right: -100px;
  animation-delay: -4s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -30px); }
}

/* ==========================================================================
   2. HEADER & NAVIGATION
   ========================================================================== */
.site-nav {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(247, 248, 252, 0.85);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

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

.brand-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
}

/* ==========================================================================
   3. HERO SECTION
   ========================================================================== */
.page-header {
  text-align: center;
  padding: 50px 0 20px;
}

.eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
  border: 1px solid rgba(99, 91, 255, 0.2);
}

.page-header h1 {
  font-size: clamp(28px, 6vw, 48px);
  font-weight: 850;
  letter-spacing: -1px;
  margin-bottom: 14px;
  line-height: 1.15;
}

.page-header p {
  max-width: 640px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(15px, 1.8vw, 18px);
}

/* ==========================================================================
   4. CALCULATOR CARDS & GRID
   ========================================================================== */
.calculator-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding: 24px 0 40px;
  align-items: stretch;
}

.calculator-card {
  position: relative;
  width: 100%;
  min-height: 190px;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 249, 255, 0.96));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm), var(--shadow-md);
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.calculator-icon {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border-radius: 15px;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  font-size: 25px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 6px 15px rgba(79, 70, 229, 0.08);
  transition: transform 0.25s ease;
}

.calculator-card h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
}

.calculator-card p {
  max-width: 210px;
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

/* Active State */
.calculator-card.active {
  cursor: pointer;
  color: inherit;
}

.calculator-card.active:hover {
  transform: translateY(-5px);
  border-color: rgba(99, 91, 255, 0.25);
  box-shadow: var(--shadow-hover);
}

.calculator-card.active:hover .calculator-icon {
  transform: translateY(-2px) scale(1.06);
  background: var(--primary);
  color: var(--white);
}

/* Locked State */
.calculator-card.locked {
  cursor: default;
}

.calculator-card.locked > *:not(.lock-badge):not(.lock-icon) {
  opacity: 0.45;
}

.calculator-card.locked::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 252, 0.28);
  pointer-events: none;
}

.lock-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 10;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 3px 10px rgba(16, 24, 40, 0.05);
}

.lock-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 25px rgba(16, 24, 40, 0.12);
  z-index: 5;
}

/* ==========================================================================
   5. ADVERTISERS & ADSENSE CONTAINERS
   ========================================================================== */
.ad-wrapper {
  margin: 20px auto;
  text-align: center;
}

.ad-slot {
  min-height: 90px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.ad-disclosure {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   6. SEO CONTENT & FAQ SECTIONS
   ========================================================================== */
.seo-content,
.faq {
  max-width: 760px;
  margin: 40px auto;
}

.seo-content h2,
.faq h2 {
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
}

.seo-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 24px 0 8px;
  color: var(--text);
}

.seo-content p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 14px;
}

/* FAQ Styling */
.faq details {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  padding: 16px 20px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.faq details[open] {
  border-color: rgba(99, 91, 255, 0.3);
  box-shadow: 0 10px 25px rgba(99, 91, 255, 0.08);
}

.faq summary {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font-size: 20px;
  transition: transform 0.3s ease;
}

.faq details[open] summary::after {
  content: "−";
}

.faq details p {
  color: var(--text);
  font-size: 14px;
  margin-top: 10px;
  line-height: 1.6;
}

/* ==========================================================================
   7. FOOTER
   ========================================================================== */
footer {
  margin-top: 60px;
  padding: 40px 20px;
  background: linear-gradient(135deg, rgba(99, 91, 255, 0.08), rgba(139, 92, 246, 0.08));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  position: relative;
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  border-radius: 2px;
  background: var(--primary);
  opacity: 0.6;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.footer-links a {
  color: var(--muted);
}

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

/* ==========================================================================
   8. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 900px) {
  .calculator-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (max-width: 520px) {
  body {
    padding: 0;
  }
  
  .calculator-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .calculator-card {
    min-height: 165px;
    padding: 24px 18px;
  }

  .nav-inner {
    flex-direction: column;
    gap: 10px;
  }

  .form {
    flex-direction: column;
  }
}

/* ==========================================================================
   CATEGORY FILTER BAR STYLES (Fixed layout and centering)
   ========================================================================== */
.category-filter-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
  width: 100%;
}

.category-filter-bar .preset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.category-filter-bar .preset-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.category-filter-bar .preset-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 91, 255, 0.25);
}

/* Mobile Responsive Adjustments for Category Buttons */
@media (max-width: 768px) {
  .category-filter-bar {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .category-filter-bar::-webkit-scrollbar {
    height: 4px;
  }

  .category-filter-bar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
  }

  .category-filter-bar .preset-btn {
    padding: 8px 14px;
    font-size: 13px;
    flex-shrink: 0;
  }
}

/* Ensure proper centering for card content without blocking script filtering */
.calculator-card {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.calculator-card .calculator-icon {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 16px;
}

.calculator-card.locked .lock-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}