/* ============================================
   Smart Web Tools Calculators - Main Stylesheet
   calc.smartwts.com
   ============================================ */

:root {
  --primary: #1a56db;
  --primary-dark: #1341b0;
  --primary-light: #e8f0fe;
  --secondary: #0e9f6e;
  --accent: #f59e0b;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --bg-white: #ffffff;
  --bg-light: #f9fafb;
  --bg-lighter: #f3f4f6;
  --border: #e5e7eb;
  --border-light: #f0f1f3;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.07);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: all 0.2s ease;
  --max-width: 1200px;
  --header-height: 64px;
}

[data-theme="dark"] {
  --primary: #4b83f0;
  --primary-dark: #3a6fd9;
  --primary-light: #1e3a6e;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --bg-white: #1e2332;
  --bg-light: #151b2d;
  --bg-lighter: #1a2035;
  --border: #2e3650;
  --border-light: #252d45;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);
}

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

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

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

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* ========================
   TYPOGRAPHY
   ======================== */

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  line-height: 1.3;
  font-weight: 700;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.15rem; }

p { margin-bottom: 0.75rem; color: var(--text-secondary); }
p:last-child { margin-bottom: 0; }

ul, ol { padding-left: 1.5rem; color: var(--text-secondary); }
li { margin-bottom: 0.35rem; }

/* ========================
   LAYOUT
   ======================== */

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

.main-content {
  flex: 1;
  padding-top: var(--header-height);
}

.page-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.four-col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

/* ========================
   HEADER & NAVIGATION
   ======================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-logo img {
  height: 38px;
  width: auto;
}

.header-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
  background: var(--bg-light);
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}

.header-search input:focus {
  border-color: var(--primary);
  background: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}

.header-search .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.header-nav a {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  font-size: 1rem;
}

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

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
}

/* Mega Nav Menu */
.mega-nav {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.mega-nav::-webkit-scrollbar { display: none; }

.mega-nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.mega-nav a {
  padding: 0.6rem 0.85rem;
  font-size: 0.835rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

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

.mega-nav a i { font-size: 0.8rem; }

/* ========================
   SEARCH AUTOCOMPLETE
   ======================== */

.search-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
  display: none;
}

.autocomplete-dropdown.show { display: block; }

.autocomplete-section-title {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text-primary);
}

.autocomplete-item:hover, .autocomplete-item.selected {
  background: var(--primary-light);
  color: var(--primary);
}

.autocomplete-item-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
  color: var(--primary);
}

.autocomplete-item-text { flex: 1; }
.autocomplete-item-name { font-size: 0.875rem; font-weight: 500; }
.autocomplete-item-category { font-size: 0.75rem; color: var(--text-muted); }

/* ========================
   HERO SECTION
   ======================== */

