*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --header-height: 45px;
  --color-brand: #2c3e50;
  --color-accent: #e67e22;
  --color-gold: #c8922a;
  --color-navy: #1e3a5f;
  --color-muted: #6c757d;
  --font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html, body {
  font-family: var(--font-family);
  margin: 0;
  padding: 0;
  height: 100%;
}

/* ── Header ─────────────────────────────── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(30, 58, 95, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 90px;
  z-index: 1000;
}

.videos-page .header {
  background: var(--color-navy);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--color-gold);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo img {
  display: block;
}

/* ── Header stats ────────────────────────── */
.header-stats {
  margin-left: auto;
  margin-right: 14px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-gold);
  opacity: 0.75;
  letter-spacing: 0.03em;
}

/* ── Menu (hamburger + dropdown) ────────── */
.menu-wrapper {
  position: relative;
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--color-gold);
  padding: 4px 6px;
  line-height: 1;
}

.hamburger:hover {
  color: #fff;
}

.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: rgba(30, 58, 95, 0.92);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  min-width: 120px;
  padding: 6px 0;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-link {
  display: block;
  padding: 8px 16px;
  color: var(--color-gold);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.dropdown-link:hover {
  color: #e0a840;
}

/* ── Map (full viewport background) ────── */
#map-container {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

/* ── Leaflet zoom controls ───────────────── */
.leaflet-top {
  top: 50px !important;
}

.leaflet-control-zoom {
  border: none !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background-color: rgba(30, 58, 95, 0.92) !important;
  color: var(--color-gold) !important;
  border: none !important;
}

.leaflet-control-zoom a:hover {
  background-color: var(--color-gold) !important;
  color: var(--color-navy) !important;
}

/* ── Leaflet popup overrides ─────────────── */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  padding: 0;
}

.leaflet-popup-content {
  margin: 0;
  font-family: var(--font-family);
  font-size: 0.88rem;
  line-height: 1.5;
}

.thumb-popup .leaflet-popup-content-wrapper {
  padding: 0;
  overflow: hidden;
}

.thumb-popup .leaflet-popup-content {
  margin: 0;
}

.popup-thumb-link {
  display: block;
  position: relative;
  line-height: 0;
  cursor: pointer;
}

.popup-thumb {
  width: 240px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}

.popup-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.popup-thumb-link:hover .popup-play {
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.popup-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-brand);
  padding: 10px 14px;
}

/* ── Map legend ─────────────────────────── */
.map-legend {
  background: rgba(30, 58, 95, 0.92);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  font-family: var(--font-family);
  font-size: 0.8rem;
  line-height: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
}

.legend-icon {
  flex-shrink: 0;
  display: block;
}

/* ── Videos page ─────────────────────────── */
.videos-page {
  height: auto;
  overflow-y: auto;
}

.videos-content {
  padding: calc(var(--header-height) + 24px) 24px 40px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.video-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.15s;
}

.video-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  transform: translateY(-3px);
}

.video-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.video-info {
  padding: 12px 14px 14px;
}

.video-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-brand);
  line-height: 1.35;
  margin-bottom: 6px;
}

.video-date {
  font-size: 0.78rem;
  color: var(--color-muted);
}

.videos-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--color-muted);
  padding: 3rem 0;
}

/* ── Loading spinner ─────────────────────── */
.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 4rem 0;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── Responsive ──────────────────────────── */
@media (max-width: 1200px) {
  .videos-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .videos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .videos-grid {
    grid-template-columns: 1fr;
  }

  .videos-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .header-stats {
    display: none;
  }
}
