/*
  CVG Flood Watch UI (shared)
  Canonical location: /community/cvg-flood-watch/shared-assets/
  Purpose: shared typography, layout, header, nav, components for Flood Watch network pages
  Notes:
    - Keep this file framework-free (vanilla CSS)
    - Individual counties can override via a small local <style> block or an optional county CSS file.
*/

:root {
  --cvg-font-sans: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  --cvg-text: #334155;
  --cvg-bg: #f8fafc;
  --cvg-brand-900: #0c4a6e;
  --cvg-brand-800: #1e3c72;
  --cvg-brand-700: #2a5298;
  --cvg-accent: #0891b2;
  --cvg-danger: #dc2626;
  --cvg-warning-focus: #f59e0b;

  --cvg-shadow-md: 0 10px 30px rgba(0, 0, 0, 0.1);
  --cvg-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
  --cvg-radius-lg: 16px;
  --cvg-radius-md: 12px;
  --cvg-radius-sm: 8px;
}

/*
  Shared asset bundle versioning
  Update this when releasing changes that require cache busting.
  Pages can optionally reference this value in comments or querystrings.
*/
:root {
  --cvg-flood-watch-ui-version: "2026-02-07";
}

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

body {
  font-family: var(--cvg-font-sans);
  line-height: 1.6;
  color: var(--cvg-text);
  background: var(--cvg-bg);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--cvg-warning-focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 1rem;
  background: var(--cvg-brand-900);
  color: white;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  z-index: 2000;
}

.skip-link:focus {
  left: 1rem;
}

.content-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.header {
  /* County pages should set these CSS vars if they want a local hero background image */
  --cvg-header-overlay-a: rgba(30, 60, 114, 0.7);
  --cvg-header-overlay-b: rgba(42, 82, 152, 0.7);
  --cvg-header-image: none;

  background:
    linear-gradient(135deg, var(--cvg-header-overlay-a), var(--cvg-header-overlay-b)),
    var(--cvg-header-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;

  color: white;
  text-align: center;
  padding: 2rem 1.5rem;
  position: relative;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto 1.5rem;
  gap: 1rem;
}

.header-logo-link {
  display: inline-block;
}

.header-logo {
  height: 80px;
  width: auto;
  transition: opacity 0.3s ease;
}

.header-logo:hover {
  opacity: 0.85;
}

.menu-button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
  padding: 0.5rem;
  transition: opacity 0.3s ease;
  position: relative;
}

/* Menu button focus/hover treatment */
.menu-button {
  border-radius: 12px;
}

.menu-button:hover {
  opacity: 0.85;
}

.menu-button:focus-visible {
  outline: 3px solid var(--cvg-warning-focus);
  outline-offset: 4px;
}

/* (Removed duplicate hover rule that could override the improved hover opacity.) */

.menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: white;
  border-radius: var(--cvg-radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  min-width: 250px;
  z-index: 1000;
  overflow: hidden;
}

/* Improve perceived quality: subtle border + better spacing */
.menu-dropdown {
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.35rem;
}

.menu-dropdown.active {
  display: block;
}

.menu-dropdown a {
  display: block;
  padding: 0.75rem 0.95rem;
  color: var(--cvg-brand-800);
  text-decoration: none;
  border-bottom: 0;
  border-radius: 10px;
  font-weight: 650;
  transition: background 0.15s ease, transform 0.15s ease;
}

.menu-dropdown a:hover {
  background: #f1f5f9;
}

.menu-dropdown a:focus-visible {
  background: #e0f2fe;
}

/* Divider support (used by fallback menus and can be used in dropdown menus too) */
.menu-dropdown .menu-divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.6);
  margin: 0.35rem 0.5rem;
}

/* Optional active/current link state */
.menu-dropdown a[aria-current="page"],
.menu-dropdown a.is-active {
  background: rgba(8, 145, 178, 0.14);
  color: var(--cvg-brand-900);
}

/* Reduce motion for users who request it */
@media (prefers-reduced-motion: reduce) {
  .menu-dropdown a {
    transition: none;
  }
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.45);
}

.header p {
  font-size: 1.2rem;
  opacity: 0.95;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.45);
}

/* Sections */
.section-container {
  background: white;
  width: 100%;
}

.section-header {
  background: linear-gradient(135deg, var(--cvg-brand-800), var(--cvg-brand-700));
  color: white;
  padding: 2rem 1.5rem;
  text-align: center;
}

.section-header.survey-header {
  background: white;
  color: var(--cvg-brand-800);
}

.section-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.section-content {
  padding: 0;
}

.section-content.survey-content,
.section-content.dashboard-content {
  padding: 0 3rem;
}

iframe {
  width: 100%;
  border: none;
  background: var(--cvg-bg);
}

.dashboard-frame { height: 1200px; }
.form-frame { height: 600px; }

.section-spacing {
  height: 2rem;
  background: white;
}

/* Emergency Popup */
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
}

