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

:root {
  --blue: #1a6fba;
  --blue-light: #4a90d9;
  --blue-dark: #0d4d8a;
  --green: #2e7d32;
  --green-light: #5cb85c;
  --red: #c0392b;
  --gold: #f39c12;
  --gray: #6c757d;
  --gray-light: #f8f9fa;
  --border: #dee2e6;
  --text: #212529;
  --text-muted: #6c757d;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: #fff;
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Header */
header {
  background: var(--blue-dark);
  color: #fff;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.site-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.lang-switcher { display: flex; gap: 6px; }
.lang-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}
.lang-btn:hover, .lang-btn.active {
  background: rgba(255,255,255,0.9);
  color: var(--blue-dark);
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  padding: 48px 0 40px;
  text-align: center;
}
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); font-weight: 800; margin-bottom: 12px; }
.hero p { font-size: 1.05rem; opacity: 0.9; max-width: 600px; margin: 0 auto; }

/* Ad placeholders */
.ad-slot {
  text-align: center;
  background: var(--gray-light);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin: 16px 0;
}
#ad-top { min-height: 90px; }
#ad-bottom { min-height: 250px; }

/* Form */
.form-section { padding: 32px 0 24px; }
.form-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-group input, .form-group select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
}
.compare-btn {
  width: 100%;
  padding: 14px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.02em;
}
.compare-btn:hover { background: var(--blue-dark); }
.compare-btn:active { transform: scale(0.99); }

/* Results */
#results { padding: 8px 0 32px; opacity: 0; transition: opacity 0.4s; }
#results.visible { opacity: 1; }
.results-table { display: flex; flex-direction: column; gap: 12px; }

/* Province Card */
.province-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
  position: relative;
}
.province-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.province-card.top-pick { border-color: var(--gold); border-width: 2px; }

.badge-recommended {
  background: var(--gold);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  text-align: center;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  cursor: pointer;
  background: #fff;
  flex-wrap: wrap;
}
.card-header:hover { background: var(--gray-light); }

.card-name {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.province-flag { font-size: 1.5rem; }
.province-name { font-weight: 700; font-size: 1rem; }
.province-capital { font-size: 12px; color: var(--text-muted); }

.card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  flex: 1;
}
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 90px; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 0.95rem; font-weight: 600; }
.stat-value.tax { font-size: 0.8rem; }
.surplus-positive { color: var(--green); }
.surplus-negative { color: var(--red); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-french { background: #fde8e8; color: var(--red); }
.badge-no-french { background: #e8f5e9; color: var(--green); }

.expand-icon { margin-left: auto; color: var(--text-muted); transition: transform 0.25s; font-size: 12px; }
.province-card.open .expand-icon { transform: rotate(180deg); }

/* Detail panel */
.card-detail {
  display: none;
  padding: 20px;
  background: var(--gray-light);
  border-top: 1px solid var(--border);
}
.province-card.open .card-detail { display: block; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 600px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-section h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
  margin-top: 16px;
}
.detail-section h4:first-child { margin-top: 0; }

/* Cost bars */
.cost-bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-label { font-size: 12px; min-width: 80px; color: var(--text); }
.bar-track { flex: 1; background: var(--border); border-radius: 4px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.bar-value { font-size: 12px; font-weight: 600; min-width: 60px; text-align: right; }

/* Stars */
.stars { font-size: 1.2rem; color: var(--gold); letter-spacing: 2px; margin-bottom: 12px; }

/* Programs */
.programs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.program-tag {
  background: #e3f0fb;
  color: var(--blue-dark);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.province-notes { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* SEO content */
.seo-section { padding: 40px 0; border-top: 1px solid var(--border); }
.seo-section h2 { font-size: 1.2rem; margin-bottom: 12px; color: var(--blue-dark); }
.seo-section p { color: var(--text-muted); font-size: 14px; line-height: 1.7; }

/* Sort pills */
.sort-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.sort-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.sort-pill {
  background: var(--gray-light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.sort-pill:hover { background: #e2ecf8; border-color: var(--blue-light); }
.sort-pill.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Best-for tags */
.best-for-tags { font-size: 1rem; margin-left: 6px; }

/* Affordability ratio */
.stat-sub { font-size: 11px; margin-top: 2px; font-weight: 500; }
.afford-low { color: var(--green); }
.afford-mid { color: var(--gold); }
.afford-high { color: var(--red); }

/* Suburb rent note */
.suburb-note { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* FAQ */
.faq-section { padding: 32px 0 8px; border-top: 1px solid var(--border); }
.faq-section h2 { font-size: 1.2rem; margin-bottom: 16px; color: var(--blue-dark); }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.faq-q {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--gray-light);
  transition: background 0.15s;
}
.faq-q:hover { background: #e8f0fb; }
.faq-icon { color: var(--text-muted); font-size: 11px; transition: transform 0.2s; flex-shrink: 0; }
.faq-item.open .faq-icon { transform: rotate(180deg); }
.faq-a { display: none; padding: 14px 16px; font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.faq-item.open .faq-a { display: block; }

/* Disclaimer */
.disclaimer {
  background: #fff8e1;
  border-left: 4px solid var(--gold);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px;
  color: var(--text-muted);
  margin: 24px 0;
}

/* Footer */
footer {
  background: var(--blue-dark);
  color: rgba(255,255,255,0.75);
  padding: 24px 0;
  font-size: 13px;
  text-align: center;
}
footer a { color: rgba(255,255,255,0.9); }
.footer-langs { display: flex; justify-content: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.footer-langs a { color: rgba(255,255,255,0.9); font-weight: 500; }

/* Feedback button */
.feedback-btn {
  position: fixed;
  bottom: 24px;
  right: 20px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 200;
  transition: background 0.2s;
}
.feedback-btn:hover { background: var(--blue-dark); }

/* Mobile */
@media (max-width: 600px) {
  .hero { padding: 32px 0 28px; }
  .card-stats { gap: 8px 14px; }
  .stat { min-width: 75px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

/* Print */
@media print {
  header, .form-section, .feedback-btn, .ad-slot, footer { display: none; }
  #results { opacity: 1; }
  .card-detail { display: block !important; }
}
