:root {
  /* Colors */
  --txuri-blue: #003DA5;
  --txuri-white: #FFFFFF;
  --dark-bg: #000c24;
  --card-bg: rgba(255, 255, 255, 0.05);
  --accent-blue: #4A90D9;
  --gold: #FFD700;
  --silver: #C0C0C0;
  --bronze: #CD7F32;
  
  /* Fonts */
  --font-main: 'Inter', sans-serif;
  --font-heading: 'Outfit', sans-serif;
  
  /* Layout */
  --nav-width: 110px; /* Increased from 80 */
  --header-height: auto;
  --ticker-height: 40px;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--dark-bg);
  color: var(--txuri-white);
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* Noise & Atmosphere */
.noise-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0.01; /* Minimal noise */
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

body::before {
  display: none; /* Removed as it was darkening the interface */
}

/* Navigation Sidebar */
.nav-footer {
  margin-bottom: auto; /* Push it up */
  padding-bottom: 2rem;
  order: -1; /* Move to top if flex container allows */
}

/* Redefine main-nav slightly to pull footer logic up */
.main-nav {
  width: var(--nav-width);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 0.5rem; /* Better breathing room */
  z-index: 2000; /* Sidebar on top */
  transition: width 0.3s ease;
}

.nav-brand {
  margin-bottom: 1rem;
  font-size: 2rem;
  order: 1;
}

.nav-links {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  order: 2;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 0.8rem 0;
  transition: all 0.3s;
  position: relative;
  opacity: 0.6;
}

.nav-item:hover, .nav-item.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  left: 5px; top: 15%; width: 4px; height: 70%;
  background: var(--txuri-blue);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--txuri-blue);
}

.nav-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.nav-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
}

.nav-footer {
  margin-top: auto;
}

.lang-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 4px 8px;
  font-size: 0.7rem;
  border-radius: 4px;
  cursor: pointer;
}

/* Content Area */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* App Header */
.app-header {
  height: auto;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: row; /* Title left, Stats right */
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 12, 36, 0.8);
  border-bottom: 2px solid rgba(255, 255, 255, 0.05);
  z-index: 1000;
  position: relative;
  width: 100%;
}

.header-info {
    text-align: left;
    margin-bottom: 0;
}

.app-header h1 {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  letter-spacing: -0.5px;
}

.app-header .subtitle {
  font-size: 0.85rem;
  opacity: 0.6;
  color: #fff;
  margin-top: 5px;
}

.header-stats-bar {
  display: flex;
  gap: 2.5rem;
  padding: 0;
}

.header-stat-box {
  display: flex;
  flex-direction: column; /* Icon top, number mid, label bottom */
  align-items: center;
  text-align: center;
  gap: 0;
  background: rgba(255, 255, 255, 0.05); /* Unified Badge Style */
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  border-radius: 12px;
  min-width: 120px;
}

.stat-icon {
  font-size: 1.1rem;
  margin-bottom: 5px;
  opacity: 0.8;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  line-height: 1.1; /* Separate line feel */
  font-weight: 800;
  color: #fff;
  display: block; /* Ensure separate line */
}

.stat-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 700;
  margin-top: 2px;
}

.stat-name-highlight {
    color: var(--accent-blue);
    font-weight: 700;
}

/* Custom Map Popup Styles */
.custom-popup {
    padding: 10px;
    font-family: var(--font-main);
    color: #333;
}

.custom-popup h4 {
    font-family: var(--font-heading);
    color: #00122e;
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--txuri-blue);
    display: inline-block;
}

.popup-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.popup-row span {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.popup-msg {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-style: italic;
    color: #666;
    display: flex;
    gap: 8px;
}

.leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
}

.header-stat-box.highlight {
    border-color: var(--accent-blue);
    background: rgba(74, 144, 217, 0.1);
}

/* View Panels */
.view-panel {
  display: none;
  flex: 1;
  width: 100%;
  position: relative;
  overflow-y: auto;
  padding: 1rem 2rem;
  padding-bottom: 100px; /* footer space */
  animation: fadeIn 0.4s ease-out;
}

