/* ============================================================
   Cemetery Detail Page — Tabbed layout
   ============================================================ */

/* ── Hero ── */
.cem-hero {
    background: linear-gradient(135deg, #000 0%, #1a1a1a 100%);
    padding: 60px 20px 40px;
    text-align: center;
    border-bottom: 1px solid #2a2a2a;
}
.cem-hero h1 {
    color: #FFD700;
    font-family: Georgia, serif;
    font-size: 42px;
    font-weight: 600;
    margin: 0 0 10px;
    line-height: 1.2;
}
.cem-hero .cem-location {
    color: #888;
    font-size: 16px;
    margin: 0;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Tab Bar ── */
.cem-tab-bar {
    background: #111;
    border-bottom: 2px solid #2a2a2a;
    display: flex;
    gap: 0;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.cem-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: #777;
    cursor: pointer;
    font-family: Georgia, serif;
    font-size: 15px;
    margin-bottom: -2px;
    padding: 16px 24px;
    transition: color 0.15s, border-color 0.15s;
}
.cem-tab:hover { color: #ddd; }
.cem-tab.active {
    color: #FFD700;
    border-bottom-color: #FFD700;
}

/* ── Tab Panes ── */
.cem-pane { display: none; }
.cem-pane.active { display: block; }

/* ── Overview Pane ── */
.overview-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 50px 24px 80px;
}
.overview-wrap .cem-description,
.overview-wrap .cem-history {
    color: #ccc;
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 30px;
}
.overview-wrap h2 {
    color: #FFD700;
    font-family: Georgia, serif;
    font-size: 18px;
    margin: 0 0 12px;
    border-bottom: 1px solid #2a2a2a;
    padding-bottom: 8px;
}
.cem-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.cem-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}
.cem-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #FFD700;
    color: #1a1a1a;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
    border: 1px solid transparent;
}
.cem-action-btn:hover { background: #fff; transform: translateY(-1px); }
.cem-action-btn-secondary {
    background: transparent;
    color: #FFD700;
    border-color: #2a2a2a;
}
.cem-action-btn-secondary:hover { background: #1a1a1a; border-color: #FFD700; transform: translateY(-1px); }
.cem-no-info {
    text-align: center;
    padding: 50px 24px;
    margin: 30px 0;
    background: #131313;
    border: 1px dashed #2a2a2a;
    border-radius: 10px;
    color: #555;
}
.cem-no-info svg { color: #3a3a3a; margin-bottom: 14px; }
.cem-no-info p { color: #888; font-size: 15px; font-style: italic; margin-bottom: 6px; }
.cem-no-info span { color: #555; font-size: 13px; display: block; }
.cem-stat {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 20px 28px;
    text-align: center;
    min-width: 140px;
}
.cem-stat-value {
    color: #4fc3f7;
    font-size: 32px;
    font-family: Georgia, serif;
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}
.cem-stat-label { color: #666; font-size: 13px; }

.btn-view-map {
    background: #FFD700;
    border: none;
    border-radius: 24px;
    color: #1a1a1a;
    cursor: pointer;
    font-family: Georgia, serif;
    font-size: 15px;
    font-weight: bold;
    padding: 12px 30px;
    transition: background 0.2s;
}
.btn-view-map:hover { background: #fff; }

/* ── Cemetery overview photo gallery ── */
.cem-photo-gallery { margin-bottom: 24px; }
.cem-photo-main {
    position: relative;
    cursor: zoom-in;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #2a2a2a;
    background: #0a0a0a;
    margin-bottom: 8px;
}
.cem-photo-main img {
    display: block;
    width: 100%;
    height: 380px;
    object-fit: contain;
    transition: opacity 0.2s;
}
/* Inline nav arrows on the main photo when there are multiple */
.cem-photo-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,215,0,0.4);
    color: #FFD700;
    font-size: 22px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
    z-index: 3;
}
.cem-photo-arrow:hover { background: #FFD700; color: #1a1a1a; transform: translateY(-50%) scale(1.05); }
.cem-photo-arrow.prev { left: 12px; }
.cem-photo-arrow.next { right: 12px; }
.cem-photo-main:hover img { opacity: 0.88; }
.cem-photo-hint {
    position: absolute;
    bottom: 10px;
    right: 12px;
    background: rgba(0,0,0,0.65);
    color: #aaa;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    pointer-events: none;
}
.cem-photo-count {
    position: absolute;
    bottom: 10px;
    left: 12px;
    background: rgba(0,0,0,0.65);
    color: #FFD700;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    pointer-events: none;
}
.cem-photo-thumbs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.cem-photo-thumb {
    width: 60px;
    height: 60px;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s;
    flex-shrink: 0;
}
.cem-photo-thumb.active { border-color: #FFD700; }
.cem-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Lightbox */
/* Cemetery lightbox — same design as person page */
.cem-lb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #080808;
    z-index: 2000;
    flex-direction: column;
}
.cem-lb-overlay.open { display: flex; }
.cem-lb-toolbar {
    align-items: center;
    background: #111;
    border-bottom: 1px solid #1e1e1e;
    display: flex;
    flex-shrink: 0;
    gap: 8px;
    justify-content: space-between;
    padding: 10px 16px;
}
.cem-lb-title {
    color: #FFD700;
    font-family: Georgia, serif;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cem-lb-controls { display: flex; gap: 6px; flex-shrink: 0; }
.cem-lb-btn {
    background: #1a1a1a;
    border: 1px solid rgba(255,215,0,0.4);
    border-radius: 6px;
    color: #FFD700;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 6px 12px;
    transition: border-color 0.15s, background 0.15s;
}
.cem-lb-btn:hover { border-color: #FFD700; background: rgba(255,215,0,0.15); }
.cem-lb-close-btn { margin-left: 6px; }

.cem-lb-viewer {
    cursor: grab;
    flex: 1;
    overflow: hidden;
    position: relative;
}
.cem-lb-viewer.grabbing { cursor: grabbing; }
.cem-lb-container {
    left: 0;
    position: absolute;
    top: 0;
    transform-origin: 0 0;
}
.cem-lb-img {
    display: block;
    max-width: none;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}
/* Side nav arrows for multi-photo lightbox */
.cem-lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px; height: 48px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,215,0,0.4);
    color: #FFD700;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.cem-lb-arrow:hover { background: #FFD700; color: #1a1a1a; }
.cem-lb-arrow.prev { left: 18px; }
.cem-lb-arrow.next { right: 18px; }
.cem-lb-tb-counter {
    color: #888;
    font-family: Arial, sans-serif;
    font-size: 11px;
    letter-spacing: 0.06em;
    margin-left: 10px;
}
.cem-lb-hint {
    background: #111;
    border-top: 1px solid #1e1e1e;
    color: #FFD700;
    flex-shrink: 0;
    font-size: 12px;
    margin: 0;
    padding: 6px;
    text-align: center;
}

/* ── People Pane ── */
.people-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 30px 24px 80px;
}
.people-search-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
#people-search {
    flex: 1;
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #ddd;
    font-family: Georgia, serif;
    font-size: 15px;
    padding: 12px 16px;
    transition: border-color 0.2s;
}
#people-search:focus { border-color: #FFD700; outline: none; }
#people-search::placeholder { color: #333; }
.people-count { color: #555; font-size: 13px; white-space: nowrap; }

.graves-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.graves-table th {
    background: #141414;
    border-bottom: 1px solid #2a2a2a;
    color: #777;
    font-size: 11px;
    font-weight: normal;
    letter-spacing: 0.08em;
    padding: 10px 16px;
    text-align: left;
    text-transform: uppercase;
}
.graves-table td {
    border-bottom: 1px solid #1c1c1c;
    color: #ccc;
    padding: 12px 16px;
    vertical-align: middle;
}
.graves-table tr:hover td { background: #141414; }
.graves-table td.name-cell { color: #e0e0e0; font-family: Georgia, serif; }
.graves-table td.year-cell { color: #666; font-size: 13px; }
.graves-table td.link-cell { text-align: right; }
.graves-table .view-link {
    color: #FFD700;
    font-size: 13px;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.graves-table .view-link:hover { opacity: 1; }
.map-pin-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    padding: 0 4px 0 0;
    transition: opacity 0.15s;
    vertical-align: middle;
}
.map-pin-btn:hover { opacity: 1; }

.graves-spinner {
    text-align: center;
    padding: 60px;
    color: #444;
    font-size: 15px;
}
.graves-empty {
    text-align: center;
    padding: 60px 20px;
    color: #444;
    font-size: 15px;
}

#graves-container {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

/* Fix Leaflet tile seam lines */
.leaflet-tile {
    outline: 1px solid transparent;
}

/* ── Map Pane ── */
.map-pane-wrap {
    position: relative;
}
#cemMap {
    width: 100%;
    height: calc(100vh - 180px);
    min-height: 500px;
}

#mapScrollHint {
    position: absolute;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
#mapScrollHint.visible { opacity: 1; }
#mapScrollHint span {
    background: rgba(0,0,0,0.75);
    border: 1px solid #444;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 14px;
    padding: 10px 22px;
}

/* removed duplicate */
#mapScrollHint span {
    background: rgba(0,0,0,0.75);
    border: 1px solid #444;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 14px;
    padding: 10px 22px;
}

/* ── Aerial photo viewer (for cemeteries with map_image) ── */
#cemAerialWrap {
    width: 100%;
    height: calc(100vh - 180px);
    min-height: 500px;
    overflow: hidden;
    position: relative;
    background: #0a0a0a;
    cursor: grab;
}
#cemAerialWrap.panning { cursor: grabbing; }
#cemAerialContainer {
    position: absolute;
    top: 0; left: 0;
    transform-origin: 0 0;
}
#cemAerialImg { display: block; max-width: none; }

/* ── Back link in hero ── */
.cem-back-link {
    display: inline-block;
    background: rgba(255,255,255,0.06);
    border: 1px solid #333;
    border-radius: 16px;
    color: #888;
    font-size: 13px;
    padding: 5px 14px;
    text-decoration: none;
    margin-bottom: 18px;
    transition: border-color 0.15s, color 0.15s;
}
.cem-back-link:hover { border-color: #FFD700; color: #FFD700; }

/* ── Map click-to-interact guard ── */
.map-pane-wrap { position: relative; }
.map-click-guard {
    position: absolute; inset: 0; z-index: 400;
    background: rgba(0,0,0,0.38);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
}
.map-click-guard.hidden { display: none; }
.map-click-guard span {
    background: rgba(0,0,0,0.72);
    border: 1px solid #333;
    border-radius: 8px;
    color: #ccc;
    font-size: 14px;
    padding: 10px 20px;
    pointer-events: none;
}

/* ── Leaflet divIcon transparent container ── */
.leaflet-div-icon {
    background: transparent !important;
    border: none !important;
}

/* ── Leaflet zoom controls dark theme ── */
.leaflet-bar { border: 1px solid #333 !important; box-shadow: 0 2px 10px rgba(0,0,0,0.6) !important; }
.leaflet-control-zoom a {
    background: #1a1a1a !important;
    border-bottom-color: #333 !important;
    color: #bbb !important;
    font-size: 18px !important;
    line-height: 30px !important;
}
.leaflet-control-zoom a:hover { background: #2a2a2a !important; color: #FFD700 !important; }
.leaflet-control-attribution {
    background: rgba(0,0,0,0.55) !important;
    color: #444 !important;
}
.leaflet-control-attribution a { color: #555 !important; }

/* ── Cemetery-name popup (gold) ── */
.cem-name-popup .leaflet-popup-content-wrapper {
    background: #FFD700 !important;
    border-color: #c9a800 !important;
}
.cem-name-popup .leaflet-popup-tip { background: #FFD700 !important; }
/* Cemetery-name popup is solid gold; flip the X to a light chip on dark ink
   and nudge it down/right so it never sits on top of the cemetery title. */
.cem-name-popup .leaflet-popup-close-button {
    color: #1a1a1a !important;
    background: rgba(255,255,255,0.55) !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2) !important;
    top: 10px !important;
    right: 10px !important;
}
.cem-name-popup .leaflet-popup-close-button:hover {
    color: #1a1a1a !important;
    background: rgba(255,255,255,0.9) !important;
}
.cem-name-popup .gv-popup-body { padding-right: 44px; }
.cem-name-popup .gv-popup-name { color: #1a1a1a !important; }

/* ── Leaflet popup dark theme ── */
.leaflet-popup-content-wrapper {
    background: #1a1a1a !important;
    border: 1px solid #333 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.75) !important;
    color: #e0e0e0 !important;
    padding: 0 !important;
}
/* Prevent browser-default blue link color inside popups */
.leaflet-popup-content-wrapper a { color: inherit; }
.leaflet-popup-tip { background: #1a1a1a !important; }
/* Close X — clean semi-transparent disc with a soft drop shadow.
   Sits over the tombstone photo without competing with it. */
.leaflet-popup-close-button {
    color: #fff !important;
    font: 600 15px/26px Arial, sans-serif !important;
    top: 7px !important;
    right: 7px !important;
    width: 26px !important;
    height: 26px !important;
    background: rgba(0,0,0,0.6) !important;
    border: none !important;
    border-radius: 50% !important;
    text-align: center !important;
    text-decoration: none !important;
    padding: 0 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.45) !important;
    transition: color 0.15s, background 0.15s !important;
}
.leaflet-popup-close-button:hover {
    color: #FFD700 !important;
    background: rgba(0,0,0,0.85) !important;
}
.leaflet-popup-content { margin: 0 !important; padding: 0 !important; }

/* ── Grave popup content ── */
.gv-popup { font-family: Georgia, serif; min-width: 180px; }
.gv-popup-photo {
    width: 100%; max-height: 120px;
    object-fit: cover; border-radius: 7px 7px 0 0;
    display: block;
}
.gv-popup-body { padding: 12px 14px 14px; }
.gv-popup-name { font-size: 14px; font-weight: bold; display: block; margin-bottom: 4px; color: #FFD700; }
.gv-popup-years { font-size: 12px; color: #888; margin-bottom: 12px; display: block; }
.gv-popup-link {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: #111 !important;
    background: #FFD700;
    text-decoration: none !important;
    border-radius: 5px;
    padding: 7px 0;
    text-align: center;
    transition: background 0.15s;
}
.gv-popup-link:hover { background: #e6c200 !important; color: #111 !important; }

/* Multi-person plot popup */
.gv-popup-multi .gv-popup-body { padding: 6px 14px 10px; }
.gv-multi-item {
    padding: 8px 0;
    border-bottom: 1px solid #2a2a2a;
}
.gv-multi-item:last-child { border-bottom: none; padding-bottom: 4px; }
.gv-multi-item .gv-popup-years { margin-bottom: 8px; }

/* Map legend */
.map-legend {
    position: absolute;
    bottom: 30px;
    left: 10px;
    z-index: 500;
    background: rgba(15,15,15,0.85);
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: #bbb;
    pointer-events: none;
    line-height: 1.9;
}
.map-legend span {
    display: inline-block;
    width: 12px; height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    vertical-align: middle;
    margin-right: 6px;
}
.map-legend .dot-blue  { background: #4fc3f7; }
.map-legend .dot-green { background: #4CAF50; }

/* ── Mobile ── */
@media (max-width: 700px) {
    .cem-hero h1 { font-size: 28px; }
    .cem-tab { padding: 14px 14px; font-size: 13px; }
    .cem-tab-bar { padding: 0 8px; }
    #cemMap { height: 60vh; }
    #cemAerialWrap { height: 60vh; }
}
