/* ==========================================================================
   style.css — Near Riyadh Metro
   ========================================================================== */

/* Google Font - Tajawal */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --green-primary: #1E4D8C;
  --green-light: #EAF1FB;
  --green-hover: #163A6B;
  --dark-text: #1A1A2E;
  --gray-medium: #555566;
  --gray-light: #F5F7FA;
  --white: #FFFFFF;
  --footer-bg: #12284A;

  --line-blue:   #0072BC;
  --line-red:    #ED1C24;
  --line-orange: #F7941D;
  --line-yellow: #FFD700;
  --line-green:  #00A651;
  --line-purple: #92278F;

  --navbar-height: 64px;
  --font: 'Tajawal', sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--dark-text);
  background: var(--gray-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--green-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #1E4D8C 0%, #2563B0 100%);
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
  box-shadow: 0 2px 12px rgba(30,77,140,0.25);
}

.navbar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.navbar__logo img {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.navbar__logo-text {
  color: var(--white);
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}

.navbar__nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.navbar__nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.navbar__nav a:hover,
.navbar__nav a.active {
  color: var(--white);
  background: rgba(255,255,255,0.15);
  text-decoration: none;
}

.navbar__nav a.active {
  border-bottom: 2px solid var(--white);
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

#lang-toggle {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.5);
  color: var(--white);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 0.5px;
}

#lang-toggle:hover {
  background: rgba(255,255,255,0.25);
}

/* Hamburger (mobile) */
.navbar__hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--white);
  flex-direction: column;
  gap: 5px;
}

.navbar__hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.2s;
}

/* Mobile nav dropdown */
.navbar__mobile-menu {
  display: none;
  position: absolute;
  top: var(--navbar-height);
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #1E4D8C 0%, #2563B0 100%);
  flex-direction: column;
  padding: 8px 16px 16px;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(30,77,140,0.25);
  z-index: 999;
}

.navbar__mobile-menu.open {
  display: flex;
}

.navbar__mobile-menu a {
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s;
}

.navbar__mobile-menu a:hover,
.navbar__mobile-menu a.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
}

/* ---------- Main Content Wrapper ---------- */
.page-content {
  flex: 1;
}

/* ---------- HOME PAGE — Filter Bar ---------- */
.filter-bar {
  background: var(--white);
  border-bottom: 1px solid #e0e0e0;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow: hidden;
  z-index: 100;
  position: relative;
}

.filter-bar__label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-medium);
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-bar__buttons {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.filter-bar__buttons::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid #d0d0d0;
  background: var(--white);
  color: var(--dark-text);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

.filter-btn:hover {
  border-color: var(--green-primary);
  color: var(--green-primary);
  background: var(--green-light);
}

.filter-btn.active {
  background: var(--green-primary);
  color: var(--white);
  border-color: var(--green-primary);
}

.filter-btn .filter-icon {
  font-size: 1rem;
}

/* ---------- Map Container ---------- */
.map-wrapper {
  position: relative;
}

#map {
  width: 100%;
  height: calc(100vh - var(--navbar-height) - 56px);
  min-height: 400px;
  background: #e8e8e8;
}

/* ---------- Map Overlay Notifications ---------- */
.map-notification {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  background: rgba(26, 26, 46, 0.9);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  pointer-events: none;
  transition: opacity 0.3s;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}

.map-notification.hidden {
  opacity: 0;
}

/* Loading spinner overlay */
.loading-overlay {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 900;
  background: var(--white);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--dark-text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: opacity 0.3s;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e0e0e0;
  border-top-color: var(--green-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

/* ---------- Map Legend ---------- */
.map-legend {
  background: rgba(255,255,255,0.93);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  min-width: 160px;
  pointer-events: none;
}

.map-legend h4 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e0e0e0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 0.8rem;
  color: var(--dark-text);
}

.legend-swatch {
  width: 28px;
  height: 5px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* ---------- Leaflet Popup Styles ---------- */
.leaflet-popup-content-wrapper {
  border-radius: 10px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
  min-width: 200px;
  max-width: 280px;
}

.station-popup,
.poi-popup {
  padding: 14px 16px;
}

.station-popup__name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--dark-text);
  margin-bottom: 6px;
}

