/* SnifSnif public map (data.kriskraw.com) — standalone, unauthenticated.
   Reproduces the pane-4 geofence map from the main dashboard, using the same
   dark-navy theme + map/marker/tooltip styling. Values copied verbatim from
   dashboard/app.css so the look matches snif.kriskraw.com exactly. */

:root {
    --bg-0: #0a1929;
    --bg-1: #0f1f33;
    --bg-2: #142a45;
    --bg-3: #1c3354;
    --border: #1f3658;
    --border-light: #2a4870;
    --text-primary: #ffffff;
    --text-secondary: #a0b4ce;
    --text-muted: #6b7f9a;
    --accent: #3d8bff;
    --accent-light: #66a3ff;
    --green: #4caf50;
    --orange: #ff9800;
    --red: #f44336;
    --yellow: #e8c547;
}

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

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg-0);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Full-viewport wrapper — the map is the whole page. */
.data-map-wrap {
    height: 100vh;
    width: 100vw;
}

.map-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: none;
    border-radius: 0;
}

/* ---------- Map toolbar (matches dashboard) ---------- */
.map-header {
    background: var(--accent-light, #66a3ff);
    color: #fff;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-bottom: 1px solid rgba(255,255,255,0.22);
    flex-shrink: 0;
}

.map-header-btn {
    background: rgba(255,255,255,0.10);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.08s;
}
.map-header-btn:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.78);
}
.map-header-btn.active {
    background: rgba(255,255,255,0.32);
    border-color: #fff;
    font-weight: 600;
}
.map-header-btn:active { transform: translateY(1px); }
.map-header-btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }
.map-header-btn:disabled:hover { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.35); }

.map-header-icon-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
    position: relative;
    color: #fff;
}
.map-header-icon-btn svg {
    width: 20px;
    height: 20px;
    display: block;
}
.map-header-btn-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #fff;
    color: var(--accent, #3d8bff);
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    pointer-events: none;
}
.map-header-icon-btn:disabled .map-header-btn-badge { display: none; }

.map-header-geofence-finish.active { background: rgba(255,255,255,0.32); }
.map-header-geofence-cancel:hover  { background: rgba(255, 90, 90, 0.45); border-color: rgba(255,255,255,0.85); }
.map-header-clear-all:hover        { background: rgba(255, 90, 90, 0.45); border-color: rgba(255,255,255,0.85); }

.map-header-spacer { flex: 1; }

.map-header-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #fff;
    white-space: nowrap;
}

/* Date row */
.map-date-range {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 13px;
}
.map-datetime-input {
    background: rgba(255,255,255,0.18);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.40);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    font-family: inherit;
    color-scheme: light;
    min-width: 175px;
}
.map-datetime-input:focus {
    outline: none;
    border-color: #fff;
    background: rgba(255,255,255,0.28);
}
.map-datetime-sep {
    color: #fff;
    opacity: 0.8;
    font-size: 14px;
    font-weight: 500;
}
.map-date-range.is-disabled .map-datetime-input,
.map-date-range.is-disabled .map-datetime-sep {
    opacity: 0.45;
}
.map-datetime-input:disabled { cursor: not-allowed; }

.map-all-dates-wrap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #fff;
    font-size: 13px;
    user-select: none;
}
.map-all-dates-wrap input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #fff;
}
.map-all-dates-label { cursor: pointer; font-weight: 500; }

/* ---------- Map canvas ---------- */
.map-canvas {
    flex: 1;
    min-height: 0;
    background: var(--bg-0);
    position: relative;
}
.map-canvas-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-style: italic;
    pointer-events: none;
    z-index: 2;
}
.map-canvas-status-floating {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    background: rgba(10, 25, 41, 0.92);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    pointer-events: none;
    z-index: 3;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 3px 12px rgba(0,0,0,0.5);
}

/* ---------- Hover tooltip ---------- */
.map-tooltip {
    position: fixed;
    z-index: 999;
    background: rgba(20, 20, 22, 0.96);
    color: #eee;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 12px;
    line-height: 1.4;
    pointer-events: none;
    max-width: 320px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
}
.map-tooltip-title {
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 3px;
    word-break: break-word;
}
.map-tooltip-addr {
    color: var(--text-primary);
    word-break: break-word;
}
.map-tooltip-date {
    color: var(--yellow);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    font-size: 11px;
}

/* ---------- Custom markers ---------- */
.gm-marker-photo,
.gm-marker-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    object-fit: cover;
    background: var(--bg-0);
    cursor: pointer;
    transform: translate(-50%, -50%);
}
.gm-marker-photo.is-paid { border-color: #ffd700; }
.gm-marker-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Geofence draw vertex dot */
.gm-fence-vertex {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3d8bff;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
}

/* ---------- Photo lightbox ---------- */
.data-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.data-lightbox[hidden] { display: none; }
.data-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 10px;
    border: 3px solid #fff;
    box-shadow: 0 8px 40px rgba(0,0,0,0.7);
}
