/* ============================================
   FAMOUS PHOTOGRAPHS MAP
   Card-based explorer layout
   ============================================ */

:root {
    --bg-deep: #0c0d11;
    --bg-panel: #111318;
    --bg-card: #181b24;
    --bg-card-hover: #1f2330;
    --bg-input: #14161e;
    --border: #1e2133;
    --border-light: #2a2e42;
    --text-primary: #eae8e4;
    --text-secondary: #9094a8;
    --text-muted: #5c6078;
    --accent: #d4a853;
    --accent-soft: rgba(212, 168, 83, 0.15);
    --accent-glow: rgba(212, 168, 83, 0.3);
    --marker-color: #d4a853;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --topbar-h: 54px;
    --radius: 10px;
    --radius-sm: 6px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100%; overflow: hidden; background: var(--bg-deep);
    color: var(--text-primary); font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

/* ─── Top Bar ─── */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
    background: var(--bg-panel); border-bottom: 1px solid var(--border);
    z-index: 1000; display: flex; align-items: center;
    padding: 0 24px; gap: 24px;
}
.topbar-brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--accent); flex-shrink: 0; cursor: pointer;
}
.topbar-brand h1 {
    font-family: var(--font-body); font-size: 17px; font-weight: 700;
    color: var(--text-primary); letter-spacing: -0.3px;
}
.topbar-brand h1 span { color: var(--accent); }

.topbar-nav { display: flex; gap: 4px; margin-left: 12px; }
.nav-item {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; color: var(--text-muted);
    text-decoration: none; transition: all 0.15s; cursor: pointer;
}
.nav-item:hover { color: var(--text-primary); background: var(--bg-card); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); }

.topbar-search {
    margin-left: auto; display: flex; align-items: center;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0 12px; gap: 8px;
    width: 260px; transition: all 0.2s; position: relative;
}
.topbar-search:focus-within {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
    width: 320px;
}
.topbar-search svg { color: var(--text-muted); flex-shrink: 0; }
.topbar-search input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text-primary); font-family: var(--font-body);
    font-size: 13px; padding: 8px 0;
}
.topbar-search input::placeholder { color: var(--text-muted); }