.station-popup__lines {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.line-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--white);
}

.line-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  flex-shrink: 0;
}

.station-popup__nearby {
  font-size: 0.8rem;
  color: var(--gray-medium);
  font-style: italic;
}

.poi-popup__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--dark-text);
  margin-bottom: 4px;
}

.poi-popup__type {
  font-size: 0.8rem;
  color: var(--gray-medium);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.poi-popup__gmaps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  background: var(--green-primary);
  color: var(--white);
  border: none;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.poi-popup__gmaps:hover {
  background: var(--green-hover);
  text-decoration: none;
  color: var(--white);
}

/* ---------- About & Contact Pages ---------- */
.page-hero {
  background: linear-gradient(135deg, #1E4D8C 0%, #2563B0 100%);
  color: var(--white);
  padding: 48px 24px 40px;
  text-align: center;
}

.page-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.page-hero p {
  font-size: 1.05rem;
  opacity: 0.88;
}

.page-section {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px;
}

.page-section p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--dark-text);
  margin-bottom: 20px;
}

.page-section p:last-child {
  margin-bottom: 0;
}

/* ---------- Contact Page ---------- */
.contact-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
  max-width: 500px;
  margin: 0 auto;
}

.contact-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.contact-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--dark-text);
}

.contact-card p {
  font-size: 0.95rem;
  color: var(--gray-medium);
  margin-bottom: 24px;
  line-height: 1.6;
}

.contact-email-row {
  background: var(--green-light);
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.contact-email-row span {
  font-size: 0.85rem;
  color: var(--gray-medium);
}

.contact-email-row a {
  font-weight: 600;
  color: var(--green-primary);
  font-size: 0.95rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--green-primary);
  color: var(--white);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  padding: 13px 32px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 3px 10px rgba(30,77,140,0.30);
}

.btn-primary:hover {
  background: var(--green-hover);
  text-decoration: none;
  color: var(--white);
  transform: translateY(-1px);
}

/* ---------- Footer ---------- */
footer {
  background: var(--footer-bg);
  color: rgba(255,255,255,0.75);
  padding: 28px 24px;
  text-align: center;
  margin-top: auto;
}

footer .footer-brand {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 8px;
}

footer .footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 10px;
  font-size: 0.8rem;
}

footer .footer-links a {
  color: rgba(255,255,255,0.65);
  transition: color 0.2s;
}

footer .footer-links a:hover {
  color: var(--white);
  text-decoration: none;
}

footer .footer-copyright {
  font-size: 0.78rem;
  opacity: 0.6;
}

footer .footer-map-credit {
  font-size: 0.75rem;
  opacity: 0.5;
  margin-top: 4px;
}

/* ---------- Custom Station Marker ---------- */
.station-marker-wrapper {
  position: relative;
}

/* ---------- Error Toast ---------- */
.error-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: #c62828;
  color: var(--white);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  max-width: 90vw;
  text-align: center;
  animation: slideUp 0.3s ease;
}

.error-toast.fade-out {
  animation: fadeOut 0.4s ease forwards;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .navbar__nav {
    display: none;
  }

  .navbar__hamburger {
    display: flex;
  }

  .navbar__actions {
    margin-left: auto;
  }

  #map {
    height: 60vh;
  }

  .filter-bar {
    padding: 8px 12px;
  }

  .filter-bar__buttons {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filter-bar__buttons::-webkit-scrollbar {
    display: none;
  }

  .page-hero h1 {
    font-size: 1.5rem;
  }

  .contact-card {
    padding: 28px 20px;
  }

  .page-section {
    padding: 32px 16px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .navbar {
    padding: 0 14px;
  }

  .navbar__logo-text {
    font-size: 0.95rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---------- Leaflet MarkerCluster override ---------- */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(30, 77, 140, 0.2) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: rgba(30, 77, 140, 0.75) !important;
  color: white !important;
  font-weight: 700;
  font-family: var(--font);
}
