/* ═══ UI ENHANCEMENTS — Premium Polish Layer ═══
   Additional visual refinements on top of base styles.
   Adds glassmorphism, micro-animations, improved cards, 
   better dashboard visuals, and ambient effects.
*/

/* ── Ambient Background Gradient (body) ─────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(56, 189, 248, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(52, 211, 153, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(167, 139, 250, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

/* ── Hero Enhancements ─────────────────────────────────────────── */
.hero-content {
  animation: heroEntrance 1s ease-out;
}
@keyframes heroEntrance {
  from { opacity: 0; transform: translateY(30px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.hero-badge {
  animation: badgeSlide 0.8s 0.3s ease backwards;
}
@keyframes badgeSlide {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-title {
  text-shadow: 0 0 60px rgba(56, 189, 248, 0.15);
}
.hero-subtitle {
  animation: heroEntrance 1s 0.2s ease-out backwards;
}
.hero-features {
  animation: heroEntrance 1s 0.4s ease-out backwards;
}
.hero-buttons-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  animation: heroEntrance 1s 0.3s ease-out backwards;
}

/* ── Feature Chips Animation ───────────────────────────────────── */
.feature-chip {
  transition: var(--transition);
}
.feature-chip:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.15);
}

/* ── Enhanced Cards with Glow Borders ──────────────────────────── */
.card {
  position: relative;
  overflow: hidden;
  transition: border-color 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.card:hover::before {
  opacity: 1;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(56, 189, 248, 0.1);
}

/* ── Card Entrance Animations ──────────────────────────────────── */
.dashboard.visible .card {
  animation: cardSlideIn 0.6s ease backwards;
}
.dashboard.visible .card:nth-child(1) { animation-delay: 0.1s; }
.dashboard.visible .card:nth-child(2) { animation-delay: 0.2s; }
.dashboard.visible .card:nth-child(3) { animation-delay: 0.3s; }
.dashboard.visible .card:nth-child(4) { animation-delay: 0.4s; }
.dashboard.visible .card:nth-child(5) { animation-delay: 0.5s; }
@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Satellite Card Enhancements ───────────────────────────────── */
.card-satellite {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.8), rgba(10, 14, 23, 0.9));
}
.satellite-image-wrapper {
  position: relative;
  overflow: hidden;
}
.satellite-image-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.satellite-img {
  transition: transform 8s ease;
}
.card-satellite:hover .satellite-img {
  transform: scale(1.05);
}

/* ── Land Cover Bar Enhancement ────────────────────────────────── */
.land-cover-bar > div {
  position: relative;
  overflow: hidden;
}
.land-cover-bar > div::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 40%, rgba(255, 255, 255, 0.15) 50%, transparent 60%);
  animation: shimmerBar 3s ease-in-out infinite;
}
@keyframes shimmerBar {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* ── Weather Tile Enhancements ─────────────────────────────────── */
.weather-tile {
  position: relative;
  overflow: hidden;
}
.weather-tile::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(transparent, rgba(56, 189, 248, 0.03), transparent 30%);
  animation: tileGlow 6s linear infinite;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.weather-tile:hover::before {
  opacity: 1;
}
@keyframes tileGlow {
  to { transform: rotate(360deg); }
}
.weather-tile .wt-value {
  transition: transform 0.3s ease;
}
.weather-tile:hover .wt-value {
  transform: scale(1.08);
}

/* ── Emitter Table Enhancements ────────────────────────────────── */
.card-emitters table tbody tr {
  transition: background 0.3s ease, transform 0.3s ease;
}
.card-emitters table tbody tr:hover {
  background: rgba(56, 189, 248, 0.04);
}
.card-emitters table tbody tr:hover td:last-child {
  color: var(--red);
  font-weight: 600;
}

/* ── Action Card Enhancements ──────────────────────────────────── */
.action-card {
  position: relative;
}
.action-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, transparent 40%, rgba(56, 189, 248, 0.08) 50%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}
.action-card:hover::after {
  opacity: 1;
}