.hero-section {
  background: linear-gradient(135deg, #1a56db 0%, #0e9f6e 100%);
  color: white;
  padding: 4rem 1.25rem 3.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  color: rgba(255,255,255,0.9);
}

.hero-section h1 {
  color: white;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.hero-section h1 span { color: #fde68a; }

.hero-section p {
  color: rgba(255,255,255,0.85);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  max-width: 580px;
  margin: 0 auto 2rem;
}

.hero-search {
  max-width: 620px;
  margin: 0 auto;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3.25rem;
  border: none;
  border-radius: var(--radius-xl);
  font-size: 1rem;
  background: white;
  color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  outline: none;
  transition: var(--transition);
}

.hero-search input:focus {
  box-shadow: 0 8px 32px rgba(0,0,0,0.2), 0 0 0 3px rgba(255,255,255,0.4);
}

.hero-search .search-icon {
  position: absolute;
  left: 1.15rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

.hero-search .search-btn {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.hero-search .search-btn:hover { background: var(--primary-dark); }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
  color: rgba(255,255,255,0.9);
}

.hero-stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  display: block;
}

.hero-stat-label {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* ========================
   SECTION STYLES
   ======================== */

.section {
  padding: 3rem 0;
}

.section-alt { background: var(--bg-white); }

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.section-meta { flex: 1; }

.view-all {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.view-all:hover { color: var(--primary-dark); }

/* ========================
   CARDS
   ======================== */

.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Category Cards */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.category-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.category-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  transform: translateY(-3px);
}

.category-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto 0.85rem;
}

.category-name {
  font-weight: 600;
  font-size: 0.925rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.category-count {
  font-size: 0.775rem;
  color: var(--text-muted);
}

/* Calculator Cards */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.calc-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.calc-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.calc-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.calc-card-body { flex: 1; }

.calc-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.calc-card-desc {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.calc-card-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
  align-self: center;
}

/* ========================
   CALCULATOR TOOL
   ======================== */

.calc-tool-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.calc-tool-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calc-tool-header-icon {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.calc-tool-header h2 {
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
}

.calc-tool-header p {
  color: rgba(255,255,255,0.8);
  font-size: 0.8rem;
  margin: 0;
}

.calc-tool-body { padding: 1.5rem; }

/* Form Elements */
.form-group {
  margin-bottom: 1.1rem;
}

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

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-white);
  transition: var(--transition);
  outline: none;
  font-family: var(--font-sans);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

.form-control.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.form-error {
  font-size: 0.775rem;
  color: #ef4444;
  margin-top: 0.3rem;
  display: none;
}

.form-error.show { display: block; }

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-addon {
  padding: 0 0.75rem;
  background: var(--bg-lighter);
  border: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
}

.input-addon-left {
  border-right: none;
  border-left: 1.5px solid var(--border);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group .form-control.with-left {
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Range Slider */
.range-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.range-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(26,86,219,0.3);
}

.range-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

.range-value {
  min-width: 70px;
  text-align: right;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

/* Segmented Control */
.segmented-control {
  display: flex;
  background: var(--bg-lighter);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.segmented-btn {
  flex: 1;
  padding: 0.4rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.segmented-btn.active {
  background: var(--bg-white);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26,86,219,0.3);
}

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

.btn-secondary:hover {
  background: var(--border);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

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

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1rem;
}

.btn-full { width: 100%; }

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Results */
.results-section {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8f5f0 100%);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: none;
}

[data-theme="dark"] .results-section {
  background: linear-gradient(135deg, #1e2a4a 0%, #1a2e27 100%);
}

.results-section.show { display: block; }

.result-main {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.result-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

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

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.result-item {
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
  border: 1px solid var(--border);
}

.result-item-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.result-item-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.result-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 0.75rem;
  background: var(--bg-white);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  margin-top: 0.75rem;
}

/* ========================
   BREADCRUMBS
   ======================== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
}

.breadcrumb a {
  color: var(--text-muted);
  font-weight: 500;
}

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

.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 0.65rem;
}

.breadcrumb span {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ========================
   TAGS / BADGES
   ======================== */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-lighter);
  color: var(--text-secondary);
}

.tag-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.tag-green {
  background: #d1fae5;
  color: #065f46;
}

.tag-orange {
  background: #fef3c7;
  color: #92400e;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ========================
   FAQ SECTION
   ======================== */

.faq-list { display: flex; flex-direction: column; gap: 0.75rem; }

.faq-item {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.925rem;
  color: var(--text-primary);
  gap: 1rem;
  user-select: none;
  transition: var(--transition);
}

.faq-question:hover { background: var(--bg-lighter); }

.faq-question i {
  color: var(--primary);
  font-size: 0.8rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.faq-item.open .faq-question i { transform: rotate(180deg); }

.faq-answer {
  padding: 0 1.25rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.2s ease;
}

.faq-item.open .faq-answer {
  padding: 0 1.25rem 1rem;
  max-height: 500px;
}

.faq-answer p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ========================
   FORMULA BOX
   ======================== */

.formula-box {
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1rem 0;
}

.formula-box code {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
  display: block;
  margin-bottom: 0.5rem;
}

.formula-box p {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ========================
   INFO BOXES
   ======================== */

.info-box {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin: 1rem 0;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.info-box i { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.info-box-content { flex: 1; }
.info-box-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; }
.info-box-text { font-size: 0.825rem; margin: 0; line-height: 1.5; }

.info-box-blue {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  color: var(--primary);
}

.info-box-blue p { color: #1e40af; }
.info-box-blue i { color: var(--primary); }

.info-box-green {
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.info-box-green p { color: #064e3b; }
.info-box-green i { color: #059669; }

.info-box-yellow {
  background: #fef3c7;
  border: 1px solid #fde68a;
}

.info-box-yellow p { color: #78350f; }
.info-box-yellow i { color: #d97706; }

/* ========================
   TABLES
   ======================== */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  background: var(--bg-lighter);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-lighter); }
.data-table tr.highlight td { background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* ========================
   TRUST / FEATURES SECTION
   ======================== */

.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.trust-card {
  text-align: center;
  padding: 1.5rem;
}

.trust-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
  background: var(--primary-light);
  color: var(--primary);
}

.trust-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.trust-card p {
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ========================
   FOOTER
   ======================== */

.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 3.5rem 0 1.5rem;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-brand img {
  height: 36px;
  margin-bottom: 0.75rem;
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.footer-brand p {
  font-size: 0.85rem;
  line-height: 1.65;
  color: #64748b;
  margin-bottom: 1rem;
}

.footer-social {
  display: flex;
  gap: 0.5rem;
}

.footer-social a {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 0.85rem;
  transition: var(--transition);
}

.footer-social a:hover {
  background: var(--primary);
  color: white;
}

.footer-col h4 {
  color: #e2e8f0;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  list-style: none;
  padding: 0;
}

.footer-links li { margin-bottom: 0.4rem; }

.footer-links a {
  font-size: 0.825rem;
  color: #64748b;
  transition: var(--transition);
}

.footer-links a:hover { color: #e2e8f0; }

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-copyright { font-size: 0.8rem; color: #475569; }

.footer-legal {
  display: flex;
  gap: 1.25rem;
}

.footer-legal a { font-size: 0.8rem; color: #475569; }
.footer-legal a:hover { color: #94a3b8; }

/* ========================
   AD PLACEHOLDERS
   ======================== */

.ad-placeholder {
  background: var(--bg-lighter);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  min-height: 90px;
}

.ad-placeholder-banner { min-height: 90px; }
.ad-placeholder-sidebar { min-height: 250px; }
.ad-placeholder-in-content { min-height: 280px; }

/* ========================
   CATEGORY PAGE HERO
   ======================== */

.category-hero {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.25rem;
}

.category-hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
}

.category-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.category-hero-body { flex: 1; }

.category-hero h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.category-hero p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0;
}

/* ========================
   SIDEBAR
   ======================== */

.sidebar { position: sticky; top: calc(var(--header-height) + 1rem); }

.sidebar-widget {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.sidebar-widget h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-links { list-style: none; padding: 0; }
.sidebar-links li { margin-bottom: 0.3rem; }
.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.35rem 0;
  transition: var(--transition);
}
.sidebar-links a:hover { color: var(--primary); }
.sidebar-links a i { font-size: 0.75rem; color: var(--text-muted); }

/* ========================
   MOBILE DRAWER
   ======================== */

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1500;
}

.mobile-overlay.show { display: block; }

.mobile-drawer {
  position: fixed;
  top: 0;
  left: -320px;
  width: 300px;
  height: 100vh;
  background: var(--bg-white);
  z-index: 1600;
  overflow-y: auto;
  transition: left 0.3s ease;
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
}

.mobile-drawer.open { left: 0; }

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

.mobile-nav-section { margin-bottom: 1.25rem; }

.mobile-nav-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.mobile-nav-links { list-style: none; padding: 0; }
.mobile-nav-links li { margin-bottom: 0.15rem; }
.mobile-nav-links a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.mobile-nav-links a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ========================
   SHARE / ACTION BAR
   ======================== */

.action-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.action-bar-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-secondary);
  transition: var(--transition);
}

.btn-action:hover {
  background: var(--bg-lighter);
  color: var(--primary);
  border-color: var(--primary);
}

/* ========================
   NEWSLETTER
   ======================== */

.newsletter-section {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  color: white;
  padding: 3rem 1.25rem;
  text-align: center;
}

.newsletter-section h2 {
  color: white;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.newsletter-section p {
  color: rgba(255,255,255,0.8);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.newsletter-form {
  display: flex;
  max-width: 440px;
  margin: 0 auto;
  gap: 0.5rem;
}

.newsletter-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  font-family: var(--font-sans);
}

.newsletter-form input::placeholder { color: rgba(255,255,255,0.6); }

.newsletter-form button {
  padding: 0.75rem 1.5rem;
  background: white;
  color: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.newsletter-form button:hover {
  background: var(--bg-lighter);
  transform: translateY(-1px);
}

/* ========================
   RECENTLY VIEWED
   ======================== */

.recent-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 0.5rem;
}

.recent-scroll::-webkit-scrollbar { display: none; }

.recent-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}

.recent-item:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.recent-item i { font-size: 0.75rem; color: var(--text-muted); }

/* ========================
   BLOG CARDS
   ======================== */

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.blog-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.blog-card-img {
  height: 160px;
  background: linear-gradient(135deg, var(--primary-light), #e0f2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.blog-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.blog-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.blog-card-excerpt {
  font-size: 0.825rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
  flex: 1;
}

/* ========================
   ARTICLE / CONTENT
   ======================== */

.article-content {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.article-content h2 {
  font-size: 1.4rem;
  color: var(--text-primary);
  margin: 2rem 0 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.article-content h3 {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin: 1.5rem 0 0.5rem;
}

.article-content p { margin-bottom: 1rem; }
.article-content ul { margin-bottom: 1rem; }
.article-content li { margin-bottom: 0.5rem; }

.article-content strong { color: var(--text-primary); }

.article-content code {
  font-family: 'Courier New', monospace;
  font-size: 0.875em;
  padding: 0.15em 0.4em;
  background: var(--bg-lighter);
  border-radius: 3px;
  color: var(--primary);
}

/* ========================
   SEARCH RESULTS
   ======================== */

.search-page-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.25rem;
}

.search-count {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.search-results-grid {
  display: grid;
  gap: 1rem;
}

/* ========================
   PAGINATION
   ======================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 2rem;
}

.page-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.page-btn:hover, .page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ========================
   TOAST NOTIFICATION
   ======================== */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--text-primary);
  color: var(--bg-white);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideInRight 0.3s ease;
  pointer-events: auto;
  max-width: 320px;
}

.toast i { font-size: 0.9rem; }
.toast-success { background: #065f46; }
.toast-error { background: #7f1d1d; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ========================
   COLOR THEMES FOR CATEGORIES
   ======================== */

.theme-finance { --cat-color: #1a56db; --cat-bg: #e8f0fe; }
.theme-business { --cat-color: #7c3aed; --cat-bg: #f3e8ff; }
.theme-loans { --cat-color: #059669; --cat-bg: #d1fae5; }
.theme-investing { --cat-color: #d97706; --cat-bg: #fef3c7; }
.theme-health { --cat-color: #dc2626; --cat-bg: #fee2e2; }
.theme-math { --cat-color: #0891b2; --cat-bg: #cffafe; }
.theme-time { --cat-color: #7c3aed; --cat-bg: #f3e8ff; }
.theme-converters { --cat-color: #059669; --cat-bg: #d1fae5; }
.theme-home { --cat-color: #d97706; --cat-bg: #fef3c7; }
.theme-education { --cat-color: #1a56db; --cat-bg: #e8f0fe; }
.theme-cooking { --cat-color: #dc2626; --cat-bg: #fee2e2; }
.theme-marketplace { --cat-color: #0891b2; --cat-bg: #cffafe; }

/* ========================
   CHART CONTAINERS
   ======================== */

.chart-container {
  position: relative;
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.chart-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* ========================
   PRINT STYLES
   ======================== */

@media print {
  .site-header, .mega-nav, .site-footer, .ad-placeholder,
  .action-bar, .sidebar, .newsletter-section, .related-section { display: none !important; }
  
  .main-content { padding-top: 0; }
  
  .two-col { grid-template-columns: 1fr; }
  
  body { background: white; }
  
  .calc-tool-card, .results-section { box-shadow: none; border: 1px solid #ccc; }
  
  .results-section { display: block !important; }
}

/* ========================
   RESPONSIVE
   ======================== */

@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .four-col { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

@media (max-width: 768px) {
  :root { --header-height: 56px; }
  
  .header-search { display: none; }
  .header-nav { display: none; }
  .mobile-menu-btn { display: flex; }
  
  .hero-section { padding: 2.5rem 1.25rem 2rem; }
  .hero-stats { gap: 1.25rem; }
  
  .four-col { grid-template-columns: repeat(2, 1fr); }
  .three-col { grid-template-columns: 1fr 1fr; }
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .calc-grid { grid-template-columns: 1fr; }
  
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
  
  .section { padding: 2rem 0; }
  .newsletter-form { flex-direction: column; }
  
  .action-bar { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .three-col { grid-template-columns: 1fr; }
  .four-col { grid-template-columns: 1fr 1fr; }
  .hero-stats { flex-direction: column; align-items: center; gap: 0.75rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr 1fr; }
}

/* ========================
   UTILITY CLASSES
   ======================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary-color { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sticky-top {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
}
