/* ProjectBob.xyz — Home page: map + photo panel */

.app-container {
  display: flex; height: 100vh; padding-top: var(--nav-height);
}
#map { flex: 1; min-width: 400px; height: 100%; }
.leaflet-container { font-family: var(--font); }

/* ── Panel ── */
.panel {
  width: 320px; min-width: 320px; height: 100%; background: var(--surface);
  border-left: 1px solid var(--border); display: flex; flex-direction: column;
}
.panel-header {
  position: sticky; top: 0; z-index: 10; padding: 12px 20px;
  font-size: 13px; color: var(--text-secondary); font-weight: 500;
  background: var(--surface); border-bottom: 1px solid var(--border-subtle);
  display: flex; justify-content: space-between; align-items: center;
}
.panel-header .zoom-hint { font-size: 11px; color: var(--text-muted); }
.panel-filters { display: flex; gap: 6px; }
.panel-subheader {
  padding: 4px 20px 8px; font-size: 12px; color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}
.panel-scroll { flex: 1; overflow-y: auto; padding: 12px 20px 20px; }
.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb { background: #d4d4d4; border-radius: 3px; }

.photo-list { transition: opacity 0.15s ease-out; }
.photo-list.fading { opacity: 0.4; }

/* ── Cards ── */
.card {
  margin-bottom: 12px; border-radius: 8px; overflow: hidden; cursor: pointer;
  box-shadow: var(--shadow-card); transition: box-shadow 0.25s, border-color 0.25s, opacity 0.2s, transform 0.25s;
  border-left: 3px solid transparent; background: var(--surface);
}
.card:hover { box-shadow: 0 4px 16px rgba(59,125,216,0.18), 0 2px 8px rgba(0,40,80,0.10); transform: scale(1.02); }
.card.active { border-left-color: var(--accent); background: rgba(59,125,216,0.04); }
.card img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block;
  border-radius: 8px 8px 0 0; background: #f0eeec;
}
.card-info { padding: 6px 10px 8px; }
.card-time { font-size: 12px; color: var(--text-secondary); }
.panel-empty {
  display: flex; align-items: center; justify-content: center;
  height: 200px; text-align: center; padding: 40px;
  font-size: 14px; color: var(--text-muted); line-height: 1.6;
}

/* ── Thumbnail preview toggle ── */
.thumb-toggle {
  position: absolute; bottom: 12px; right: 12px; z-index: 800;
  display: flex; align-items: center; gap: 5px; padding: 5px 10px;
  background: var(--glass-bg); backdrop-filter: var(--glass-blur);
  border-radius: 8px; border: 1px solid var(--border);
  font-size: 11px; color: var(--text-secondary); cursor: pointer;
  user-select: none; box-shadow: var(--shadow-card);
}
.thumb-toggle input { width: 13px; height: 13px; accent-color: var(--accent); cursor: pointer; }

/* ── Thumbnail pins on map ── */
.thumb-pin { display: flex; flex-direction: column; align-items: center; }
.thumb-img {
  width: 56px; height: 38px; border-radius: 4px; overflow: hidden;
  border: 2px solid #3B7DD8; box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  margin-bottom: 2px; position: relative; background: #eee;
}
.thumb-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Share button on cards ── */
.card-img-wrap { position: relative; }
.share-btn {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px;
  border-radius: 50%; border: none; background: rgba(255,255,255,0.9);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s, background 0.2s; z-index: 5;
}
.card:hover .share-btn { opacity: 1; }
.share-btn:hover { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.16); }
.share-btn svg { width: 14px; height: 14px; }