/* ── Confidence Tag Animation ──────────────────────────────────── */
.confidence-tag {
  transition: var(--transition);
}
.confidence-tag[data-level="high"] {
  animation: confidencePulse 3s ease-in-out infinite;
}
@keyframes confidencePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.2); }
  50% { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.05); }
}

/* ── Meta Tags Enhancement ─────────────────────────────────────── */
.meta-tag {
  transition: var(--transition);
}
.meta-tag:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}

/* ── Dashboard Header Enhancement ──────────────────────────────── */
.dashboard-header {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Source Tags Enhancement ───────────────────────────────────── */
.source-tag {
  position: relative;
  overflow: hidden;
}
.source-tag::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.1), transparent);
  transition: left 0.5s ease;
}
.source-tag:hover::before {
  left: 100%;
}

/* ── Scrollbar Styling ─────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.25);
}

/* ── Selection Color ───────────────────────────────────────────── */
::selection {
  background: rgba(56, 189, 248, 0.3);
  color: var(--text-primary);
}

/* ── Loading Section Enhancement ───────────────────────────────── */
.loading-section {
  position: relative;
}
.loading-section::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  filter: blur(60px);
  animation: glowPulse 4s ease-in-out infinite alternate;
  pointer-events: none;
}

/* ── Map Section Enhancement ───────────────────────────────────── */
.map-wrapper {
  transition: box-shadow 0.4s ease;
}
.map-wrapper:hover {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(56, 189, 248, 0.15);
}

/* ── Button Micro Interactions ─────────────────────────────────── */
.btn-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}
.btn-primary:active::after {
  width: 300px;
  height: 300px;
}

.btn-secondary {
  position: relative;
  overflow: hidden;
}
.btn-secondary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(56, 189, 248, 0.05) 50%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.btn-secondary:hover::after {
  opacity: 1;
}

/* ── Footer Enhancement ────────────────────────────────────────── */
.footer {
  position: relative;
  overflow: hidden;
}
.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
}

/* ── Dashboard Grid Top Responsive Fix ─────────────────────────── */
@media (min-width: 769px) {
  .dashboard-grid-top {
    align-items: stretch;
  }
  .dashboard-grid-top > .card {
    display: flex;
    flex-direction: column;
  }
  .dashboard-grid-top > .card > .weather-grid {
    flex: 1;
  }
}

/* ── Tooltip-style Coordinate Display ──────────────────────────── */
.coord-display {
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.coord-display:not(.hidden) {
  animation: coordPopIn 0.4s ease;
}
@keyframes coordPopIn {
  from { opacity: 0; transform: scale(0.9) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Responsible AI Card Enhancement ───────────────────────────── */
.card-responsible {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.6), rgba(10, 14, 23, 0.8));
  border-color: rgba(52, 211, 153, 0.12);
}
.card-responsible:hover {
  border-color: rgba(52, 211, 153, 0.25);
}

/* ── Notable Features Tags Enhancement ─────────────────────────── */
.notable-features .tag {
  transition: var(--transition);
  cursor: default;
}
.notable-features .tag:hover {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.25), rgba(56, 189, 248, 0.25));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(167, 139, 250, 0.2);
}

/* ── Errors Banner Enhancement ─────────────────────────────────── */
.errors-banner {
  animation: errorShake 0.5s ease;
}
@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

/* ── Time Warning Modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
}
.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.modal-content {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.95), rgba(10, 14, 23, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md, 12px);
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(56, 189, 248, 0.1);
  transform: translateY(0);
  transition: transform 0.3s ease;
}
.modal-overlay.hidden .modal-content {
  transform: translateY(20px);
}
.modal-header h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  margin-bottom: 1rem;
}
.modal-body p {
  color: var(--text-secondary);
  line-height: 1.6;
}
.reasons-list {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.reasons-list li {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 0.95rem;
}
.reasons-list li strong {
  color: var(--text-primary);
}
