/* Energy Bill Auditor - Styles */
:root {
  --bg: #0f172a;
  --panel: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #22c55e;
  --primary-900: #14532d;
  --accent: #38bdf8;
  --link: #22c55e;
  --link-hover: #34d399;
  --link-visited: #16a34a;
  --focus: #22c55e;
  --card: #0b1220;
  --border: #1f2937;
  --danger: #ef4444;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 60% -10%, #0b1220, #0a0f1c 30%, #080c16 60%, #060a12 100%);
  color: var(--text);
}

/* Links use brand green, not browser blue */
a {
  color: var(--link);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--link) 60%, transparent);
}
a:hover { color: var(--link-hover); text-decoration-color: var(--link-hover); }
a:visited { color: var(--link-visited); }
a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.container {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  padding: 3rem 0 2rem;
}
.site-header h1 {
  margin: 0 0 .5rem;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}
.tagline {
  margin: 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: .5rem;
  margin: 1.5rem 0 1rem;
}
.tab {
  appearance: none;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #0f172a, #0b1220);
  color: var(--text);
  padding: .6rem 1rem;
  border-radius: .6rem;
  cursor: pointer;
}
.tab.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);
}

.panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #0b1220, #0a0f1c);
  border-radius: .8rem;
  padding: 1.25rem;
}

.calc-form { margin-top: .5rem; }
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}
.field { grid-column: span 12; }
@media (min-width: 700px) {
  .field { grid-column: span 4; }
}
.field label { display: block; margin: .25rem 0 .35rem; color: var(--muted); }
.field input {
  width: 100%;
  padding: .65rem .75rem;
  border-radius: .6rem;
  border: 1px solid var(--border);
  background: #0a1220;
  color: var(--text);
}
.field input:focus { outline: 2px solid var(--focus); border-color: var(--focus); }

.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0 .25rem; }
.primary, .secondary, .ghost {
  appearance: none;
  border-radius: .6rem;
  padding: .6rem 1rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #0f172a;
  color: var(--text);
}
.primary { background: linear-gradient(180deg, #16a34a, #22c55e); border-color: #16a34a; color: #052e13; font-weight: 700; }
.secondary { border-color: var(--link); color: var(--link-hover); background: transparent; }
.primary:hover { filter: brightness(1.05); }
.secondary:hover { background: color-mix(in srgb, var(--link) 12%, transparent); }
.ghost { color: var(--muted); }
.ghost:hover { background: rgba(255,255,255,0.05); }

.results {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
  margin: 1rem 0 0;
}
.card {
  grid-column: span 12;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #0b1220, #0a0f1c);
  border-radius: .8rem;
  padding: 1rem;
}
.card.emphasis { border-color: var(--primary); background: linear-gradient(180deg, #0a1515, #07140e); }
.card h3 { margin: 0 0 .35rem; font-size: 1rem; color: var(--muted); }
.card .value { margin: 0; font-size: clamp(1.5rem, 3.2vw, 2.2rem); font-weight: 800; letter-spacing: .3px; }
@media (min-width: 700px) {
  .card { grid-column: span 6; }
}

.note { color: var(--muted); margin-top: .75rem; font-size: .95rem; }

.states, .faq { margin: 2rem 0; }
.state-lists { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; }
.state-lists > div { grid-column: span 12; border: 1px solid var(--border); border-radius: .8rem; padding: .75rem 1rem; background: #0b1220; }
@media (min-width: 800px) { .state-lists > div { grid-column: span 6; } }
.states ul { columns: 2; margin: .25rem 0 0 0; padding-left: 1rem; }

details { border: 1px solid var(--border); border-radius: .6rem; padding: .5rem .75rem; background: #0b1220; }
details + details { margin-top: .65rem; }
summary { cursor: pointer; }

.site-footer { border-top: 1px solid var(--border); margin-top: 2rem; padding: 1.5rem 0; color: var(--muted); }

.positive { color: #22c55e; }
.negative { color: #ef4444; }

/* Consistent focus styles */
.tab:focus-visible,
.primary:focus-visible,
.secondary:focus-visible,
.ghost:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Theme variants */
:root[data-theme="light"] {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #0b1220;
  --muted: #334155;
  --card: #ffffff;
  --border: #e5e7eb;
}
:root[data-theme="light"] body { background: #f8fafc; }
:root[data-theme="light"] .ghost:hover { background: #f1f5f9; }
:root[data-theme="light"] .secondary:hover { background: color-mix(in srgb, var(--link) 10%, #ffffff); }

:root[data-theme="contrast"] {
  --bg: #000000;
  --panel: #000000;
  --text: #ffffff;
  --muted: #d1d5db;
  --card: #000000;
  --border: #6b7280;
}
:root[data-theme="contrast"] body { background: #000; }

/* Theme switch control */
.theme-switch {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .5rem .75rem;
  border-radius: .6rem;
  display: flex;
  gap: .5rem;
  align-items: center;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  z-index: 50;
}
.theme-switch label { color: var(--muted); font-size: .9rem; }
.theme-switch select {
  background: #0a1220;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: .4rem;
  padding: .3rem .5rem;
}
:root[data-theme="light"] .theme-switch select { background: #ffffff; }

/* Print styles */
@media print {
  .tabs, .actions, .note { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #111; text-decoration-color: #111; }
  .panel, .card, .state-lists > div, details { background: #fff; border-color: #ccc; }
}

/* Modal */
.modal[aria-hidden="false"] { display: block; }
.modal[aria-hidden="true"], .modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.modal-content {
  position: relative; margin: 10vh auto 0; width: min(520px, calc(100% - 2rem));
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: .8rem; padding: 1rem 1.25rem; box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.modal-content label { display:block; margin:.5rem 0 .35rem; color: var(--muted); }
.modal-content input { width:100%; padding:.6rem .7rem; border:1px solid var(--border); border-radius:.6rem; background:#0a1220; color:var(--text); }
.modal-content input:focus { outline:2px solid var(--focus); border-color:var(--focus); }

/* CTA Button Styles */
.cta-section {
  text-align: center;
  margin: 2rem 0;
}

.cta-button {
  display: inline-block;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #052e13;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 1rem 2rem;
  border-radius: .8rem;
  text-decoration: none;
  border: 2px solid #16a34a;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.25);
  transition: all 0.2s ease;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35);
  filter: brightness(1.1);
  color: #052e13;
  text-decoration: none;
}

.cta-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Theme variants for CTA button */
:root[data-theme="light"] .cta-button {
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

:root[data-theme="light"] .cta-button:hover {
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.3);
}

:root[data-theme="contrast"] .cta-button {
  border-color: #22c55e;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}
