/* Modernized EDC Styles */

:root {
  /* Colors */
  --primary: #003366;
  --primary-dark: #002244;
  --accent: #007BFF;
  --accent-hover: #0056b3;
  --text-main: #2d3436;
  --text-light: #636e72;
  --bg-body: #ffffff;
  --bg-light: #f8f9fa;
  --white: #ffffff;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --glass-blur: 12px;

  /* Typography */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing */
  --section-padding: 100px 0;
  --transition-speed: 0.4s;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  line-height: 1.7;
  color: var(--text-main);
  background-color: var(--bg-body);
  padding-top: 80px;
  /* space for fixed navbar */
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

main {
  display: block;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Navigation Bar */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 15px 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: all 0.3s ease;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo img {
  max-height: 50px;
  height: auto;
  width: auto;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--primary);
}

.navbar nav ul {
  list-style: none;
  display: flex;
  gap: 30px;
}

.navbar nav ul li a {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
  font-size: 1rem;
  transition: color 0.3s ease;
  position: relative;
}

.navbar nav ul li a:hover {
  color: var(--accent);
}

.navbar nav ul li a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background-color: var(--accent);
  transition: width 0.3s ease;
}

.navbar nav ul li a:hover::after {
  width: 100%;
}

/* Hero Section */
.hero {
  height: 55vh;
  min-height: 380px;
  max-width: 1200px;
  margin: 0 auto;
  background-image: url('images/hero_bg.jpg');
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  margin-top: 20px;
}

.hero.has-slideshow {
  background-image: none !important;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: inherit;
  background-size: cover;
  background-position: center;
  z-index: 0;
  animation: zoomInOut 30s infinite alternate;
}

.hero.has-slideshow::before {
  display: none !important;
}

/* Slideshow Container */
.slideshow-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  /* Changed from -1 to ensure it's visible but behind text */
}

.slideshow-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.slideshow-container img.active {
  opacity: 1;
}

/* Overlay */
.hero-overlay {
  position: relative;
  z-index: 1;
  background: rgba(0, 31, 63, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--white);
  padding: 40px 50px;
  text-align: center;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  max-width: 800px;
  opacity: 0;
  transition: opacity 0.6s ease-out;
}

.hero.hero-loaded .hero-overlay {
  opacity: 1;
  animation: fadeUp 0.8s ease-out;
}

/* Hero loading skeleton */
.hero:not(.hero-loaded)::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  z-index: 2;
  animation: heroSpinner 0.8s linear infinite;
}

