/*
Time & Weather (Weather.gov) - front-end styles

This file styles:
- The [weather] shortcode output (location bar, radar image, current temperature, and forecast accordion)
- The [time] shortcode output (JS-updated time string)

You can:
- Leave this file in the plugin, OR
- Copy/paste it into your theme/child theme and disable the plugin CSS enqueue if you prefer.
*/

/* Move Meow AI Engine chatbot up so it doesn't overlap the weather widget */
#mwai-chatbot-default {
  bottom: 150px !important;
}

.forecast-container {
  max-width: 900px;
  margin: 0 auto;
}

/* Location bar */
.taw-location-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  margin: 0 0 14px 0;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
}

.taw-location-display {
  font-weight: 600;
}

.taw-location-prefix {
  margin-right: 6px;
  opacity: 0.85;
}

.taw-location-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.taw-btn {
  appearance: none;
  border: 1px solid #003366;
  background: #003366;
  color: #ffffff;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.1;
}

.taw-btn.taw-btn-secondary {
  background: #ffffff;
  color: #003366;
}

.taw-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.taw-input {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 210px;
}

.taw-status {
  margin: 8px 0 0 0;
  font-size: 0.95em;
  color: #334155;
}

/* Radar */
.taw-radar {
  margin: 10px 0 18px 0;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
}

.taw-radar-title {
  font-weight: 700;
  margin: 0 0 10px 0;
}

.taw-radar-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

/* Avoid broken-image icon before JS sets a src for auto radar mode */
.taw-radar-img:not([src]),
.taw-radar-img[src=""] {
  display: none;
}

/* "Right Now" current temperature */
#current-temp {
  font-size: 18pt;
  font-weight: bold;
  color: #D2242A;
  margin-top: 5px;
}

/* Accordion headers */
.taw-accordion-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: bold;
  border: 1px solid #003366;
  background-color: #003366;
  color: white;
  border-radius: 10px;
  margin: 20px 0;
  scroll-margin-top: 10px;
}

/* Alternate colors */
.taw-accordion-item:nth-child(odd) .taw-accordion-header {
  background-color: #003366;
}

.taw-accordion-item:nth-child(even) .taw-accordion-header {
  background-color: #0050a0;
}

/* Day/night labels (applied by JS using NWS isDaytime flag) */
.taw-accordion-header.day-label {
  background-color: skyblue !important;
  color: black !important;
}

.taw-accordion-header.night-label {
  background-color: black !important;
  color: white !important;
}

/* Caret indicator */
.taw-accordion-header::after {
  content: "▸";
  margin-left: auto;
  transition: transform 0.3s ease;
  font-size: 1.1em;
}

.taw-accordion-header[aria-expanded="true"]::after {
  transform: rotate(90deg);
  content: "▼";
}

/* Accordion content (collapsed by default) */
.taw-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  will-change: max-height;
  padding: 0 14px;
  border-radius: 8px;
  background-color: white;
}

/* Expanded accordion content (height set inline by JS) */
.taw-accordion-content.expanded {
  padding: 14px;
}

/* Inside content formatting */
.taw-accordion-content hr {
  margin: 12px 0;
}

.taw-accordion-content .info-line {
  margin: 8px 0;
}

/* Weather Icons sizing inside accordion content only */
.taw-accordion-content i.wi {
  font-size: 1.6em;
  margin-right: 10px;
  vertical-align: middle;
  display: inline-block;
  width: 1.5em;
  text-align: center;
}

/* Debug/utility output */
.taw-weather-text {
  white-space: pre-wrap;
  background: #f6f8fa;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
}


/* Radar style selector */
.taw-radar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 10px 0;
  flex-wrap: wrap;
}

.taw-radar-label {
  font-weight: 600;
}

.taw-select {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
}


/* -------------------------------------------------
   Sidebar widgets (Appearance > Widgets)
   Apple-Weather-inspired cards with:
   - Day/night background based on SunCalc
   - Weather overlay layer (rain/snow/etc) based on forecast/conditions
   ------------------------------------------------- */

.taw-widget {
  margin: 0 0 16px 0;
}

.taw-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 14px 16px;
  color: #fff;
  background: linear-gradient(135deg, #0b3a67, #08233f);
}

.taw-card > * {
  position: relative;
  z-index: 2;
}

.taw-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.85;
  background: radial-gradient(circle at 10% 15%, rgba(255,255,255,0.22), rgba(255,255,255,0) 45%),
              radial-gradient(circle at 80% 25%, rgba(255,255,255,0.14), rgba(255,255,255,0) 55%);
}

.taw-card::after {
  content: "";
  position: absolute;
  inset: -40%;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background-size: 200px 200px;
}

/* Day/night */
.taw-card.taw-theme-day {
  background: linear-gradient(135deg, #2b8bcb, #0b3a67);
}

.taw-card.taw-theme-night {
  background: linear-gradient(135deg, #081a33, #050b16);
}

/* Weather overlays */
.taw-card.taw-weather-clear::after {
  opacity: 0.08;
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.55), rgba(255,255,255,0) 40%),
                    radial-gradient(circle at 85% 25%, rgba(255,255,255,0.35), rgba(255,255,255,0) 45%);
}

.taw-card.taw-weather-cloudy::after {
  opacity: 0.14;
  background-image: radial-gradient(ellipse at 30% 35%, rgba(255,255,255,0.35), rgba(255,255,255,0) 55%),
                    radial-gradient(ellipse at 70% 40%, rgba(255,255,255,0.25), rgba(255,255,255,0) 60%);
}

.taw-card.taw-weather-rain::after {
  opacity: 0.28;
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,0.40) 0 1px, rgba(255,255,255,0) 1px 10px);
  animation: taw-rain 0.9s linear infinite;
}

