/* ============================================================
   Disaster Management System — Core Theme & Utilities
   Tailwind handles most styling via CDN. This file holds the
   design tokens, glassmorphism, animations and a few helpers
   that are awkward to express as inline utility classes.
   ============================================================ */

:root {
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --success:   #10b981;
  --info:      #06b6d4;
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  margin: 0;
  min-height: 100vh;
  /* Subtle premium gradient (layers over Tailwind's bg-color) */
  background-image:
    radial-gradient(1100px 600px at 15% -10%, rgba(37,99,235,.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(6,182,212,.08), transparent 55%);
  background-attachment: fixed;
  transition: background-color .3s ease, color .3s ease;
}
html.dark body {
  background-image:
    radial-gradient(1100px 600px at 15% -10%, rgba(37,99,235,.16), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(6,182,212,.10), transparent 55%);
}

/* Smooth theme transition for surfaces */
.glass, .glass-strong, .qa-btn, .field, .nav-link, .mnav, .skill-chip {
  transition: background-color .3s ease, border-color .3s ease, color .3s ease, box-shadow .3s ease;
}

/* ---------- Loader (index.html) ---------- */
.app-loader {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1rem;
  background: linear-gradient(135deg, #1e3a8a, #0f172a);
  color: #fff; z-index: 9999;
}
.app-loader .spinner {
  width: 56px; height: 56px;
  border: 4px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 28px -16px rgba(15, 23, 42, 0.25);
}
.dark .glass {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.7);
}
.glass-strong {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.28);
}
.dark .glass-strong {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 34px -18px rgba(0, 0, 0, 0.8);
}

/* ---------- Section transitions ---------- */
.view { display: none; animation: fadeInUp .45s ease both; }
.view.active { display: block; }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  70%  { box-shadow: 0 0 0 24px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-10px); }
}
@keyframes shimmer {
  0% { background-position: -468px 0; }
  100% { background-position: 468px 0; }
}

.animate-fade-in { animation: fadeIn .5s ease both; }
.animate-slide-in { animation: slideInRight .4s ease both; }
.float { animation: float 5s ease-in-out infinite; }

/* staggered children */
.stagger > * { opacity: 0; animation: fadeInUp .5s ease forwards; }
.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .12s; }
.stagger > *:nth-child(3) { animation-delay: .19s; }
.stagger > *:nth-child(4) { animation-delay: .26s; }
.stagger > *:nth-child(5) { animation-delay: .33s; }
.stagger > *:nth-child(6) { animation-delay: .40s; }

/* ---------- SOS pulsing button ---------- */
.sos-pulse { animation: pulseRing 2s infinite; }

/* ---------- Card hover lift ---------- */
.lift { transition: transform .25s ease, box-shadow .25s ease; }
.lift:hover { transform: translateY(-6px); box-shadow: 0 22px 40px -18px rgba(0,0,0,.35); }