@keyframes heroSpinner {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.hero h1 {
  font-size: 2.4rem;
  margin-bottom: 14px;
  letter-spacing: -0.5px;
}

.hero p {
  font-size: 1.15rem;
  font-weight: 300;
  opacity: 0.9;
}

@keyframes zoomInOut {
  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(1.1);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Section Common */
section {
  padding: var(--section-padding);
}

/* Dealers Banner (below hero) */
.dealers-banner {
  background: var(--bg-light);
  padding: 40px 0 30px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dealers-banner h2 {
  font-size: 1.8rem;
  margin-bottom: 10px;
  color: var(--primary);
}

/* Map Section Title (smaller) */
.map-section-title {
  text-align: center;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 2.5rem;
  color: var(--primary);
}

.lead {
  text-align: center;
  margin-bottom: 60px;
  font-size: 1.25rem;
  color: var(--text-light);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* Scroll Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Mission section */
.mission {
  background: var(--bg-light);
}

.cards {
  display: grid;
  gap: 30px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  background: var(--white);
  padding: 40px 30px;
  border-radius: 16px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.1);
}

.card h3 {
  margin-bottom: 15px;
  font-size: 1.4rem;
  color: var(--accent);
}

.card p {
  font-size: 1rem;
  color: var(--text-light);
  line-height: 1.6;
}

/* Presidium */
.presidium {
  background: var(--white);
}

.team-grid {
  display: grid;
  gap: 40px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  justify-items: center;
  margin-top: 40px;
}

@media (min-width: 1024px) {
  .team-grid {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
  }

  .team-grid .team-member {
    flex: 1;
    min-width: 0;
    /* Allow shrinking */
  }

  .team-grid .team-member img {
    width: 160px;
    /* Slightly smaller for single row */
    height: 160px;
    margin-bottom: 15px;
  }
}

.team-member {
  text-align: center;
  transition: transform 0.3s ease;
}

.team-member:hover {
  transform: translateY(-5px);
}

.team-member img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 20px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border: 4px solid var(--white);
}

.team-member h3 {
  margin-bottom: 5px;
  font-size: 1.3rem;
  color: var(--primary);
}

.team-member .role {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 5px;
}

.team-member .country {
  color: var(--text-light);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* News */
.news {
  background: var(--bg-light);
}

.news-grid {
  display: grid;
  gap: 30px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.news-placeholder {
  text-align: center;
  color: var(--text-light);
  font-size: 1.2rem;
}

.news-item {
  background: var(--white);
  border-radius: 16px;
  overflow: visible;
  /* Changed from hidden to allow stamp to pop out slightly */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  position: relative;
  /* For the stamp overlay */
}

.news-item img:first-child:not(.news-stamp) {
  border-radius: 16px 16px 0 0;
}

.news-stamp {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 80px;
  /* Adjusted to take ~1/6 of typical news image area */
  height: auto;
  z-index: 10;
  transform: rotate(-15deg);
  filter: drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.3));
  pointer-events: none;
  animation: stampPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes stampPop {
  0% {
    transform: rotate(-15deg) scale(0);
    opacity: 0;
  }

  100% {
    transform: rotate(-15deg) scale(1);
    opacity: 1;
  }
}

.news-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.news-item img:not(.news-stamp) {
  width: 100%;
  height: 220px;
  object-fit: cover;
  /* Changed from contain to cover for better aesthetics */
  display: block;
}

.news-item h3 {
  padding: 25px 25px 10px;
  font-size: 1.3rem;
  color: var(--primary);
  line-height: 1.4;
}

.news-item time {
  display: block;
  padding: 0 25px 15px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
}

.news-item p {
  padding: 0 25px 30px;
  color: var(--text-light);
  line-height: 1.6;
  flex-grow: 1;
}

/* Flags Carousel */
.flags-carousel {
  overflow: hidden;
  width: 100%;
  margin: 30px 0 20px;
  position: relative;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 8%, #000 92%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, #000 8%, #000 92%, transparent 100%);
}

.flags-track {
  display: flex;
  align-items: center;
  gap: 40px;
  width: max-content;
  animation: flagsScroll 40s linear infinite;
}

.flags-carousel:hover .flags-track {
  animation-play-state: paused;
}

.flag-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.flag-item:hover {
  transform: scale(1.1);
}

.flag-item img {
  height: 40px;
  width: 71px; /* 16:9 ratio */
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.flag-item span {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

@keyframes flagsScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Map and Partners Split Layout */
.map-section {
  padding: 60px 0;
  background: var(--white);
  /* Moved background here since partners section is gone */
}

.map-section .container {
  max-width: 1200px;
}

.map-instruction {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 2rem;
  text-align: center;
}

.map-status {
  text-align: center;
  font-size: 0.95rem;
  color: #c0392b;
  min-height: 1.2em;
  margin-bottom: 1rem;
}

.map-partners-wrapper {
  display: flex;
  flex-direction: column;
  gap: 40px;
  align-items: center;
}

.map-container-inner {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

#map {
  height: 400px;
  /* Reduced height as requested */
  width: 100%;
  z-index: 1;
}

.partners-side {
  width: 100%;
  text-align: center;
}

.partners-side h3 {
  margin-bottom: 25px;
  color: var(--primary);
  font-size: 1.5rem;
}

.partners-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  align-items: center;
}

.partners-list img {
  height: 50px;
  min-width: 100px;
  object-fit: contain;
  opacity: 0.6;
  filter: grayscale(100%);
  transition: all 0.3s ease;
}

.partners-list img:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.05);
}

/* Desktop Side-by-Side */
@media (min-width: 1024px) {
  .map-partners-wrapper {
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
    gap: 50px;
  }

  .map-container-inner {
    flex: 3;
    max-width: 72%;
  }

  .partners-side {
    flex: 1;
    max-width: 25%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--bg-light);
    border-radius: 16px;
    padding: 25px 20px;
  }

  .partners-list {
    flex-direction: column;
    /* Stack logos vertically on side layout */
    gap: 40px;
  }

  .partners-list img {
    height: auto;
    max-height: 55px;
    width: 80%;
    max-width: 150px;
  }

  #map {
    height: 500px;
  }
}