.popup-overlay.active {
  display: block;
}

.emergency-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2rem;
  border-radius: var(--cvg-radius-lg);
  box-shadow: var(--cvg-shadow-lg);
  z-index: 1001;
  max-width: 500px;
  width: 90%;
}

.emergency-popup.active {
  display: block;
}

.popup-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--cvg-danger);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.emergency-popup h3 {
  color: var(--cvg-danger);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.emergency-popup p {
  margin-bottom: 1.5rem;
  color: #475569;
}

.emergency-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.emergency-button,
.info-button {
  flex: 1;
  color: white;
  padding: 1rem;
  border-radius: var(--cvg-radius-sm);
  text-decoration: none;
  font-weight: 600;
  text-align: center;
  min-width: 150px;
}

.emergency-button { background: var(--cvg-danger); }
.info-button { background: var(--cvg-brand-800); }

.emergency-trigger {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--cvg-danger);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.4);
  z-index: 999;
  border: none;
  font-size: 1rem;
}

.emergency-trigger:hover {
  filter: brightness(0.95);
}

/* Back to Top */
.back-to-top {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--cvg-brand-800);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px rgba(30, 60, 114, 0.4);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--cvg-accent);
}

/* Slideshow base (county pages can include their own enhanced variants) */
.slideshow-section {
  background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  padding: 3rem 0;
}

.slideshow-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.slideshow-container h3 {
  color: var(--cvg-brand-900);
  margin-bottom: 2rem;
  font-size: 2rem;
  text-align: center;
}

.slider {
  position: relative;
  max-width: 900px;
  margin: 0 auto 3rem;
  background: white;
  border-radius: var(--cvg-radius-lg);
  overflow: hidden;
  box-shadow: var(--cvg-shadow-md);
}

.slide {
  display: none;
  padding: 2rem;
}

.slide.active {
  display: block;
}

.slide h4 {
  color: var(--cvg-brand-900);
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.slide p {
  color: #475569;
  font-size: 1.05rem;
  line-height: 1.7;
}

.slider-nav {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
}

.slider-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #cbd5e1;
  cursor: pointer;
  border: none;
  padding: 0;
}

.slider-dot.active {
  background: #0ea5e9;
}

.slider-arrow {
  position: absolute;
  top: 40%;
  transform: translateY(-50%);
  background: rgba(30, 60, 114, 0.9);
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 10;
}

.slider-arrow:hover {
  background: rgba(220, 38, 38, 0.9);
}

.slider-arrow.prev { left: -60px; }
.slider-arrow.next { right: -60px; }

/* Bottom nav */
.bottom-nav {
  background: white;
  padding: 2rem 0;
  border-top: 1px solid #e2e8f0;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.nav-link {
  color: var(--cvg-brand-800);
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: var(--cvg-radius-sm);
  background: var(--cvg-bg);
  text-align: center;
  font-weight: 500;
  transition: background 0.2s ease;
}

.nav-link:hover {
  background: #e2e8f0;
}

.nav-link.current {
  background: var(--cvg-brand-800);
  color: white;
}

.nav-link.current:hover {
  background: var(--cvg-brand-700);
}

.nav-link.roadmap {
  background: #059669;
  color: white;
}

.nav-link.roadmap:hover {
  background: #047857;
}

/* Provider footer */
.provider-section {
  background: linear-gradient(135deg, var(--cvg-brand-800), var(--cvg-brand-700));
  color: white;
  padding: 3rem 0;
  text-align: center;
}

.provider-section h3 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.provider-section p {
  opacity: 0.95;
  margin-bottom: 2rem;
}

.provider-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.provider-link {
  background: white;
  color: var(--cvg-brand-800);
  padding: 1rem 2rem;
  border-radius: var(--cvg-radius-sm);
  text-decoration: none;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .header { padding: 1.5rem 1rem; }
  .header-top { margin-bottom: 1rem; }
  .header h1 { font-size: 1.8rem; }
  .header p { font-size: 0.95rem; }
  .header-logo { height: 60px; }
  .menu-button { font-size: 1.5rem; }
  .menu-dropdown { min-width: 200px; }
  .section-content.survey-content,
  .section-content.dashboard-content { padding: 0 1rem; }
  .section-header h2 { font-size: 1.5rem; }
  .slideshow-container h3 { font-size: 1.5rem; }
  .emergency-trigger {
    bottom: 10px;
    right: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  .slider-arrow { display: none; }
  .back-to-top {
    bottom: 70px;
    right: 10px;
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
  }
  .nav-link { min-height: 44px; }
  .slider-dot { width: 8px; height: 8px; }
}

@media print {
  .header-logo, .menu-button, .emergency-trigger, .back-to-top,
  .slider-arrow, .emergency-popup, .popup-overlay {
    display: none !important;
  }
  .header {
    background: var(--cvg-brand-800) !important;
    color: white !important;
    padding: 1rem !important;
  }
  iframe { display: none; }
  body { background: white; }
}