/* ---------- Toast notifications ---------- */
#toastHost {
  position: fixed; top: 1.25rem; right: 1.25rem;
  z-index: 9999; display: flex; flex-direction: column; gap: .6rem;
  max-width: calc(100vw - 2.5rem);
}
.toast {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .85rem 1rem; border-radius: .85rem; color: #fff;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.4);
  animation: slideInRight .3s ease both;
  min-width: 260px;
}
.toast.success { background: linear-gradient(135deg,#10b981,#059669); }
.toast.error   { background: linear-gradient(135deg,#ef4444,#dc2626); }
.toast.info    { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.toast.warning { background: linear-gradient(135deg,#f59e0b,#d97706); }

/* ---------- Custom scrollbar ---------- */
.scroll-thin::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-thin::-webkit-scrollbar-thumb { background: rgba(100,116,139,.45); border-radius: 99px; }
.scroll-thin::-webkit-scrollbar-track { background: transparent; }

/* ---------- Leaflet dark tweak ---------- */
.leaflet-container { border-radius: 1rem; font-family: inherit; }
.dark .leaflet-tile { filter: brightness(.82) contrast(1.05); }
.dark .leaflet-popup-content-wrapper,
.dark .leaflet-popup-tip { background: #1e293b; color: #e2e8f0; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.dark .leaflet-container a.leaflet-popup-close-button { color: #94a3b8; }
.dark .leaflet-bar a { background: #1e293b; color: #e2e8f0; border-color: rgba(255,255,255,.1); }
.dark .leaflet-bar a:hover { background: #334155; }

/* ---------- Native dropdown / form niceties ---------- */
.dark .field { color-scheme: dark; }
.dark select.field option { background: #1e293b; color: #e2e8f0; }
.field::placeholder { color: #94a3b8; }
.dark .field::placeholder { color: #64748b; }

/* Crisper focus rings for accessibility (both modes) */
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: .35rem; }
.field:focus-visible { outline: none; }

/* ---------- Skeleton shimmer ---------- */
.skeleton {
  background: #e2e8f0;
  background-image: linear-gradient(90deg,#e2e8f0 0px,#f1f5f9 40px,#e2e8f0 80px);
  background-size: 600px;
  animation: shimmer 1.4s infinite linear;
  border-radius: .5rem;
}
.dark .skeleton {
  background: #1e293b;
  background-image: linear-gradient(90deg,#1e293b 0px,#334155 40px,#1e293b 80px);
}

/* ---------- Nav link active state ---------- */
.nav-link { cursor: pointer; color: inherit; }
.nav-link.active {
  background: var(--brand-600);
  color: #fff !important;
}
.nav-link.active i { opacity: 1 !important; }
.mnav { cursor: pointer; color: inherit; }
.mnav.active { background: rgba(37,99,235,.12); color: var(--brand-700); }
.dark .mnav.active { color: #93c5fd; }

/* ---------- Quick action buttons ---------- */
.qa-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem 1rem; border-radius: .85rem;
  font-size: .875rem; font-weight: 600;
  border: 1px solid rgba(148,163,184,.4);
  background: rgba(255,255,255,.7);
  color: #1e293b;
  transition: all .2s ease;
}
.qa-btn:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 8px 18px -8px rgba(0,0,0,.3); }
.dark .qa-btn { background: rgba(255,255,255,.06); color: #e2e8f0; border-color: rgba(255,255,255,.12); }
.dark .qa-btn:hover { background: rgba(255,255,255,.12); }

/* ---------- Form controls ---------- */
.field {
  width: 100%; padding: .7rem .9rem; border-radius: .8rem;
  background: rgba(255,255,255,.8);
  border: 1px solid rgba(148,163,184,.4);
  color: #0f172a; font-size: .9rem;
  transition: border-color .2s, box-shadow .2s;
}
.field:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--shadow-glow, 0 0 0 3px rgba(37,99,235,.22)); }
.dark .field { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); color: #f1f5f9; }
.field-label { display:block; font-size:.8rem; font-weight:600; margin-bottom:.35rem; color:#475569; }
.dark .field-label { color:#cbd5e1; }

/* ---------- Resource filter active ---------- */
.res-filter.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }

/* ---------- Map layer toggles ---------- */
.map-layer { opacity: .45; }
.map-layer.active { opacity: 1; }
.map-layer.active { box-shadow: inset 0 0 0 1.5px var(--brand-500); }

/* ---------- Skill chips ---------- */
.skill-chip {
  cursor: pointer; user-select: none;
  padding: .4rem .85rem; border-radius: 99px;
  font-size: .8rem; font-weight: 600;
  border: 1px solid rgba(148,163,184,.4);
  background: rgba(255,255,255,.6);
  color: #475569; transition: all .15s ease;
}
.skill-chip:hover { border-color: var(--brand-500); }
.skill-chip.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.dark .skill-chip { background: rgba(255,255,255,.05); color: #cbd5e1; border-color: rgba(255,255,255,.12); }
.dark .skill-chip.active { background: var(--brand-600); color: #fff; }

/* ---------- Range slider ---------- */
input[type=range].sev-range { accent-color: var(--brand-600); }

/* ---------- Google Translate widget styling ---------- */
/* Hide the top banner / iframe Google injects and keep layout fixed */
.goog-te-banner-frame,
.skiptranslate iframe { display: none !important; }
body { top: 0 !important; }

.gt-wrap { display: flex; align-items: center; height: 100%; }
.gt-wrap .goog-te-gadget {
  font-size: 0 !important;          /* hide "Powered by Google" text */
  line-height: 0 !important;
  color: transparent !important;
  height: 100%;
  display: flex;
  align-items: center;
}
.gt-wrap .goog-te-gadget > span { display: none !important; }  /* kill stray "Powered by" span */
.gt-wrap .goog-te-combo {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  box-sizing: border-box !important;
  height: 2.5rem !important;        /* match 40px navbar buttons */
  margin: 0 !important;
  padding: 0 2rem 0 2.1rem !important;  /* room for the language + chevron icons */
  border-radius: .8rem !important;
  border: 1px solid rgba(148,163,184,.4) !important;
  background: rgba(255,255,255,.7) !important;
  color: #1e293b !important;
  font-size: .8rem !important;
  font-weight: 600 !important;
  font-family: 'Inter', sans-serif !important;
  line-height: normal !important;
  text-decoration: none !important;
  cursor: pointer !important;
  outline: none !important;
  width: 8.75rem !important;
  vertical-align: middle !important;
  transition: border-color .2s, background .2s;
}
.gt-wrap .goog-te-combo:hover { border-color: var(--brand-500) !important; background: rgba(255,255,255,.95) !important; }
.dark .gt-wrap .goog-te-combo {
  background: rgba(255,255,255,.06) !important;
  color: #e2e8f0 !important;
  border-color: rgba(255,255,255,.12) !important;
}
.dark .gt-wrap .goog-te-combo:hover { background: rgba(255,255,255,.12) !important; }
.gt-wrap .goog-te-combo option { color: #1e293b; }

/* Mobile translate row: let the combo size naturally */
#google_translate_element_mobile .goog-te-combo { width: 13rem !important; }

/* Remove the highlight box / underline Google adds over translated text */
.goog-text-highlight { background: none !important; box-shadow: none !important; }
.gt-wrap img.goog-te-gadget-icon, .goog-logo-link, .goog-te-gadget-simple img { display: none !important; }
font[style] { background: transparent !important; box-shadow: none !important; }

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