/* Custom Leaflet Popup Stylings for Glassmorphism */
.leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  padding: 5px;
  color: var(--text-main);
  font-family: var(--font-body);
}

.leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.95);
}

.leaflet-popup-content {
  font-size: 1rem;
  margin: 10px;
  line-height: 1.5;
}

.dealer-popup-content {
  text-align: center;
}

.dealer-popup-content strong {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--primary);
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}

.dealer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 15px;
  text-align: left;
}

.dealer-logo {
  height: 20px;
  width: auto;
  vertical-align: middle;
}

.dealer-count {
  font-weight: bold;
  color: var(--accent);
  background: #f0f4f8;
  padding: 2px 8px;
  border-radius: 12px;
}

/* Footer */
footer {
  background: var(--primary);
  color: var(--white);
  padding: 80px 0 40px;
}

footer .container {
  text-align: center;
}

footer p {
  margin-bottom: 12px;
  font-size: 1rem;
  opacity: 0.9;
}

footer a {
  color: var(--white);
  text-decoration: none;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.5);
  transition: opacity 0.3s;
}

footer a:hover {
  opacity: 0.7;
}

.footer-links {
  margin-top: 40px;
  display: flex !important;
  /* Force flex */
  justify-content: center;
  align-items: center;
  gap: 40px;
  list-style: none;
  padding: 0;
  flex-wrap: wrap;
  /* Allow wrap on mobile, but centered singlerow on desktop */
}

.footer-links li a {
  font-size: 0.95rem;
  font-weight: 500;
  border-bottom: none;
}

.footer-links li a:hover {
  color: var(--accent);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  :root {
    --section-padding: 60px 0;
  }

  body {
    font-size: 15px;
    line-height: 1.6;
  }

  .navbar {
    padding: 10px 0;
  }

  .navbar .container {
    width: 100%;
    max-width: none;
    padding: 0 16px;
  }

  .nav-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  .logo {
    width: auto;
    flex-shrink: 1;
  }

  .logo img {
    max-height: 40px;
    height: auto;
    width: auto;
    display: block;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .navbar nav {
    background: var(--white);
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  h2 {
    font-size: 2rem;
  }

  .lead {
    font-size: 1.05rem;
    margin-bottom: 40px;
  }

  .hero {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    border-radius: 0;
    max-width: 100%;
  }

  .dealers-banner h2 {
    font-size: 1.4rem;
  }

  .hero-overlay {
    padding: 20px 24px;
    max-width: 90%;
    border-radius: 12px;
  }

  .hero h1 {
    font-size: 1.5rem;
    line-height: 1.1;
    margin-bottom: 8px;
  }

  .hero p {
    font-size: 0.9rem;
  }

  /* Removed redundant .nav-container rule */

  .navbar nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  }

  .navbar nav.open {
    display: block;
  }

  .navbar nav ul {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  .partners-grid {
    gap: 32px;
  }

  .partners-grid img {
    height: 40px;
  }
}