@keyframes taw-rain {
  from { background-position: 0 0; }
  to   { background-position: -80px 180px; }
}

.taw-card.taw-weather-snow::after {
  opacity: 0.32;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.85) 0 1px, rgba(255,255,255,0) 2px),
    radial-gradient(circle, rgba(255,255,255,0.65) 0 1px, rgba(255,255,255,0) 2px),
    radial-gradient(circle, rgba(255,255,255,0.55) 0 1px, rgba(255,255,255,0) 2px);
  background-size: 120px 120px, 180px 180px, 220px 220px;
  animation: taw-snow 5s linear infinite;
}

@keyframes taw-snow {
  from { background-position: 0 -120px, 40px -180px, 80px -220px; }
  to   { background-position: 0 240px, 40px 300px, 80px 340px; }
}

.taw-card.taw-weather-thunder::after {
  opacity: 0.16;
  background-image: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0) 60%),
                    radial-gradient(circle at 70% 30%, rgba(255,255,255,0.30), rgba(255,255,255,0) 55%);
  animation: taw-flash 4s ease-in-out infinite;
}

@keyframes taw-flash {
  0%, 92%, 100% { opacity: 0.12; }
  94% { opacity: 0.22; }
  96% { opacity: 0.12; }
  98% { opacity: 0.20; }
}

.taw-card.taw-weather-fog::after {
  opacity: 0.18;
  background-image: linear-gradient(0deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 60%);
}

.taw-card.taw-weather-windy::after {
  opacity: 0.14;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.25) 0 2px, rgba(255,255,255,0) 2px 14px);
  animation: taw-wind 2.4s linear infinite;
}

@keyframes taw-wind {
  from { background-position: 0 0; }
  to   { background-position: 0 200px; }
}

/* Layout */
.taw-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.taw-w-location {
  font-weight: 700;
  letter-spacing: 0.2px;
  opacity: 0.95;
}

.taw-w-date {
  text-align: right;
  opacity: 0.9;
  font-size: 0.9em;
}

.taw-w-time {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.taw-w-powered {
  margin-top: 10px;
  font-size: 0.78em;
  opacity: 0.85;
}

.taw-w-powered a {
  color: rgba(255,255,255,0.92);
  text-decoration: none;
}

.taw-w-powered a:hover,
.taw-w-powered a:focus {
  text-decoration: underline;
}

.taw-card-summary .taw-w-temp {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  margin-top: 10px;
}

.taw-w-desc {
  opacity: 0.92;
  margin-top: 2px;
}

.taw-w-feels {
  opacity: 0.92;
  margin-top: 4px;
}

.taw-w-hilo {
  opacity: 0.92;
  margin-top: 2px;
}

.taw-w-forecast {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  overflow-x: auto;
  padding-bottom: 6px;
}

.taw-mini-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 48px;
}

.taw-mini-day-label {
  font-size: 0.75em;
  opacity: 0.92;
}

.taw-mini-day i.wi {
  font-size: 1.25em;
}

.taw-mini-day-temps {
  font-size: 0.75em;
  opacity: 0.95;
  font-variant-numeric: tabular-nums;
}

/* Clock widget (weather-forward: temperature is the hero, time is included in the header) */
.taw-card-clock .taw-w-temp {
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
  margin-top: 10px;
}

.taw-card-clock .taw-w-time {
  font-size: 0.95em;
  opacity: 0.95;
}

/* Compact widget */
.taw-card-compact .taw-w-temp {
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1;
  margin-top: 8px;
}

.taw-card-compact .taw-w-forecast {
  margin-top: 10px;
}

/* ----------------------------
   Weather alerts (NWS)
---------------------------- */

.taw-alerts {
  margin: 12px 0;
}

/* When used on the main [weather] shortcode, we hide the block until alerts exist. */
.taw-alerts[data-taw-alert-hide-empty="1"] {
  display: none;
}

.taw-alerts__status,
.taw-alerts__empty,
.taw-alerts__error {
  border: 1px solid #ddd;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff;
}

.taw-alerts .taw-alert {
  border: 1px solid #ddd;
  border-left: 6px solid #999;
  padding: 10px 12px;
  margin: 12px 0;
  border-radius: 6px;
  background: #fff;
}

.taw-alerts .taw-alert.taw-sev-extreme { border-left-color: #4a148c; }
.taw-alerts .taw-alert.taw-sev-severe { border-left-color: #b71c1c; }
.taw-alerts .taw-alert.taw-sev-moderate { border-left-color: #e65100; }
.taw-alerts .taw-alert.taw-sev-minor { border-left-color: #33691e; }

.taw-alert__title {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.taw-alert__headline {
  margin: 0.35rem 0;
  font-weight: 600;
}

.taw-alert__meta {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

.taw-alerts-widget .taw-w-powered {
  margin-top: 8px;
  font-size: 0.78em;
  opacity: 0.8;
}

.taw-alerts-widget .taw-w-powered a {
  color: #555;
}

/* Sticky banner (optional) */
#taw-alert-banner {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: #b71c1c;
  color: #fff;
  padding: 10px 14px;
  font-weight: 600;
  display: none;
  gap: 10px;
  align-items: center;
}

#taw-alert-banner.taw-sev-severe { background: #b71c1c; }
#taw-alert-banner.taw-sev-extreme { background: #4a148c; }
#taw-alert-banner.taw-sev-moderate { background: #e65100; }
#taw-alert-banner.taw-sev-minor { background: #33691e; }

#taw-alert-banner .taw-close {
  margin-left: auto;
  cursor: pointer;
  font-weight: 700;
  opacity: 0.9;
}
