/* ============================================================
   Decision Atlas — Custom Styles (Tailwind overrides)
   ============================================================ */

/* ---------- Base ---------- */

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #0a0e1a;
  color: #e2e8f0;
}

/* ---------- Selection ---------- */

::selection {
  background-color: rgba(59, 130, 246, 0.3);
  color: #fff;
}

/* ---------- Scrollbar ---------- */

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #0f1629;
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* ---------- Grid pattern background (blue tint) ---------- */

.bg-grid {
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ---------- Glow effects (blue) ---------- */

.glow-blue {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.15),
              0 0 60px rgba(59, 130, 246, 0.05);
}

.glow-blue-strong {
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.25),
              0 0 80px rgba(59, 130, 246, 0.1);
}

/* ---------- Hero gradient ---------- */

.hero-gradient {
  background: linear-gradient(
    135deg,
    #0a0e1a 0%,
    #111827 40%,
    #0f172a 70%,
    #0a0e1a 100%
  );
}

/* ---------- Map container ---------- */

#atlas-map {
  height: 500px;
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid rgba(59, 130, 246, 0.2);
  overflow: hidden;
  background-color: #0f1629;
}

@media (min-width: 768px) {
  #atlas-map {
    height: 600px;
  }
}

/* ---------- Leaflet dark theme overrides ---------- */

.leaflet-container {
  background-color: #0f1629;
}

.leaflet-tile-pane {
  filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7);
}

.leaflet-control-zoom a {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
.leaflet-control-zoom a:hover {
  background-color: #334155 !important;
}

.leaflet-control-attribution {
  background-color: rgba(15, 22, 41, 0.8) !important;
  color: #64748b !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a {
  color: #64748b !important;
}

.leaflet-popup-content-wrapper {
  background-color: #1e293b;
  color: #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.leaflet-popup-tip {
  background-color: #1e293b;
}

.leaflet-popup-close-button {
  color: #94a3b8 !important;
}
.leaflet-popup-close-button:hover {
  color: #e2e8f0 !important;
}

/* ---------- Category tabs ---------- */

.category-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #94a3b8;
  background-color: rgba(30, 41, 59, 0.5);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.category-tab:hover {
  color: #e2e8f0;
  background-color: rgba(30, 41, 59, 0.8);
  border-color: rgba(59, 130, 246, 0.2);
}

.category-tab.active {
  color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.1);
}

.category-tab svg {
  width: 1rem;
  height: 1rem;
}

/* ---------- Score badges ---------- */

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1;
}

.score-high {
  background-color: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.score-mid {
  background-color: rgba(250, 204, 21, 0.15);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.score-low {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ---------- Ranking items ---------- */

.ranking-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background-color: rgba(30, 41, 59, 0.3);
  border: 1px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}

.ranking-item:hover {
  background-color: rgba(30, 41, 59, 0.6);
  border-color: rgba(59, 130, 246, 0.2);
  transform: translateX(4px);
}

.ranking-item .rank-number {
  font-size: 0.875rem;
  font-weight: 700;
  color: #64748b;
  min-width: 1.5rem;
  text-align: center;
}

.ranking-item:nth-child(1) .rank-number { color: #facc15; }
.ranking-item:nth-child(2) .rank-number { color: #cbd5e1; }
.ranking-item:nth-child(3) .rank-number { color: #cd7f32; }

/* ---------- Atlas tooltip (Leaflet) ---------- */

.atlas-tooltip {
  background-color: #1e293b;
  color: #e2e8f0;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-family: 'Inter', system-ui, sans-serif;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.atlas-tooltip::before {
  border-top-color: #1e293b;
}

.leaflet-tooltip.atlas-tooltip {
  background-color: #1e293b;
  border-color: rgba(59, 130, 246, 0.3);
  color: #e2e8f0;
}

.leaflet-tooltip-top.atlas-tooltip::before {
  border-top-color: rgba(59, 130, 246, 0.3);
}

.leaflet-tooltip-bottom.atlas-tooltip::before {
  border-bottom-color: rgba(59, 130, 246, 0.3);
}

/* ---------- Loading spinner (blue) ---------- */

.spinner {
  border: 3px solid rgba(59, 130, 246, 0.15);
  border-top-color: #3b82f6;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Pulse animation ---------- */

@keyframes pulse-blue {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.pulse-blue {
  animation: pulse-blue 2s ease-in-out infinite;
}

/* ---------- Country card hover ---------- */

.country-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.country-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.12),
              0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ---------- Compare table ---------- */

.compare-table th {
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #1e293b;
}

.compare-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
  font-size: 0.875rem;
}

.compare-table tr:hover td {
  background-color: rgba(30, 41, 59, 0.3);
}

/* ---------- Preview fade overlay ---------- */

.preview-fade {
  position: relative;
}
.preview-fade::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(
    to bottom,
    transparent,
    #0f1629
  );
  pointer-events: none;
}
