/* ==========================================================================
   METEO COSENZA E PROVINCIA - STILI PRINCIPALI
   Design chiaro ed essenziale per il territorio cosentino
   ========================================================================== */

:root {
  --primary-blue: #007ab9;
  --primary-blue-dark: #005b8a;
  --primary-blue-light: #e6f4fa;
  --accent-orange: #ff7a00;
  --accent-yellow: #ffa000;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.visually_hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ==========================================================================
   HEADER & NAVBAR
   ========================================================================== */
.app_header {
  background: var(--bg-card);
  border-bottom: 2px solid var(--primary-blue);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header_top_bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}

.brand_container {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}

.brand_logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand_text {
  display: flex;
  flex-direction: column;
}

.brand_title {
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.5px;
  color: var(--primary-blue);
  line-height: 1.1;
}

.brand_title strong {
  font-weight: 800;
  color: #0f172a;
}

.brand_badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-orange);
  letter-spacing: 0.5px;
}

.header_actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn_header_action {
  background: var(--primary-blue-light);
  color: var(--primary-blue);
  border: 1px solid rgba(0, 122, 185, 0.25);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn_header_action:hover, .btn_header_action.active {
  background: var(--primary-blue);
  color: #ffffff;
  border-color: var(--primary-blue);
}

.unit_switch_group {
  display: flex;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  padding: 2px;
  border: 1px solid var(--border-light);
}

.btn_unit {
  background: none;
  border: none;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn_unit span.active {
  color: var(--primary-blue);
  font-weight: 800;
}

.btn_unit .sep {
  color: var(--text-light);
  margin: 0 2px;
}

/* Barra di Ricerca & Filtro Comuni */
.search_and_filter_bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 20px 14px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 15px;
}

.search_input_wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search_icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search_input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  font-size: 14px;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
}

.search_input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 185, 0.15);
}

.search_dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 5px;
  background: #ffffff;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 340px;
  overflow-y: auto;
  z-index: 200;
}

.search_dropdown.hidden {
  display: none;
}

.search_item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
}

.search_item:hover {
  background: var(--primary-blue-light);
}

