/* Deer Collision Risk Radar — style.css */
/* Mobile-first, riktom.com green aesthetic */

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

:root {
  --green-dark:   #1b5e20;
  --green-mid:    #2e7d32;
  --green-light:  #4caf50;
  --green-pale:   #e8f5e9;
  --text:         #1a1a1a;
  --text-muted:   #555;
  --card-bg:      #fff;
  --border:       #e0e0e0;
  --shadow:       0 2px 8px rgba(0,0,0,0.10);
  --radius:       14px;
  --radius-sm:    8px;
  --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: #f4f7f4;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
}

/* ── Navigation (matches riktom.com) ───────────────────────────────────── */
nav {
  background: var(--green-mid);
  height: 52px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 300;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
nav .logo { color: #fff; text-decoration: none; font-size: 1.1rem; font-weight: 800; letter-spacing: -0.3px; }
nav .logo span { color: #a5d6a7; }
nav ul { list-style: none; display: flex; gap: 1.25rem; align-items: center; }
nav ul a { color: #c8e6c9; text-decoration: none; font-size: 0.85rem; font-weight: 500; }
nav ul a:hover { color: #fff; }

.nav-dropdown { position: relative; }
.nav-dropdown > a::after { content: " ▾"; font-size: 0.7rem; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 210px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  z-index: 400;
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.88rem;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.12s;
}
.dropdown-menu a:last-child { border-bottom: none; }
.dropdown-menu a:hover { background: var(--green-pale); color: var(--green-dark); }
.dd-icon { font-size: 0.9rem; }

/* ── Main Container ─────────────────────────────────────────────────────── */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── County Selector ────────────────────────────────────────────────────── */
.county-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  box-shadow: var(--shadow);
}

.county-bar label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green-dark);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

#county-select {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-weight: 500;
}

/* ── Live time / Sun bar ────────────────────────────────────────────────── */
.meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0 2px;
}

#live-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--green-dark); }
#moon-phase-display { font-size: 0.82rem; }

/* ── Hazard Badge ───────────────────────────────────────────────────────── */
.hazard-badge {
  border-radius: var(--radius);
  padding: 28px 20px 22px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.20);
  transition: background 0.4s ease;
  position: relative;
  overflow: hidden;
}

.hazard-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}

#rating-label {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1.1;
  display: block;
  text-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

#rating-reason {
  margin-top: 8px;
  font-size: 0.92rem;
  opacity: 0.92;
  font-weight: 500;
  display: block;
}

#total-score {
  margin-top: 10px;
  display: inline-block;
  background: rgba(0,0,0,0.18);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ── Factor Cards ────────────────────────────────────────────────────────── */
.factors-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.factor-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow);
}

.factor-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.factor-body { flex: 1; min-width: 0; }
.factor-name { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }
.factor-label { font-size: 1rem; font-weight: 700; color: var(--text); margin-top: 1px; }
.factor-detail { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; line-height: 1.35; }

.score-dots {
  display: block;
  margin-top: 5px;
  font-size: 0.85rem;
  letter-spacing: 2px;
  color: var(--green-mid);
}

/* ── Sun Times ───────────────────────────────────────────────────────────── */
#sun-times {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 4px 0;
  font-weight: 500;
}

/* ── Next Window Bar ─────────────────────────────────────────────────────── */
.next-window-bar {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-left: 4px solid #f57f17;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #7c4400;
  box-shadow: var(--shadow);
}

/* ── Tips Section ────────────────────────────────────────────────────────── */
.tips-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tips-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--green-dark);
  text-align: left;
  font-family: var(--font);
}

.tips-toggle:hover { background: var(--green-pale); }
.chevron { font-size: 0.75rem; transition: transform 0.2s; }

.tips-body {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}

.tips-body ul {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tips-body li {
  display: flex;
  gap: 8px;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--text);
}
.tips-body li .tip-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  font-size: 0.74rem;
  color: #aaa;
  padding: 4px 0 8px;
}

.footer a { color: #aaa; text-decoration: none; }
.footer a:hover { color: var(--green-mid); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (min-width: 500px) {
  .container { padding: 16px 16px 32px; gap: 14px; }
  #rating-label { font-size: 3.2rem; }
}

@media (min-width: 768px) {
  .factors-grid { flex-direction: row; }
  .factor-card { flex-direction: column; text-align: center; flex: 1; }
  .factor-icon { font-size: 2rem; margin: 0 auto; }
  .score-dots { text-align: center; }
}

/* Pulse animation for EXTREME rating */
@keyframes pulse-extreme {
  0%, 100% { box-shadow: 0 4px 16px rgba(183,28,28,0.4); }
  50%       { box-shadow: 0 4px 32px rgba(183,28,28,0.7); }
}
.hazard-badge.extreme { animation: pulse-extreme 2s ease-in-out infinite; }