.view-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Map specific override */
#view-map {
  padding: 0;
  overflow: hidden;
  background: #f4f4f4; /* Light background behind map */
}

#map {
  width: 100%;
  height: 100%;
  background-color: #060606; /* Solid dark base to fill gaps */
}

/* Fix for systematic horizontal/vertical lines (tile seams) */
.leaflet-tile {
  box-shadow: 0 0 1px 1px #060606;
}

.leaflet-tile-container img {
  outline: 1px solid transparent;
}

.map-hud-filters {
    margin-left: 20px;
    bottom: 12rem !important; /* Move higher to safely clear the ticker */
    padding: 12px 18px !important;
    background: rgba(0, 12, 36, 0.9) !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important;
    z-index: 500;
}

.map-glow-flight {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.9));
}

/* FAB */
.fab {
  position: absolute;
  bottom: 8.5rem; /* Raised higher from 6rem */
  right: 2rem;
  background: var(--txuri-blue);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 15px 35px rgba(0, 61, 165, 0.4);
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.fab:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 45px rgba(0, 61, 165, 0.6);
}

/* Board View */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-family: var(--font-heading);
  font-size: 3rem;
  text-transform: uppercase;
}

.board-filters {
  display: flex;
  gap: 1rem;
}

.board-filters input, .board-filters select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  outline: none;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Cards */
.glass-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-5px);
}

.btn-cta {
    display: inline-block;
    background: var(--txuri-blue);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.btn-cta:hover {
    background: #002d7a;
    transform: scale(1.05);
}

.card-transport-icon {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 1.3rem; /* Slightly smaller to fit multiple */
  opacity: 0.8; /* More visible */
  display: flex;
  gap: 5px;
}

.card-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  padding-right: 60px; /* Room for icons */
}

.card-route-full {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-bottom: 1rem;
  line-height: 1.4;
  font-style: italic;
  color: var(--accent-blue);
}

.card-distance {
  display: inline-block;
  background: rgba(74, 144, 217, 0.15);
  color: var(--accent-blue);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.card-message {
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  opacity: 0.5;
}

/* Medals */
.medal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  margin-right: 4px;
  font-size: 0.8rem;
}

/* Leaderboard */
.leaderboard-container {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2rem;
}

.leader-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 1rem;
}

.tab-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.6;
}

.tab-btn.active {
  background: var(--txuri-blue);
  border-color: var(--txuri-blue);
  opacity: 1;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: grid;
  grid-template-columns: 40px 1fr 100px;
  align-items: center;
  padding: 8px 12px; /* Condensed */
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  font-size: 0.85rem; /* Smaller */
}

.ranking-item.top-1 { border-left: 4px solid var(--gold); background: rgba(255, 215, 0, 0.05); }
.ranking-item.top-2 { border-left: 4px solid var(--silver); background: rgba(192, 192, 192, 0.05); }
.ranking-item.top-3 { border-left: 4px solid var(--bronze); background: rgba(205, 127, 50, 0.05); }

.rank-num { font-family: var(--font-heading); font-size: 1.2rem; opacity: 0.5; }
.top-1 .rank-num { color: var(--gold); opacity: 1; }

.medal-stat-box.highlight {
    border-color: var(--accent-blue);
    background: rgba(74, 144, 217, 0.1);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(74, 144, 217, 0.3);
}

/* Stats Panel */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.chart-container {
  height: 280px; /* Fixed height for consistency */
  display: flex;
  flex-direction: column;
}

.chart-container canvas {
  flex: 1;
  max-width: 100%;
}

.chart-container.wide {
  grid-column: span 2;
}

/* Live Ticker */
.live-ticker {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--ticker-height);
  background: var(--dark-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 2000;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.ticker-wrapper {
  width: 100%;
  white-space: nowrap;
}

.ticker-content {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 90s linear infinite;
}

.ticker-content:hover {
  animation-play-state: paused;
  cursor: pointer;
}

@keyframes marquee {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-100%, 0); }
}

.ticker-item {
  display: inline-block;
  padding: 0 2rem;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.ticker-item span {
  color: var(--accent-blue);
  margin-right: 8px;
}

/* Modals Refactor */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 5000;
  padding: 1rem;
}