.search_item_main {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.search_item_alt {
  font-size: 12px;
  color: var(--text-muted);
}

.search_item_sub {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

.search_no_results {
  padding: 14px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.select_wrapper {
  display: flex;
  align-items: center;
}

.comuni_select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.comuni_select:focus {
  border-color: var(--primary-blue);
}

/* Zone Chips */
.zone_chips_container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.chips_label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.chips_scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.chips_scroll::-webkit-scrollbar {
  display: none;
}

.chip_btn {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip_btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.chip_btn.active {
  background: var(--primary-blue);
  color: #ffffff;
  border-color: var(--primary-blue);
}

/* ==========================================================================
   MAIN CONTENT CONTAINER
   ========================================================================== */
.app_main_content {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

/* ==========================================================================
   DAY SELECTOR (14-DAY TABS CAROUSEL)
   ========================================================================== */
.day_selector_nav {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.day_selector_scroll_wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.scroll_nav_btn {
  background: rgba(255, 255, 255, 0.95);
  border: none;
  color: var(--primary-blue);
  font-size: 24px;
  width: 32px;
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}

.scroll_nav_btn:hover {
  background: var(--primary-blue-light);
}

.day_selector_list {
  display: flex;
  list-style: none;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  padding: 0;
  margin: 0;
  width: 100%;
}

.day_tab_item {
  flex: 0 0 95px;
  height: 94px;
  border-right: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.day_tab_item:hover {
  background: #f8fafc;
}

.day_tab_item.active {
  background: var(--primary-blue-light);
  border-bottom: 3px solid var(--primary-blue);
}

.day_tab_item.active .day_tab_date {
  color: var(--primary-blue);
  font-weight: 700;
}

.day_tab_link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  width: 100%;
  text-decoration: none;
}

.day_tab_date {
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 4px;
}

.day_tab_date strong {
  font-size: 15px;
}

.day_tab_icon {
  margin: 2px 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
}

.day_tab_temps {
  display: flex;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.temp_min {
  color: #0288d1;
}

.temp_max {
  color: #e65100;
}

/* ==========================================================================
   HERO CARD
   ========================================================================== */
.hero_card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero_card_header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 15px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 16px;
}

.hero_city_title {
  font-size: 32px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.hero_date_subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.location_alt_tag {
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.btn_tts {
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-blue);
  transition: all 0.2s;
}

.btn_tts:hover {
  background: var(--primary-blue-light);
  border-color: var(--primary-blue);
}

.hero_main_layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: 10px 0;
}

.hero_temp_display {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hero_weather_icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero_temp_value_wrapper {
  display: flex;
  flex-direction: column;
}

.hero_current_temp {
  font-size: 56px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  display: flex;
  align-items: flex-start;
}

.temp_unit_symbol {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 2px;
}

.hero_condition_label {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-blue);
  margin-top: 4px;
  text-transform: capitalize;
}

.hero_day_range_badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.range_item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.range_label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
}

.range_val {
  font-size: 22px;
  font-weight: 800;
}

.range_item.min .range_val {
  color: #0288d1;
}

.range_item.max .range_val {
  color: #e65100;
}

.range_divider {
  font-size: 24px;
  color: var(--border-medium);
}

/* Griglia Indicatori Dettagliati */
.hero_metrics_grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.metric_box {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.metric_box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  background: #ffffff;
}

.metric_icon {
  font-size: 24px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric_content {
  display: flex;
  flex-direction: column;
}

.metric_label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.metric_value {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 1px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric_value small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.metric_hint {
  font-size: 11px;
  color: var(--text-light);
}

.qa_bullet {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 4px;
}

/* ==========================================================================
   SECTIONS GENERAL
   ========================================================================== */
.section_title_row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section_title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
}

/* ==========================================================================
   CHARTS SECTION
   ========================================================================== */
.chart_section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chart_header_bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.chart_legend {
  display: flex;
  gap: 15px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.legend_entry {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend_line {
  display: inline-block;
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

.legend_line.orange {
  background: #ff7a00;
}

.legend_line.blue_dash {
  background: repeating-linear-gradient(90deg, #007ab9, #007ab9 3px, transparent 3px, transparent 6px);
}

.legend_rect.blue {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: #0288d1;
  border-radius: 2px;
}

.chart_wrapper {
  position: relative;
  width: 100%;
  overflow-x: auto;
  padding-top: 10px;
}

.weather_chart_svg {
  width: 100%;
  height: auto;
  min-width: 650px;
  display: block;
}

/* Tooltip Interattivo Precipitazioni */
.chart_tooltip {
  position: absolute;
  pointer-events: none;
  background: #0f172a;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transform: translate(-50%, -100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0;
  transition: opacity 0.12s ease-out;
}

.chart_tooltip.visible {
  display: flex !important;
  opacity: 1 !important;
}

.chart_tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #0f172a;
}

.tooltip_precip_row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tooltip_water_icon {
  font-size: 15px;
}

.tooltip_precip_text {
  color: #ffffff;
  font-size: 13px;
}

.tooltip_precip_text strong {
  color: #38bdf8;
  font-size: 15px;
  font-weight: 800;
}

.tooltip_meta_row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
}

.tooltip_dry_row {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
}

.chart_precip_bar {
  transition: fill 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
  cursor: pointer;
}

.precip_bar_group:hover .chart_precip_bar,
.chart_precip_bar.active_bar {
  opacity: 1 !important;
  fill: #00e5ff !important;
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.85)) !important;
}

.chart_precip_val {
  transition: fill 0.15s ease, font-weight 0.15s ease;
}

.precip_bar_group:hover .chart_precip_val,
.chart_precip_bar.active_bar + .chart_precip_val {
  fill: #00e5ff !important;
  font-weight: 800;
}

/* ==========================================================================
   INTERACTIVE MAP MODAL
   ========================================================================== */
.map_modal_backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.map_container_card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 950px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map_header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.map_title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.map_subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.map_close_btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.map_close_btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.map_body {
  flex: 1;
  width: 100%;
  background: #e2e8f0;
}

.map_footer_legend {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.legend_badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  color: #ffffff;
  margin-right: 6px;
}

.legend_badge.blue { background: #0288d1; }
.legend_badge.green { background: #10b981; }
.legend_badge.orange { background: #f59e0b; }
.legend_badge.red { background: #ef4444; }

/* Custom Leaflet Map Pins */
.custom_map_marker {
  background: none;
  border: none;
}

.marker_pin {
  background: #ffffff;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  padding: 2px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
}

.marker_pin.blue { border-color: #0288d1; color: #0288d1; }
.marker_pin.green { border-color: #10b981; color: #059669; }
.marker_pin.orange { border-color: #f59e0b; color: #d97706; }
.marker_pin.red { border-color: #ef4444; color: #dc2626; }

.marker_pin.selected_pin {
  border-width: 2.5px;
  box-shadow: 0 0 0 3px rgba(0, 122, 185, 0.4);
}

.marker_temp {
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.marker_name {
  font-size: 10px;
  font-weight: 600;
  color: #1e293b;
}

.marker_popup h4 {
  font-size: 16px;
  margin-bottom: 5px;
  color: var(--primary-blue);
}

.marker_popup p {
  font-size: 12px;
  margin: 3px 0;
  color: #475569;
}

.popup_select_btn {
  background: var(--primary-blue);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  width: 100%;
  cursor: pointer;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app_footer {
  background: #1e293b;
  color: #94a3b8;
  padding: 30px 20px;
  margin-top: 40px;
  border-top: 1px solid #334155;
  font-size: 13px;
}

.footer_container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  text-align: center;
}

.footer_brand {
  font-weight: 700;
  color: #ffffff;
  font-size: 16px;
}

.footer_links {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer_links a {
  color: #cbd5e1;
  text-decoration: none;
}

.footer_links a:hover {
  color: var(--primary-blue-light);
  text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 900px) {
  .search_and_filter_bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .header_top_bar {
    padding: 10px 14px;
  }

  .brand_title {
    font-size: 17px;
  }

  .search_and_filter_bar {
    padding: 6px 14px 10px;
  }

  .app_main_content {
    padding: 12px;
    gap: 18px;
  }

  .hero_card {
    padding: 16px;
  }

  .hero_city_title {
    font-size: 26px;
  }

  .hero_current_temp {
    font-size: 44px;
  }

  .hero_metrics_grid {
    grid-template-columns: 1fr 1fr;
  }
}
