/* RSG House of Worship Incident Tracker: page styles, moved from the old plugin template. Menu and footer rules removed (they live in base.css). */
/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; font-family: 'Red Hat Display', Arial, sans-serif; background: #0D1020; color: #fff; -webkit-font-smoothing: antialiased; }

/* ── Nav ──────────────────────────────────────────────────── */

/* ── Layout ───────────────────────────────────────────────── */
.app-wrap {
  position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0;
  z-index: 1; /* keeps the map and its controls under the site menu */
  display: flex; flex-direction: column;
}

/* ── Stats Bar ────────────────────────────────────────────── */
.stats-bar {
  flex-shrink: 0; height: 44px;
  display: flex; align-items: center; gap: 0;
  background: #1A1E2D; border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 20px; overflow-x: auto;
}
.stat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px; border-right: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
}
.stat-item:first-child { padding-left: 0; }
.stat-num { font-size: 16px; font-weight: 900; color: #fff; }
.stat-label { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.4); }
.stat-update { font-size: 10px; color: rgba(255,255,255,0.25); margin-left: auto; padding-left: 20px; white-space: nowrap; }

/* ── Filter Bar ───────────────────────────────────────────── */
.filter-bar {
  flex-shrink: 0;
  background: #0D1020; border-bottom: 1px solid rgba(255,255,255,0.05);
  padding: 0 16px;
}
.filter-row {
  display: flex; align-items: center; gap: 6px;
  height: 40px; overflow-x: auto;
}
.filter-row + .filter-row {
  border-top: 1px solid rgba(255,255,255,0.04);
}
.filter-bar label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(255,255,255,0.35); margin-right: 6px; white-space: nowrap; flex-shrink: 0;
}
.filter-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 2px;
  font-family: inherit; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.55); cursor: pointer; transition: all .2s; white-space: nowrap; flex-shrink: 0;
}
.filter-btn .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.filter-btn.active { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); color: #fff; }
.filter-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* date filter buttons */
.date-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 2px;
  font-family: inherit; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.55); cursor: pointer; transition: all .2s; white-space: nowrap; flex-shrink: 0;
}
.date-btn.active { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); color: #fff; }
.date-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* view toggle */
.view-toggle {
  margin-left: auto; display: flex; gap: 4px; flex-shrink: 0;
}
.view-btn {
  padding: 4px 10px; border-radius: 2px;
  font-family: inherit; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.45); cursor: pointer; transition: all .2s;
}
.view-btn.active { background: rgba(190,52,49,0.2); border-color: rgba(190,52,49,0.5); color: #fff; }

/* ── Map + Detail layout ──────────────────────────────────── */
.map-area {
  flex: 1; display: flex; min-height: 0; position: relative;
}
#rsg-map { flex: 1; }

/* ── List View ────────────────────────────────────────────── */
#list-view {
  flex: 1; overflow-y: auto; display: none;
  background: #0D1020;
}
#list-view.visible { display: block; }
.list-header {
  display: grid;
  grid-template-columns: 90px 110px 140px 1fr 90px 70px;
  gap: 0; padding: 0 20px;
  background: #1A1E2D; border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky; top: 0; z-index: 10;
}
.list-header span {
  font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(255,255,255,0.35); padding: 10px 8px;
}
.list-row {
  display: grid;
  grid-template-columns: 90px 110px 140px 1fr 90px 70px;
  gap: 0; padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer; transition: background .15s;
  align-items: center;
}
.list-row:hover { background: rgba(255,255,255,0.03); }
.list-row > span {
  font-size: 11px; color: rgba(255,255,255,0.65); padding: 10px 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-row .list-title { color: rgba(255,255,255,0.85); font-weight: 600; white-space: normal; line-height: 1.3; }
.list-type-badge {
  display: inline-block; padding: 2px 7px; border-radius: 2px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.list-count {
  font-size: 11px; color: rgba(255,255,255,0.3);
  padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,0.05);
  font-weight: 600; letter-spacing: 0.04em;
}
@media (max-width: 640px) {
  .list-header { grid-template-columns: 80px 1fr 80px; }
  .list-header span:nth-child(2), .list-header span:nth-child(3), .list-header span:nth-child(5) { display: none; }
  .list-row { grid-template-columns: 80px 1fr 80px; }
  .list-row > span:nth-child(2), .list-row > span:nth-child(3), .list-row > span:nth-child(5) { display: none; }}

/* ── Detail Panel ─────────────────────────────────────────── */
.detail-panel {
  width: 320px; flex-shrink: 0;
  background: #1A1E2D;
  border-left: 1px solid rgba(255,255,255,0.07);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s ease;
  position: absolute; right: 0; top: 0; bottom: 0; z-index: 500;
}
.detail-panel.open { transform: translateX(0); }
.detail-header {
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
}
.detail-close {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06); border: none; cursor: pointer;
  color: rgba(255,255,255,0.6); font-size: 16px; border-radius: 2px;
}
.detail-close:hover { background: rgba(255,255,255,0.12); color: #fff; }
#detail-content { flex: 1; overflow-y: auto; min-height: 0; }
.detail-body { padding: 20px; }
.detail-type-badge {
  display: inline-block; padding: 4px 10px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  border-radius: 2px; margin-bottom: 12px;
}
.detail-title { font-size: 15px; font-weight: 700; line-height: 1.4; color: #fff; margin-bottom: 8px; }
.detail-meta { font-size: 11px; color: rgba(255,255,255,0.45); margin-bottom: 16px; }
.detail-synopsis { font-size: 13px; font-weight: 400; line-height: 1.7; color: rgba(255,255,255,0.75); margin-bottom: 16px; }
.detail-row { display: flex; gap: 8px; margin-bottom: 6px; }
.detail-row-label { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.3); width: 90px; flex-shrink: 0; padding-top: 1px; }
.detail-row-val { font-size: 12px; color: rgba(255,255,255,0.7); }
.detail-divider { border: none; border-top: 1px solid rgba(255,255,255,0.07); margin: 14px 0; }
.detail-source { font-size: 11px; color: #BE3431; text-decoration: none; word-break: break-all; }
.detail-source:hover { color: #d55f5b; }
.detail-placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px; text-align: center;
}
.detail-placeholder svg { opacity: 0.15; margin-bottom: 16px; }
.detail-placeholder p { font-size: 13px; color: rgba(255,255,255,0.3); line-height: 1.6; }

/* ── Assessment CTA (in detail panel) ────────────────────── */
.detail-cta {
  margin: 0; padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: rgba(190,52,49,0.06);
  flex-shrink: 0;
}
.detail-cta p {
  font-size: 11px; color: rgba(255,255,255,0.45); line-height: 1.5; margin-bottom: 10px;
}
.detail-cta a {
  display: block; text-align: center;
  padding: 9px 16px; background: #BE3431; color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  text-decoration: none; border-radius: 2px; transition: background .2s;
}
.detail-cta a:hover { background: #d55f5b; }

/* ── Loading overlay ──────────────────────────────────────── */
.map-loading {
  position: absolute; inset: 0; z-index: 999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #0D1020; gap: 16px;
}
.map-loading.hidden { display: none; }
.spinner { width: 36px; height: 36px; border: 3px solid rgba(255,255,255,0.1); border-top-color: #BE3431; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.map-loading p { font-size: 12px; color: rgba(255,255,255,0.4); letter-spacing: 0.1em; text-transform: uppercase; }

/* ── Leaflet overrides ────────────────────────────────────── */
.leaflet-container { background: #0D1020; }
.leaflet-popup-content-wrapper { background: #1A1E2D; border: 1px solid rgba(255,255,255,0.1); border-radius: 3px; box-shadow: 0 4px 24px rgba(0,0,0,0.5); }
.leaflet-popup-content { color: #fff; font-family: 'Red Hat Display', Arial, sans-serif; margin: 14px 16px; }
.leaflet-popup-tip { background: #1A1E2D; }
.leaflet-popup-close-button { color: rgba(255,255,255,0.5) !important; font-size: 18px !important; }
.leaflet-popup-close-button:hover { color: #fff !important; }
.popup-type { font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px; }
.popup-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.popup-meta { font-size: 11px; color: rgba(255,255,255,0.45); margin-bottom: 8px; }
.popup-source { font-size: 10px; color: #BE3431; text-decoration: none; display: block; margin-bottom: 8px; }
.popup-source:hover { color: #d55f5b; }
.popup-btn { display: inline-block; margin-top: 2px; padding: 6px 14px; background: #BE3431; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; border: none; cursor: pointer; font-family: inherit; }
.popup-btn:hover { background: #d55f5b; }

/* ── Cluster overrides ────────────────────────────────────── */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(190,52,49,0.25) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: rgba(190,52,49,0.7) !important; color: #fff !important; font-family: 'Red Hat Display', Arial, sans-serif !important; font-weight: 700 !important; font-size: 12px !important; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .detail-panel { width: 100%; }
  .stats-bar { gap: 0; padding: 0 12px; }
  .stat-item { padding: 0 12px; }}

.admin-bar .app-wrap { top: calc(var(--nav-h) + 32px); }
@media (max-width: 782px) { .admin-bar .app-wrap { top: calc(var(--nav-h) + 46px); } }

/* ── About This Tracker (was the RSG HOW Tracker Explainer plugin) ── */
/* Button */
    #rsg-tracker-about-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: rgba(255,255,255,0.06);
        border: 1px solid rgba(255,255,255,0.15);
        color: rgba(255,255,255,0.5);
        font-family: "Red Hat Display", "Helvetica Neue", Arial, sans-serif;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        padding: 6px 12px;
        cursor: pointer;
        margin: 10px 0 10px 16px;
        line-height: 1;
    }
    #rsg-tracker-about-btn:hover {
        background: rgba(255,255,255,0.1);
        color: rgba(255,255,255,0.75);
    }
    #rsg-tracker-about-btn svg {
        flex-shrink: 0;
    }

    /* Modal overlay */
    #rsg-tracker-modal-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.75);
        z-index: 99999;
        align-items: center;
        justify-content: center;
        padding: 24px 16px;
        box-sizing: border-box;
    }
    #rsg-tracker-modal-overlay.open { display: flex; }

    /* Modal box */
    #rsg-tracker-modal {
        background: #0D1020;
        border: 1px solid rgba(255,255,255,0.1);
        max-width: 500px;
        width: 100%;
        padding: 28px 24px 24px;
        position: relative;
        box-sizing: border-box;
        font-family: "Red Hat Display", "Helvetica Neue", Arial, sans-serif;
    }
    #rsg-tracker-modal-close {
        position: absolute;
        top: 12px;
        right: 16px;
        background: none;
        border: none;
        color: rgba(255,255,255,0.35);
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
        padding: 0;
    }
    #rsg-tracker-modal-close:hover { color: rgba(255,255,255,0.8); }
    .rsg-modal-label {
        font-size: 8px;
        font-weight: 700;
        letter-spacing: 0.2em;
        text-transform: uppercase;
        color: rgba(255,255,255,0.3);
        margin-bottom: 10px;
    }
    .rsg-modal-body {
        font-size: 13px;
        font-weight: 300;
        line-height: 1.75;
        color: rgba(255,255,255,0.6);
        margin: 0 0 20px;
    }
    .rsg-modal-notice {
        background: rgba(190,52,49,0.08);
        border: 1px solid rgba(190,52,49,0.22);
        border-left: 3px solid #BE3431;
        padding: 12px 14px;
    }
    .rsg-modal-notice-title {
        font-size: 8px;
        font-weight: 700;
        letter-spacing: 0.18em;
        text-transform: uppercase;
        color: #BE3431;
        margin-bottom: 6px;
    }
    .rsg-modal-notice-text {
        font-size: 12px;
        font-weight: 400;
        line-height: 1.65;
        color: rgba(255,255,255,0.5);
        margin: 0;
    }
    .rsg-modal-notice-text strong {
        color: rgba(255,255,255,0.8);
        font-weight: 600;
    }
