/* ═══════════════════════════════════════════════════
   Drone Movie Archive  |  Styles v2
   Added: Map view styles, Leaflet overrides
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg-primary: #0a0f28;
  --bg-secondary: #0f193c;
  --bg-card: #152040;
  --bg-card-hover: #1a2a50;
  --bg-overlay: rgba(10, 15, 40, 0.92);
  --text-primary: #dcebff;
  --text-secondary: #8aa0c0;
  --text-muted: #5a7090;
  --accent: #00c8ff;
  --accent-glow: rgba(0, 200, 255, 0.25);
  --accent-soft: #64dcff;
  --border: #1e3050;
  --border-light: #2a3d60;
  --tag-bg: #0f1e3c;
  --tag-text: #8aa0c0;
  --success: #5cb87a;
  --danger: #e05555;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-card: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.45);
  --shadow-modal: 0 24px 80px rgba(0,0,0,0.7);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, var(--bg-primary) 60%, transparent);
  padding: 1.5rem 2rem 2rem;
  backdrop-filter: blur(12px);
}

.header-inner { max-width: 1440px; margin: 0 auto; }

.site-title {
  font-family: 'Space Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.site-title .icon { font-size: 1.4rem; filter: drop-shadow(0 0 6px var(--accent-glow)); }

.site-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-weight: 300;
}

/* ── Search & Filters Bar ────────────────────── */

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.2rem;
}

.search-wrap { position: relative; flex: 1 1 280px; max-width: 420px; }

.search-wrap .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 1rem; pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.filter-select {
  padding: 0.65rem 2rem 0.65rem 0.9rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  cursor: pointer; outline: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a90a0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--transition);
}

.filter-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.filter-select option { background: var(--bg-secondary); color: var(--text-primary); }

.stats-badge {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem; color: var(--accent);
  background: var(--tag-bg); padding: 0.45rem 0.85rem;
  border-radius: var(--radius-lg); white-space: nowrap; border: 1px solid var(--border);
}

.view-toggle {
  display: flex; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden;
}

.view-btn {
  padding: 0.5rem 0.75rem; background: var(--bg-secondary); border: none;
  color: var(--text-muted); cursor: pointer; font-size: 1rem;
  transition: all var(--transition);
}

.view-btn.active { background: var(--accent); color: var(--bg-primary); }
.view-btn:hover:not(.active) { color: var(--text-primary); background: var(--bg-card); }

/* ── Grid Layout ─────────────────────────────── */

.content-area { max-width: 1440px; margin: 0 auto; padding: 0 2rem 4rem; position: relative; z-index: 10; }

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

.video-grid.list-view { grid-template-columns: 1fr; gap: 0.5rem; }

/* ── Video Cards ─────────────────────────────── */

.video-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
}

.video-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-light);
}

.card-preview {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: var(--bg-secondary); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}

.card-preview video { width: 100%; height: 100%; object-fit: cover; }

.card-preview .play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.35); opacity: 0;
  transition: opacity var(--transition);
}

.video-card:hover .play-overlay { opacity: 1; }

.play-overlay .play-btn {
  width: 56px; height: 56px; background: var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: transform 0.2s ease;
}

.video-card:hover .play-btn { transform: scale(1.08); }
.play-btn svg { width: 22px; height: 22px; fill: var(--bg-primary); margin-left: 3px; }

.card-type-badge {
  position: absolute; top: 10px; right: 10px;
  font-family: 'Space Mono', monospace; font-size: 0.65rem;
  padding: 0.2rem 0.5rem; background: rgba(0,0,0,0.6);
  color: var(--text-secondary); border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

.card-body { padding: 0.9rem 1rem; }

.card-location {
  font-weight: 600; font-size: 0.95rem; color: var(--text-primary);
  margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.card-date {
  font-size: 0.8rem; color: var(--text-secondary);
  display: flex; align-items: center; gap: 0.4rem;
}

.card-date .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); }

.card-folder-tag {
  display: inline-block; font-size: 0.7rem; padding: 0.15rem 0.5rem;
  background: var(--tag-bg); color: var(--tag-text); border-radius: var(--radius-sm);
  margin-top: 0.4rem;
}

/* ── List View Cards ─────────────────────────── */

.list-view .video-card { display: flex; flex-direction: row; border-radius: var(--radius-md); }
.list-view .card-preview { width: 200px; min-width: 200px; aspect-ratio: 16/9; border-radius: 0; }
.list-view .card-body {
  display: flex; align-items: center; gap: 1.5rem; flex: 1; padding: 0.75rem 1rem;
}
.list-view .card-location { margin-bottom: 0; }

/* ── Modal / Lightbox ────────────────────────── */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg-overlay); backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem; opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.active { opacity: 1; pointer-events: all; }