/* ── Route peek tooltip ── */
.route-peek {
  position: absolute; z-index: 850; background: var(--surface); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14); width: 150px; overflow: hidden;
  pointer-events: none; opacity: 0; transition: opacity 0.12s;
}
.route-peek.show { opacity: 1; }
.route-peek img { width: 150px; height: 95px; object-fit: cover; display: block; }
.route-peek .peek-label { padding: 5px 8px; font-size: 11px; color: #555; }

/* ── Photo modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.modal-overlay.open { display: flex; opacity: 1; }
.modal {
  position: relative; background: var(--surface); border-radius: 12px;
  width: 75vw; max-width: 960px; max-height: 92vh; overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
}
.modal::-webkit-scrollbar { width: 4px; }
.modal::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
/* ── Top bar ── */
.modal-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border-subtle);
}
.modal-topbar-info { font-size: 13px; color: var(--text-secondary); }
.modal-topbar-actions { display: flex; gap: 8px; }
.modal-action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary); font-size: 12px;
  font-weight: 500; cursor: pointer; text-decoration: none; transition: all 0.15s;
}
.modal-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.modal-action-btn.twitter { background: #0f1419; color: #fff; border-color: #0f1419; }
.modal-action-btn.twitter:hover { background: #1a8cd8; border-color: #1a8cd8; }
/* ── Body: rail | media | rail ── */
.modal-body { display: flex; position: relative; background: #0a0a0a; }
.modal-nav-rail {
  width: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0.4; transition: opacity 0.15s, background 0.15s;
}
.modal-nav-rail:hover { opacity: 1; background: rgba(255,255,255,0.06); }
.modal-center { flex: 1; min-width: 0; }
.modal-media { width: 100%; }
.modal img.modal-photo {
  width: 100%; display: block; aspect-ratio: 16/9; object-fit: contain;
  background: #0a0a0a;
}
/* ── Close button ── */
.modal-close {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px;
  border-radius: 50%; border: none; background: rgba(0,0,0,0.3); color: #fff;
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 2001; transition: background 0.15s;
}
.modal-close:hover { background: rgba(0,0,0,0.6); }
/* ── Telemetry ── */
.modal-telem {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 24px;
  padding: 12px 18px 16px;
}
.modal-telem .st-section {
  grid-column: span 1; font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px; padding: 0 0 4px;
}
.modal-telem .stats-table { border-collapse: collapse; }
.modal-telem .stats-table td {
  padding: 4px 0; font-size: 12px; border-bottom: 1px solid var(--border-subtle);
}
.modal-telem .stats-table td:first-child { color: var(--text-secondary); padding-right: 12px; }
.modal-telem .stats-table td:last-child { font-weight: 600; text-align: right; }
.modal-telem .stats-table tr:last-child td { border: none; }

/* ── Live position pulse ── */
.live-marker-icon { overflow: visible !important; }
@keyframes livePulse {
  0% { transform: translate(-50%,-50%) scale(1); opacity: 0.7; }
  100% { transform: translate(-50%,-50%) scale(2.8); opacity: 0; }
}
.live-ring {
  position: absolute; top: 0; left: 0; width: 24px; height: 24px;
  border-radius: 50%; border: 2.5px solid var(--accent);
  transform: translate(-50%,-50%); animation: livePulse 2s ease-out infinite;
}
.live-dot {
  position: absolute; top: 0; left: 0; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent); transform: translate(-50%,-50%);
  box-shadow: 0 0 8px rgba(59,125,216,0.6);
}
.live-label {
  position: absolute; top: -28px; left: 0; transform: translateX(-50%); white-space: nowrap;
  background: var(--surface); padding: 2px 9px; border-radius: 10px; font-size: 10px;
  color: #666; box-shadow: 0 1px 4px rgba(0,0,0,0.1); font-weight: 500;
}

/* ── Mobile: stack map on top, panel below ── */
@media (max-width: 768px) {
  .app-container { flex-direction: column; }
  #map { min-width: 0; height: 45vh; flex: none; }
  .panel {
    width: 100%; min-width: 0; height: 55vh; flex: none;
    border-left: none; border-top: 3px solid var(--accent);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
  }
  .panel-subheader { display: none; }
  .panel-scroll { padding: 10px 8px 14px; }
  .photo-list {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .card { margin-bottom: 0; border-radius: 6px; }
  .card img { border-radius: 6px 6px 0 0; }
  .card-info { padding: 4px 6px 6px; }
  .card-time { font-size: 10px; }
  .card.active { border-left-width: 2px; }
  .share-btn { width: 24px; height: 24px; top: 5px; right: 5px; }
  .share-btn svg { width: 12px; height: 12px; }
  .modal { width: 95vw; max-height: 90vh; border-radius: 10px; }
  .modal img.modal-photo { border-radius: 10px 10px 0 0; }
  .modal-header { padding: 12px 16px 0; }
  .modal-section { padding: 6px 16px 10px; }
}