.modal-overlay.active { display: flex; }

.modal-content {
  width: 100%;
  max-width: 500px;
  background: #FFFFFF; /* Back to clear white */
  color: #00122e; /* Dark text */
  border: none;
  border-radius: 20px;
  padding: 2rem; /* Compact padding */
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr; /* Stacked for mobile, but mostly we want it clean */
    gap: 0.8rem;
}

.form-group {
    margin-bottom: 0.7rem; /* Even more condensed */
    position: relative;
    width: 100%;
}

.modal-title {
    color: #003DA5; /* Specific blue from image */
    font-family: var(--font-heading);
    font-size: 1.8rem; /* Epic but fit */
    font-weight: 800;
    margin-bottom: 1rem;
    text-align: left; 
}

/* Scales Entry Row */
.scales-entry-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0.5rem;
}

.scales-entry-row .form-control {
    flex: 1;
}

.btn-action-blue {
    background: #4A90D9;
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.btn-action-blue:hover {
    background: #367cbe;
}

.scales-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.scale-tag {
    background: #eee;
    color: #333;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Transport Grid Redesign */
.transport-selectors.multiselect {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.transport-option {
    background: #FFFFFF;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 1.5rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.transport-option span {
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
}

.transport-option:hover {
    background: #fdfdfd;
    border-color: #bbb;
}

.transport-option.selected {
    border: 2px solid var(--txuri-blue);
    background: #f0f4ff;
}

.transport-option.selected span {
    color: var(--txuri-blue);
}

.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: var(--accent-blue);
    margin-top: 5px;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #333;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 0.85rem;
    color: #444;
}

.form-control {
  width: 100%;
  padding: 0.9rem;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  color: #00122e;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.3s;
}

.form-control:focus {
    border-color: var(--txuri-blue);
    background: #fff;
    outline: none;
}

.transport-option {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    color: #444;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
}

.transport-option:hover {
    background: #e9ecef;
}

.transport-option.selected {
    background: var(--txuri-blue);
    color: white;
    border-color: var(--txuri-blue);
}

.modal-close {
    color: #444;
}

.btn-primary {
  background: linear-gradient(135deg, #003DA5, #4A90D9);
  color: white;
  border: none;
  padding: 1.1rem;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 1px;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  margin-top: 1rem;
  text-transform: uppercase;
  box-shadow: 0 5px 15px rgba(0, 61, 165, 0.3);
  transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 61, 165, 0.4);
}

.btn-ghost {
  background: #f8f9fa;
  border: 1px dashed var(--txuri-blue);
  color: var(--txuri-blue);
  padding: 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  font-weight: 600;
  margin-top: 0.5rem;
}

.btn-ghost:hover {
    background: #e9ecef;
}

.share-card-container {
    max-width: 460px !important;
    max-height: 96vh !important;
    display: flex;
    flex-direction: column;
    padding: 1.2rem 1.5rem !important;
}

.share-formats {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    justify-content: center;
}

.btn-format {
    background: #0A2E6E;
    color: white;
    border: 1.5px solid rgba(255,255,255,0.15);
    padding: 6px 16px;
    border-radius: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-format:hover {
    background: #003DA5;
    border-color: rgba(255,255,255,0.3);
}

.btn-format.active {
    background: #003DA5;
    border-color: #4A90D9;
    box-shadow: 0 0 12px rgba(74,144,217,0.3);
}

.share-preview {
    flex: 1;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #001233;
    border-radius: 12px;
    margin-bottom: 0.8rem;
    min-height: 0; /* Critical: allow flex child to shrink below its content height */
}

#shareCanvas {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.share-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 900px) {
  body { flex-direction: column; }
  
  /* Compact Header */
  .app-header { 
    height: auto; 
    padding: 1rem;
    flex-direction: column; 
    align-items: center; 
    gap: 12px;
    background: rgba(0, 18, 51, 0.95);
    backdrop-filter: blur(10px);
  }
  
  .header-info { text-align: center; }
  .header-info h1 { font-size: 1.5rem; margin-bottom: 2px; }
  .header-info .subtitle { font-size: 0.8rem; }

  /* Compact Stats Bar */
  .header-stats-bar { 
    display: flex !important;
    overflow-x: auto !important;
    width: 100% !important;
    gap: 10px !important;
    padding: 2px 0 10px 0 !important;
    justify-content: flex-start !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .header-stats-bar::-webkit-scrollbar {
    display: none;
  }
  
  .header-stat-box { 
    flex: 0 0 auto !important;
    width: 140px !important;
    padding: 10px 8px !important;
    text-align: center !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border-radius: 8px !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    transform: none !important; /* Remove desktop hover/highlight scale */
  }

  .header-stat-box .stat-icon {
    font-size: 1.2rem !important;
    margin-right: 0 !important;
    margin-bottom: 4px !important;
  }

  .header-stat-box .stat-info {
    text-align: center !important;
  }
  
  .stat-value { font-size: 1.1rem !important; }
  .stat-label { font-size: 0.65rem !important; line-height: 1.1 !important; }
  

  /* Navigation & FAB */
  .main-nav {
    width: 100%;
    height: 65px;
    flex-direction: row;
    position: fixed;
    bottom: var(--ticker-height);
    left: 0;
    padding: 0 0.5rem;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
  }
  
  .nav-links { 
    flex-direction: row; 
    justify-content: space-around; 
    margin-bottom: 0; 
    width: 100%;
  }
  
  .nav-item { padding: 5px; flex: 1; justify-content: center; }
  .nav-label { font-size: 0.65rem; margin-left: 0; margin-top: 4px; display: block; }
  .nav-brand, .nav-footer { display: none; }

  /* Reposition FAB to clear Nav */
  .fab {
    bottom: 110px; /* Above nav bar - Raised from 85px */
    right: 20px;
    padding: 12px 20px;
    font-size: 0.9rem;
    box-shadow: 0 8px 25px rgba(0, 61, 165, 0.6);
  }

  /* Map Controls adjustment */
  .leaflet-bottom.leaflet-left {
    bottom: 85px !important;
  }
  
  .filter-container {
    top: auto;
    bottom: 140px; /* Above FAB */
    left: 10px;
    right: 10px;
    width: calc(100% - 20px);
    padding: 8px;
    background: rgba(0, 18, 51, 0.85);
  }

  .stat-grid { grid-template-columns: 1fr; }
  .chart-container.wide { grid-column: auto; }
  .leaderboard-container { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

.leaflet-tile-container img {
  /* Fix for systematic horizontal/vertical lines in some browsers (tile seams) */
  outline: 1px solid transparent;
}

.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
	transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}

.marker-cluster-small { background-color: rgba(0, 61, 165, 0.6); }
.marker-cluster-small div { background-color: rgba(0, 61, 165, 0.6); color: white; }
.marker-cluster-medium { background-color: rgba(0, 61, 165, 0.8); }
.marker-cluster-medium div { background-color: rgba(0, 61, 165, 0.8); color: white; }
.marker-cluster-large { background-color: rgba(0, 61, 165, 1); }
.marker-cluster-large div { background-color: rgba(0, 61, 165, 1); color: white; }
/* AUTOCOMPLETE SUGGESTIONS */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-results {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: rgba(0, 18, 51, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

.autocomplete-results.active {
    display: block;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #e0e6ed;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
    line-height: 1.4;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: rgba(74, 144, 217, 0.2);
    padding-left: 20px;
}

.autocomplete-item .city-name {
    display: block;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.autocomplete-item .region-name {
    display: block;
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Custom Scrollbar for results */
.autocomplete-results::-webkit-scrollbar {
    width: 6px;
}
.autocomplete-results::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
.autocomplete-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
/* COUNTDOWN WIDGET (Feature 3) */
.countdown-box {
    background: rgba(0, 61, 165, 0.08) !important;
    border: 1px solid rgba(0, 61, 165, 0.2) !important;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 15px !important;
    position: relative;
    overflow: hidden;
}

.countdown-box .stat-label {
    font-size: 0.65rem !important;
    letter-spacing: 0.1em;
    margin-bottom: 5px;
    opacity: 0.6;
}

.countdown-values {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.time-part {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.time-part .val {
    font-family: 'Bebas Neue', cursive;
    font-size: 2.2rem;
    line-height: 1;
    color: #fff;
}

.time-part .unit {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

.countdown-values .sep {
    font-family: 'Bebas Neue', cursive;
    font-size: 1.8rem;
    color: #4A90D9;
    opacity: 0.6;
    margin-bottom: 5px;
}

/* STATES */

/* Urgent (< 24h) */
.countdown-box.urgent {
    background: rgba(0, 61, 165, 0.15) !important;
    border-color: rgba(74, 144, 217, 0.4) !important;
    box-shadow: 0 0 20px rgba(74, 144, 217, 0.1);
    animation: urgent-pulse 2s infinite ease-in-out;
}

@keyframes urgent-pulse {
    0% { border-color: rgba(74, 144, 217, 0.4); }
    50% { border-color: rgba(74, 144, 217, 0.8); }
    100% { border-color: rgba(74, 144, 217, 0.4); }
}

/* Live Match */
.countdown-box.live {
    background: #003da5 !important;
    border-color: #4A90D9 !important;
}

.live-text, .post-text {
    font-family: 'Bebas Neue', cursive;
    font-size: 1.4rem;
    letter-spacing: 0.05em;
    color: #fff;
    text-align: center;
}

.live-text {
    animation: live-blink 1.5s infinite;
}

@keyframes live-blink {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Post Match */
.countdown-box.post {
    background: rgba(0, 18, 51, 0.8) !important;
}

/* RESPONSIVE COUNTDOWN */
@media (max-width: 768px) {
    .header-stats-bar {
        flex-direction: column;
        gap: 10px;
    }
    .countdown-box {
        width: 100%;
        order: -1; /* Always first on mobile */
    }
}

/* REAL-TIME TOASTS (Feature 2) */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    width: 100%;
    max-width: 400px;
    padding: 0 20px;
}

.toast {
    background: rgba(0, 18, 51, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid #4A90D9;
    border-radius: 12px;
    padding: 12px 20px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    position: relative;
    pointer-events: auto;
    transform: translateY(-50px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.toast.hiding {
    transform: translateY(-20px) scale(0.95);
    opacity: 0;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toast-icon {
    font-size: 1.8rem;
}

.toast-text {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #e0e6ed;
}

.toast-text strong {
    color: #fff;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: #4A90D9;
    border-radius: 0 0 0 12px;
    width: 100%;
    animation: toast-progress 4s linear forwards;
}

@keyframes toast-progress {
    from { width: 100%; }
    to { width: 0%; }
}

/* VARIANTS */
.toast.record {
    border-left-color: #F5C842;
}
.toast.record .toast-progress {
    background: #F5C842;
}

.toast.newcountry {
    border-left-color: #4ade80;
}
.toast.newcountry .toast-progress {
    background: #4ade80;
}

/* MOBILE TOASTS */
@media (max-width: 768px) {
    #toast-container {
        top: 10px;
    }
    .toast {
        padding: 10px 15px;
    }
}

/* VIRAL SUCCESS VIEW (Feature 1) */
.success-view {
    text-align: center;
    padding: 20px 10px;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.success-header h2 {
    color: #fff;
    margin-bottom: 5px;
}

.success-header p {
    color: #e0e6ed;
    opacity: 0.8;
}

.share-actions {
    margin-top: 30px;
}

.share-prompt {
    font-size: 0.85rem;
    margin-bottom: 15px;
    color: rgba(255,255,255,0.5);
}

.btn-share {
    width: 100%;
    height: 52px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn-whatsapp {
    background: #25D366;
    color: #fff;
}

.btn-whatsapp:hover {
    background: #20b355;
    transform: translateY(-2px);
}

.btn-stories {
    background: linear-gradient(135deg, #833AB4, #FD1D1D, #F77737);
    color: #fff;
}

.btn-stories:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(234, 44, 120, 0.4);
}

.share-hint {
    font-size: 0.75rem;
    color: #4ade80;
    margin-bottom: 15px;
    animation: flash 1s ease-in-out;
}

@keyframes flash {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 1; }
}

.btn-secondary {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
}