.modal-content {
  max-width: 1100px; width: 100%;
  background: var(--bg-card); border-radius: var(--radius-xl);
  overflow: hidden; box-shadow: var(--shadow-modal);
  border: 1px solid var(--border-light);
  transform: scale(0.94) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.active .modal-content { transform: scale(1) translateY(0); }

.modal-video-wrap {
  width: 100%; aspect-ratio: 16/9; background: #000; position: relative;
}

.modal-video-wrap video, .modal-video-wrap img {
  width: 100%; height: 100%; object-fit: contain;
}

.modal-info {
  padding: 1.2rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem;
}

.modal-title { font-weight: 600; font-size: 1.1rem; }

.modal-meta {
  font-size: 0.85rem; color: var(--text-secondary);
  display: flex; gap: 1rem; align-items: center;
}

.modal-close {
  position: absolute; top: 1rem; right: 1rem; z-index: 1001;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.1); color: #fff;
  font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}

.modal-close:hover { background: rgba(0,0,0,0.85); }

.modal-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1001;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.1); color: #fff;
  font-size: 1.4rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}

.modal-nav:hover { background: rgba(0,0,0,0.8); }
.modal-nav.prev { left: 1rem; }
.modal-nav.next { right: 1rem; }

/* ── No Results & Year Dividers ──────────────── */

.no-results { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.no-results .big-icon { font-size: 3rem; margin-bottom: 1rem; }
.no-results h3 { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 0.4rem; }

.year-divider {
  display: flex; align-items: center; gap: 1rem;
  margin: 2rem 0 1rem; padding-top: 1rem;
}

.year-divider:first-child { margin-top: 0; }

.year-label {
  font-family: 'Space Mono', monospace;
  font-size: 1.4rem; font-weight: 700; color: var(--accent); white-space: nowrap;
}

.year-line { flex: 1; height: 1px; background: var(--border); }
.year-count { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* ═══════════════════════════════════════════════════
   MAP VIEW  (v2 addition)
   ═══════════════════════════════════════════════════ */

.map-container {
  display: none;
  width: 100%;
  height: calc(100vh - 160px);
  min-height: 500px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 2rem;
  position: relative;
}

.map-container.active { display: block; }

#leafletMap { width: 100%; height: 100%; z-index: 1; }

/* Leaflet dark theme overrides */
.leaflet-container { background: var(--bg-secondary) !important; }

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover { background: var(--bg-card-hover) !important; }

.leaflet-control-attribution {
  background: rgba(20, 24, 32, 0.85) !important;
  color: var(--text-muted) !important;
  font-size: 0.65rem !important;
}

.leaflet-control-attribution a { color: var(--accent) !important; }

/* Custom map popup */
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-hover) !important;
  border: 1px solid var(--border-light) !important;
  padding: 0 !important;
}

.leaflet-popup-tip { background: var(--bg-card) !important; }
.leaflet-popup-content { margin: 0 !important; font-family: 'Outfit', sans-serif !important; }

.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 1.2rem !important;
  top: 6px !important;
  right: 8px !important;
}

.leaflet-popup-close-button:hover { color: var(--text-primary) !important; }

.map-popup {
  min-width: 240px;
  max-width: 320px;
}

.map-popup-header {
  padding: 0.8rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.map-popup-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.2rem 0;
}

.map-popup-header .popup-stats {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.map-popup-list {
  padding: 0.5rem 0;
  max-height: 220px;
  overflow-y: auto;
}

.map-popup-item {
  padding: 0.35rem 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.map-popup-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.map-popup-item .item-date { font-family: 'Space Mono', monospace; font-size: 0.7rem; }
.map-popup-item .item-ext { font-size: 0.65rem; color: var(--text-muted); }

.map-popup-footer {
  padding: 0.5rem 1rem 0.7rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.map-popup-footer button {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.map-popup-footer button:hover { opacity: 0.85; }

/* Custom cluster markers */
.location-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-primary);
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  border: 3px solid rgba(232, 148, 58, 0.4);
  box-shadow: 0 2px 12px var(--accent-glow), 0 0 24px var(--accent-glow);
  transition: transform 0.2s ease;
}

.location-marker:hover { transform: scale(1.15); }

.location-marker.small { width: 32px; height: 32px; font-size: 0.75rem; border-width: 2px; }
.location-marker.large { width: 52px; height: 52px; font-size: 1rem; border-width: 4px; }

/* Map legend */
.map-legend {
  position: absolute;
  bottom: 2rem;
  left: 1rem;
  z-index: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.map-legend h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.legend-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0;
}

/* ── Scrollbar ───────────────────────────────── */

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ──────────────────────────────── */

@media (max-width: 768px) {
  .site-header { padding: 1rem; }
  .content-area { padding: 0 1rem 3rem; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
  .controls-bar { gap: 0.5rem; }
  .search-wrap { max-width: 100%; flex-basis: 100%; }
  .modal-backdrop { padding: 0.5rem; }
  .list-view .video-card { flex-direction: column; }
  .list-view .card-preview { width: 100%; min-width: 0; }
  .list-view .card-body { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
  .map-container { height: 50vh; min-height: 350px; }
}

/* ── Animations ──────────────────────────────── */

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

.video-card { animation: fadeInUp 0.4s ease both; }
