/* ==========================================================
   AFS Capital Group — Custom CSS
   Lightweight enhancements on top of TailwindCSS.
   ========================================================== */

:root {
  --brand: #0A2540;
  --brand-dark: #08203A;
  --gold: #E6B31E;
  --gold-dark: #C99815;
}

html { scroll-behavior: smooth; }

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle fade-in for content */
@keyframes afs-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: afs-fade-up 0.4s ease-out both; }

/* Form inputs: focus ring polish */
input:focus, textarea:focus, select:focus {
  box-shadow: 0 0 0 3px rgba(10, 37, 64, 0.15);
}
.dark input:focus, .dark textarea:focus, .dark select:focus {
  box-shadow: 0 0 0 3px rgba(230, 179, 30, 0.25);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.dark ::-webkit-scrollbar-track { background: #0f172a; }
.dark ::-webkit-scrollbar-thumb { background: #334155; }
.dark ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Smoother color-scheme transition on theme toggle */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition: background-color 250ms ease, border-color 250ms ease, color 250ms ease, fill 250ms ease, stroke 250ms ease !important;
  transition-delay: 0 !important;
}

/* Leaflet map: subtly tone down tiles in dark mode */
.dark .leaflet-tile-pane {
  filter: brightness(0.75) saturate(0.85) hue-rotate(-10deg);
}
.dark .leaflet-container {
  background: #0f172a !important;
}
.dark .leaflet-popup-content-wrapper,
.dark .leaflet-popup-tip {
  background: #1e293b !important;
  color: #e2e8f0 !important;
}
.dark .leaflet-control-attribution {
  background: rgba(15, 23, 42, 0.85) !important;
  color: #94a3b8 !important;
}
.dark .leaflet-control-attribution a { color: #cbd5e1 !important; }

/* Loading spinner */
.afs-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: afs-spin 0.8s linear infinite;
}
@keyframes afs-spin { to { transform: rotate(360deg); } }

/* Map container fix */
#afs-map {
  position: relative;
  z-index: 0;
}

/* LiveChat widget — keep above page content, clear mobile nav / theme toggle */
#chat-widget-container,
iframe#chat-widget,
div[data-testid="widget-button"],
#lc_chat_layout {
  z-index: 9999 !important;
}
@media (max-width: 640px) {
  #chat-widget-container {
    bottom: max(1rem, env(safe-area-inset-bottom)) !important;
    right: max(0.75rem, env(safe-area-inset-right)) !important;
  }
}

/* Print friendliness for application view */
@media print {
  aside, nav, header, footer, button, form { display: none !important; }
  main { margin-left: 0 !important; }
}