/* Search Dropdown */
.search-dropdown {
    position: fixed; top: var(--topbar-h); right: 24px;
    width: 360px; max-height: 420px; overflow-y: auto;
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    z-index: 1001; display: none;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.search-dropdown.visible { display: block; }
.search-result {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; cursor: pointer;
    border-bottom: 1px solid var(--border); transition: background 0.1s;
}
.search-result:hover { background: var(--bg-card-hover); }
.search-result-thumb {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: var(--bg-card); flex-shrink: 0;
    background-size: cover; background-position: center;
    border: 1px solid var(--border);
}
.search-result-info { flex: 1; min-width: 0; }
.search-result-name {
    font-size: 13px; font-weight: 500; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-result-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ─── Main Layout ─── */
.main-layout {
    position: fixed; top: var(--topbar-h); left: 0; right: 0; bottom: 0;
    display: flex;
}

/* ─── Left Panel ─── */
.left-panel {
    width: 48%; max-width: 680px; min-width: 400px;
    overflow-y: auto; overflow-x: hidden;
    background: var(--bg-deep);
    border-right: 1px solid var(--border);
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.left-panel::-webkit-scrollbar { width: 6px; }
.left-panel::-webkit-scrollbar-track { background: transparent; }
.left-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Sections */
.section { padding: 24px; border-bottom: 1px solid var(--border); }
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.section-header h2 {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--font-body); font-size: 15px; font-weight: 700;
    color: var(--text-primary); letter-spacing: -0.2px;
}
.section-header h2 svg { color: var(--accent); }
.section-date {
    font-size: 12px; color: var(--accent); font-weight: 600;
    background: var(--accent-soft); padding: 3px 10px; border-radius: 20px;
}
.section-count {
    font-family: var(--font-mono); font-size: 12px;
    color: var(--text-muted); background: var(--bg-card);
    padding: 3px 10px; border-radius: 20px; border: 1px solid var(--border);
}

/* ─── On This Day ─── */
.on-this-day-cards {
    display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.on-this-day-cards::-webkit-scrollbar { height: 4px; }
.on-this-day-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.otd-card {
    flex-shrink: 0; width: 220px; cursor: pointer;
    border-radius: var(--radius); overflow: hidden;
    background: var(--bg-card); border: 1px solid var(--border); transition: all 0.2s;
}
.otd-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.otd-card-image {
    width: 100%; height: 140px; background: var(--bg-card-hover);
    background-size: cover; background-position: center; position: relative;
}
.otd-card-year {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,0.7); color: var(--accent);
    font-family: var(--font-mono); font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 4px; backdrop-filter: blur(8px);
}
.otd-card-body { padding: 10px 12px; }
.otd-card-name {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    line-height: 1.3; margin-bottom: 4px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.otd-card-location {
    font-size: 11px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.empty-message {
    font-size: 13px; color: var(--text-muted); padding: 20px 0;
    text-align: center; width: 100%;
}

/* ─── Photo Grid ─── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.photo-card {
    cursor: pointer; border-radius: var(--radius); overflow: hidden;
    background: var(--bg-card); border: 1px solid var(--border);
    transition: all 0.2s; position: relative;
}
.photo-card:hover {
    border-color: var(--accent); transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.photo-card-image {
    width: 100%; height: 150px; background: var(--bg-card-hover);
    background-size: cover; background-position: center; position: relative;
    display: flex; align-items: center; justify-content: center;
}
.photo-card-image svg { color: var(--text-muted); opacity: 0.3; }
.photo-card-image.loaded svg { display: none; }
.photo-card-badge {
    position: absolute; top: 8px; left: 8px;
    display: flex; align-items: center; gap: 4px;
    background: rgba(0,0,0,0.65); backdrop-filter: blur(8px);
    padding: 3px 8px; border-radius: 4px;
    font-size: 10px; font-weight: 600; color: white;
}
.photo-card-badge svg { width: 10px; height: 10px; }
.photo-card-body { padding: 10px 12px; }
.photo-card-name {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    line-height: 1.3; margin-bottom: 3px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.photo-card-meta {
    font-size: 11px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Small grid variant */
.photo-grid-small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo-grid-small .photo-card-image { height: 120px; }
.photo-grid-small .photo-card-body { padding: 8px 10px; }
.photo-grid-small .photo-card-name { font-size: 12px; }

/* ─── Detail View (in left panel) ─── */
.detail-back {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 24px; border-bottom: 1px solid var(--border);
    font-size: 13px; font-weight: 600; color: var(--text-secondary);
    cursor: pointer; transition: all 0.15s;
    position: sticky; top: 0; background: var(--bg-deep); z-index: 5;
}
.detail-back:hover { color: var(--accent); }

.detail-content { padding: 0; }

.detail-hero-image {
    width: 100%; position: relative; background: var(--bg-card);
    min-height: 100px;
}
.detail-hero-image img {
    width: 100%; display: block;
}
.detail-hero-placeholder {
    width: 100%; height: 160px; background: var(--bg-card);
    display: flex; align-items: center; justify-content: center;
}
.detail-hero-placeholder svg { color: var(--text-muted); opacity: 0.2; }

.detail-body { padding: 24px; }

.detail-title {
    font-family: var(--font-display); font-size: 28px; font-weight: 700;
    line-height: 1.2; color: var(--text-primary); margin-bottom: 20px;
    letter-spacing: -0.5px;
}
.detail-meta-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px; margin-bottom: 24px;
}
.detail-meta-item {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px;
}
.detail-meta-label {
    font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 4px;
}
.detail-meta-value { font-size: 13px; color: var(--text-primary); line-height: 1.3; }

.detail-description {
    font-size: 14px; line-height: 1.7; color: var(--text-secondary);
    margin-bottom: 20px; border-top: 1px solid var(--border); padding-top: 20px;
}
.detail-coords {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px;
    font-family: var(--font-mono); font-size: 12px;
    color: var(--text-secondary); display: flex; gap: 16px; margin-bottom: 16px;
}
.detail-coords span { color: var(--accent); }

.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.detail-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--accent); text-decoration: none;
    padding: 8px 14px; border: 1px solid var(--accent);
    border-radius: var(--radius-sm); transition: all 0.15s; cursor: pointer;
}
.detail-link:hover { background: var(--accent); color: var(--bg-deep); }
.detail-link.secondary {
    color: var(--text-secondary); border-color: var(--border);
}
.detail-link.secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Map ─── */
.map-container { flex: 1; position: relative; }
#map { position: absolute; inset: 0; background: var(--bg-deep); }

.leaflet-container { background: #0a0c12 !important; font-family: var(--font-body) !important; }
.leaflet-control-zoom {
    border: 1px solid var(--border) !important; border-radius: var(--radius) !important;
    overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
}
.leaflet-control-zoom a {
    background: var(--bg-panel) !important; color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border) !important;
    width: 36px !important; height: 36px !important; line-height: 36px !important;
    font-size: 16px !important; transition: background 0.15s;
}
.leaflet-control-zoom a:hover { background: var(--bg-card-hover) !important; }
.leaflet-control-attribution {
    background: rgba(10, 11, 15, 0.85) !important; color: var(--text-muted) !important;
    font-size: 10px !important; padding: 2px 8px !important;
}
.leaflet-control-attribution a { color: var(--text-secondary) !important; }


/* Map controls */
.map-controls {
    position: absolute; bottom: 24px; right: 24px; z-index: 800;
    display: flex; flex-direction: column; gap: 6px;
}
.map-control-btn {
    width: 42px; height: 42px; background: var(--bg-panel);
    border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: relative;
}
.map-control-btn:hover { background: var(--bg-card-hover); color: var(--accent); }
#map-style-toggle::after {
    content: attr(data-style);
    position: absolute; right: 50px;
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 4px 10px;
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.6px; color: var(--text-secondary);
    white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.15s;
}
#map-style-toggle:hover::after { opacity: 1; }

/* Markers — photo thumbnails */
.photo-marker { }
.photo-marker-frame {
    width: 48px; height: 48px; border-radius: 6px; overflow: hidden;
    border: 2px solid rgba(255,255,255,0.85);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 12px rgba(212,168,83,0.3);
    background: var(--bg-card); cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.photo-marker-frame:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 16px rgba(0,0,0,0.6), 0 0 20px rgba(212,168,83,0.5);
    z-index: 1000 !important;
}
.photo-marker-frame img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    pointer-events: none;
}
.photo-marker-empty {
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-card);
}
.photo-marker-empty svg { color: var(--text-muted); opacity: 0.4; }

body.map-street .photo-marker-frame,
body.map-satellite .photo-marker-frame {
    border-color: rgba(255,255,255,0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.7), 0 0 0 1px rgba(0,0,0,0.3);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .main-layout { flex-direction: column; }
    .left-panel { width: 100%; max-width: none; min-width: 0; height: 50%; border-right: none; border-bottom: 1px solid var(--border); }
    .map-container { flex: 1; }
    .topbar-nav { display: none; }
    .topbar-search { width: 180px; }
    .topbar-search:focus-within { width: 240px; }
}
