/* ========================================
   Groot Incident — CSS
   Split layout met kaart + detail paneel
   ======================================== */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* --- Custom properties --- */
:root, [data-theme="dark"] {
    --gi-bg: #111827;
    --gi-surface: #1f2937;
    --gi-surface2: #283448;
    --gi-border: #374151;
    --gi-tx: #f3f4f6;
    --gi-tx2: #9ca3af;
    --gi-tx3: #6b7280;
    --gi-primary: #1a2744;
    --gi-accent: #e84c2b;
    --gi-accent-soft: rgba(232,76,43,.15);
    --gi-grip: #dc2626;
    --gi-p1: #f59e0b;
    --gi-resolved: #6b7280;
    --gi-bw: #e74c3c;
    --gi-amb: #f39c12;
    --gi-pol: #3498db;
    --gi-lfl: #9b59b6;
    --gi-knrm: #1abc9c;
    --gi-header-bg: #0f172a;
    --gi-radius: 8px;
    --gi-shadow: 0 1px 3px rgba(0,0,0,.3);
}
[data-theme="light"] {
    --gi-bg: #f0f2f5;
    --gi-surface: #ffffff;
    --gi-surface2: #f8f9fa;
    --gi-border: #e5e7eb;
    --gi-tx: #1a1a2e;
    --gi-tx2: #6b7280;
    --gi-tx3: #9ca3af;
    --gi-header-bg: #1a2744;
    --gi-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* --- Base --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gi-tx);
    background: var(--gi-bg);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* --- Skip link --- */
.gi-skip-link {
    position: absolute; top: -100%; left: 16px;
    background: var(--gi-accent); color: #fff;
    padding: 8px 16px; border-radius: 4px; z-index: 10000;
    font-size: 14px;
}
.gi-skip-link:focus { top: 8px; }

/* ===== Header ===== */
.gi-header {
    display: flex; align-items: center; gap: 16px;
    padding: 0 20px; height: 52px;
    background: var(--gi-header-bg); color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.06);
    position: relative; z-index: 100;
}
.gi-header-brand {
    display: flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: 16px; color: #fff;
    text-decoration: none; white-space: nowrap;
}
.gi-logo-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--gi-accent); color: #fff;
    font-weight: 900; font-size: 16px;
}
.gi-logo-text { font-size: 16px; }
.gi-header-nav { display: flex; align-items: center; gap: 12px; }
.gi-nav-link {
    font-size: 13px; color: rgba(255,255,255,.7); padding: 4px 8px;
    border-radius: 4px; transition: color .15s;
}
.gi-nav-link:hover, .gi-nav-link.active { color: #fff; }
.gi-province-select {
    background: rgba(255,255,255,.08); color: #fff;
    border: 1px solid rgba(255,255,255,.15); border-radius: 6px;
    padding: 5px 10px; font-size: 13px; cursor: pointer;
}
.gi-province-select option { background: var(--gi-surface); color: var(--gi-tx); }
.gi-header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.gi-btn-icon {
    background: none; border: none; color: rgba(255,255,255,.7);
    cursor: pointer; padding: 6px; border-radius: 4px; display: flex;
    align-items: center; justify-content: center;
}
.gi-btn-icon:hover { background: rgba(255,255,255,.1); color: #fff; }
.gi-mobile-toggle { display: none; font-size: 12px; }

/* User dropdown */
.gi-user-wrapper { position: relative; }
.gi-user-btn {
    display: flex; align-items: center; gap: 6px;
    background: none; border: none; color: rgba(255,255,255,.8);
    cursor: pointer; padding: 4px 8px; border-radius: 6px; font-size: 13px;
}
.gi-user-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.gi-user-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--gi-accent); color: #fff;
    font-weight: 700; font-size: 12px;
}
.gi-user-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-user-dropdown {
    display: none; position: absolute; right: 0; top: 100%; margin-top: 4px;
    background: var(--gi-surface); border: 1px solid var(--gi-border);
    border-radius: 8px; min-width: 160px; padding: 4px 0;
    box-shadow: 0 8px 24px rgba(0,0,0,.3); z-index: 200;
}
.gi-user-dropdown.open { display: block; }
.gi-dropdown-item {
    display: block; padding: 8px 14px; font-size: 13px;
    color: var(--gi-tx); text-decoration: none; cursor: pointer;
    background: none; border: none; width: 100%; text-align: left; font-family: inherit;
}
.gi-dropdown-item:hover { background: var(--gi-surface2); }
.gi-dropdown-divider { height: 1px; background: var(--gi-border); margin: 4px 0; }
.gi-dropdown-logout { color: var(--gi-accent); }

/* ===== Split layout ===== */
.gi-split {
    display: grid;
    grid-template-columns: 45fr 55fr;
    height: calc(100vh - 52px);
}
.gi-map-pane { position: relative; }
.gi-map { width: 100%; height: 100%; }
.gi-detail-pane {
    overflow-y: auto; background: var(--gi-bg);
    display: flex; flex-direction: column;
}
.gi-panel-content { padding: 20px 24px; flex: 1; }

/* ===== Breadcrumb ===== */
.gi-breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--gi-tx3); margin-bottom: 16px;
}
.gi-breadcrumb a { color: var(--gi-tx2); }
.gi-breadcrumb a:hover { color: var(--gi-accent); }

/* ===== Incident cards ===== */
.gi-incident-list { display: flex; flex-direction: column; gap: 10px; }
.gi-card {
    display: block; padding: 14px 16px;
    background: var(--gi-surface); border: 1px solid var(--gi-border);
    border-radius: var(--gi-radius); transition: border-color .15s, transform .1s;
    cursor: pointer;
}
.gi-card:hover { border-color: var(--gi-accent); transform: translateX(2px); }
.gi-card--resolved { opacity: .65; }
.gi-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.gi-card-badges { display: flex; gap: 5px; }
.gi-card-time { font-size: 12px; color: var(--gi-tx3); white-space: nowrap; }
.gi-card-title { font-size: 15px; font-weight: 600; line-height: 1.4; margin-bottom: 6px; }
.gi-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; color: var(--gi-tx3);
}
.gi-card-location {
    display: inline-flex; align-items: center; gap: 4px;
}
.gi-card-stat { white-space: nowrap; }
.gi-card-stats { white-space: nowrap; font-size: 12px; color: var(--gi-tx3); }

/* ===== Badges ===== */
.gi-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
}
.gi-badge--grip { background: var(--gi-grip); color: #fff; }
.gi-badge--groot { background: #c0392b; color: #fff; }
.gi-badge--middel { background: #e67e22; color: #fff; }
.gi-badge--p1 { background: var(--gi-p1); color: #000; }
.gi-badge--resolved { background: var(--gi-resolved); color: #fff; }

.gi-disc {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    font-size: 10px; font-weight: 700; color: #fff;
}
.gi-disc--bw { background: var(--gi-bw); }
.gi-disc--amb { background: var(--gi-amb); }
.gi-disc--pol { background: var(--gi-pol); }
.gi-disc--life { background: var(--gi-lfl); }
.gi-disc--knrm { background: var(--gi-knrm); }
.gi-disc--vr, .gi-disc--over { background: var(--gi-tx3); }

/* ===== Pagination ===== */
.gi-pagination {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 20px 0; margin-top: 8px;
}
.gi-pagination-btn {
    padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600;
    background: var(--gi-surface); border: 1px solid var(--gi-border); color: var(--gi-tx);
}
.gi-pagination-btn:hover { border-color: var(--gi-accent); color: var(--gi-accent); }
.gi-pagination-info { font-size: 13px; color: var(--gi-tx3); }

/* ===== Detail page ===== */
.gi-detail-header { margin-bottom: 24px; }
.gi-detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.gi-detail-title { font-size: 22px; font-weight: 800; line-height: 1.3; margin-bottom: 8px; }
.gi-detail-location {
    display: flex; align-items: center; gap: 6px;
    font-size: 14px; color: var(--gi-tx2); margin-bottom: 8px;
}
.gi-detail-meta {
    display: flex; flex-wrap: wrap; gap: 12px;
    font-size: 13px; color: var(--gi-tx3); margin-bottom: 12px;
}
.gi-detail-intro {
    font-size: 15px; line-height: 1.7; color: var(--gi-tx2);
    margin-bottom: 16px;
}
.gi-detail-province { color: var(--gi-tx3); }
.gi-tl-escalation {
    font-size: 13px; font-weight: 700; color: #f59e0b;
    padding: 6px 12px; background: rgba(245, 158, 11, .1);
    border-radius: 6px; border-left: 3px solid #f59e0b;
}

/* Share buttons */
.gi-share { display: flex; gap: 8px; }
.gi-share-btn {
    padding: 6px 14px; border-radius: 6px;
    font-size: 12px; font-weight: 600; color: #fff;
}
.gi-share-wa { background: #25d366; }
.gi-share-x { background: #000; }
.gi-share-fb { background: #1877f2; }
.gi-share-btn:hover { opacity: .85; }

/* ===== Timeline ===== */
.gi-timeline-section { margin-top: 24px; }
.gi-timeline-filters {
    display: flex; gap: 6px; margin-bottom: 16px;
    flex-wrap: wrap;
}
.gi-tl-filter {
    padding: 5px 12px; border-radius: 16px;
    font-size: 12px; font-weight: 600;
    background: var(--gi-surface); border: 1px solid var(--gi-border);
    color: var(--gi-tx2); cursor: pointer;
}
.gi-tl-filter:hover { border-color: var(--gi-tx3); }
.gi-tl-filter.active { background: var(--gi-accent); border-color: var(--gi-accent); color: #fff; }

.gi-timeline {
    list-style: none; position: relative;
    border-left: 2px solid var(--gi-border);
    margin-left: 10px; padding-left: 24px;
}
.gi-tl-item { position: relative; padding-bottom: 20px; }
.gi-tl-item[hidden] { display: none; }
.gi-tl-marker {
    position: absolute; left: -33px; top: 2px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--gi-tx3); border: 2px solid var(--gi-surface);
    box-shadow: 0 0 0 1px var(--gi-border);
}
.gi-tl-marker--p2000 { background: var(--gi-accent); }
.gi-tl-marker--photo { background: #8b5cf6; }
.gi-tl-marker--news { background: #3b82f6; }
.gi-tl-marker--reaction { background: #10b981; }
.gi-tl-marker--escalation { background: #f59e0b; width: 14px; height: 14px; left: -34px; top: 0; }
.gi-tl-marker--resolved { background: var(--gi-resolved); }
.gi-tl-content { display: flex; flex-direction: column; gap: 4px; }
.gi-tl-time { font-size: 12px; color: var(--gi-tx3); font-weight: 600; }
.gi-tl-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: .5px;
    font-weight: 700; color: var(--gi-tx3);
}
.gi-tl-p2000 {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px; line-height: 1.5;
    background: var(--gi-surface2); padding: 8px 12px;
    border-radius: 6px; border-left: 3px solid var(--gi-accent);
    color: var(--gi-tx2);
}
.gi-tl-unit {
    font-size: 14px; line-height: 1.7;
    padding: 8px 12px; background: var(--gi-surface2); border-radius: 6px;
    border-left: 3px solid var(--gi-accent);
}
.gi-tl-unit p { margin: 0 0 2px; }
.gi-tl-unit p:last-child { margin-bottom: 0; }
.gi-tl-news-text {
    font-size: 14px; line-height: 1.6;
    padding: 8px 12px; background: var(--gi-surface2); border-radius: 6px;
    border-left: 3px solid #3b82f6;
}
.gi-tl-source { color: var(--gi-accent); font-weight: 600; white-space: nowrap; }
.gi-tl-source:hover { text-decoration: underline; }
.gi-tl-credit { display: block; font-size: 11px; color: var(--gi-tx3); margin-top: 2px; }
.gi-tl-photo img {
    max-width: 100%; border-radius: 6px;
    max-height: 300px; object-fit: cover;
}
.gi-tl-photo figcaption { font-size: 12px; color: var(--gi-tx3); margin-top: 4px; }
.gi-tl-link { color: var(--gi-accent); font-size: 13px; }
.gi-tl-link:hover { text-decoration: underline; }
.gi-tl-arrow { font-size: 14px; }
.gi-tl-reaction { font-size: 14px; line-height: 1.6; }
.gi-tl-reaction p { margin-bottom: 6px; }
.gi-tl-reaction cite {
    display: block; font-size: 12px; color: var(--gi-tx3); font-style: normal;
}
.gi-verified {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    background: #3b82f6; color: #fff; font-size: 10px; vertical-align: middle;
    margin-left: 4px;
}
.gi-org { color: var(--gi-tx2); margin-left: 4px; }

/* ===== Contribute ===== */
.gi-contribute {
    margin-top: 32px; padding-top: 24px;
    border-top: 1px solid var(--gi-border);
}
.gi-contribute-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.gi-contribute-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.gi-tab {
    padding: 6px 14px; border-radius: 16px; font-size: 13px; font-weight: 600;
    background: var(--gi-surface); border: 1px solid var(--gi-border);
    color: var(--gi-tx2); cursor: pointer;
}
.gi-tab:hover { border-color: var(--gi-tx3); }
.gi-tab.active { background: var(--gi-accent); border-color: var(--gi-accent); color: #fff; }

.gi-form { display: flex; flex-direction: column; gap: 12px; }
.gi-form-group { display: flex; flex-direction: column; gap: 4px; }
.gi-form-group label { font-size: 12px; font-weight: 600; color: var(--gi-tx2); }
.gi-form-group input, .gi-form-group textarea {
    padding: 8px 12px; border: 1px solid var(--gi-border); border-radius: 6px;
    background: var(--gi-surface); color: var(--gi-tx); font-size: 14px;
    font-family: inherit; outline: none;
}
.gi-form-group input:focus, .gi-form-group textarea:focus {
    border-color: var(--gi-accent);
}
.gi-form-submit {
    padding: 10px 20px; border-radius: 8px; border: none;
    background: var(--gi-accent); color: #fff;
    font-weight: 600; font-size: 14px; cursor: pointer; align-self: flex-start;
}
.gi-form-submit:hover { opacity: .9; }
.gi-form-feedback { font-size: 13px; min-height: 20px; }
.gi-form-feedback.success { color: #10b981; }
.gi-form-feedback.error { color: #ef4444; }

/* ===== Search ===== */
.gi-search-form { display: flex; gap: 8px; margin-bottom: 20px; }
.gi-search-input-wrap {
    flex: 1; display: flex; align-items: center; gap: 8px;
    background: var(--gi-surface); border: 1px solid var(--gi-border);
    border-radius: 8px; padding: 0 12px;
}
.gi-search-input-wrap svg { color: var(--gi-tx3); flex-shrink: 0; }
.gi-search-input {
    flex: 1; border: none; background: none; color: var(--gi-tx);
    font-size: 15px; padding: 10px 0; outline: none;
}
.gi-search-input::placeholder { color: var(--gi-tx3); }
.gi-search-btn {
    padding: 10px 20px; border-radius: 8px;
    background: var(--gi-accent); color: #fff; border: none;
    font-weight: 600; font-size: 14px; cursor: pointer;
}
.gi-search-btn:hover { opacity: .9; }
.gi-search-count { font-size: 14px; color: var(--gi-tx2); margin-bottom: 16px; }

/* ===== Footer ===== */
.gi-footer {
    padding: 16px 24px; border-top: 1px solid var(--gi-border);
    margin-top: auto;
}
.gi-footer-inner {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--gi-tx3);
}
.gi-footer-inner a { color: var(--gi-tx2); }
.gi-footer-inner a:hover { color: var(--gi-accent); }
.gi-footer-sep { opacity: .4; }

/* ===== Static pages ===== */
.gi-static-page h1 { font-size: 22px; font-weight: 800; margin-bottom: 16px; }
.gi-static-page h2 { font-size: 16px; font-weight: 700; margin: 20px 0 8px; }
.gi-static-page p { font-size: 14px; line-height: 1.7; color: var(--gi-tx2); margin-bottom: 8px; }
.gi-static-page ul { padding-left: 20px; margin-bottom: 12px; }
.gi-static-page li { font-size: 14px; line-height: 1.7; color: var(--gi-tx2); margin-bottom: 4px; }
.gi-static-page a { color: var(--gi-accent); }
.gi-static-page a:hover { text-decoration: underline; }
.gi-static-page section { margin-bottom: 16px; }
.gi-back-link {
    display: inline-block; margin-top: 24px; padding: 8px 0;
    font-size: 14px; color: var(--gi-accent); font-weight: 600;
}

/* ===== Account ===== */
.gi-account-card {
    background: var(--gi-surface); border: 1px solid var(--gi-border);
    border-radius: 10px; padding: 4px 0; margin-bottom: 20px;
}
.gi-account-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 20px; border-bottom: 1px solid var(--gi-border);
}
.gi-account-row:last-child { border-bottom: none; }
.gi-account-label { font-size: 13px; color: var(--gi-tx3); font-weight: 600; }
.gi-account-value { font-size: 14px; }
.gi-account-actions { margin-bottom: 24px; }
.gi-account-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 8px;
    background: var(--gi-accent); color: #fff;
    font-weight: 600; font-size: 14px; text-decoration: none;
}
.gi-account-btn:hover { opacity: .9; }
.gi-account-tip {
    background: var(--gi-surface); border: 1px solid var(--gi-border);
    border-radius: 10px; padding: 16px 20px;
}
.gi-account-tip h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.gi-account-tip p { font-size: 13px; color: var(--gi-tx2); line-height: 1.6; }

/* ===== Empty state ===== */
.gi-empty { padding: 40px; text-align: center; color: var(--gi-tx3); }

/* ===== Leaflet overrides ===== */
.gi-map .leaflet-control-zoom { border-radius: 8px; }
.gi-tiles-dark { filter: brightness(1.15) saturate(.9); }
.leaflet-div-icon.gi-marker { background: transparent; border: none; box-shadow: none; }
.gi-map .leaflet-popup-content-wrapper { background: var(--gi-surface); color: var(--gi-tx); border-radius: 8px; }
.gi-map .leaflet-popup-tip { background: var(--gi-surface); }
.gi-map .leaflet-popup-content a { color: var(--gi-accent); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .gi-split { grid-template-columns: 1fr; }
    .gi-map-pane { height: 40vh; }
    .gi-detail-pane { height: auto; overflow: visible; }
    body { overflow: auto; height: auto; }
    .gi-mobile-toggle { display: flex; }
    .gi-logo-text { display: none; }

    .gi-split.show-detail .gi-map-pane { display: none; }
    .gi-split.show-detail .gi-detail-pane { height: auto; }
    .gi-split:not(.show-detail) .gi-detail-pane { display: none; }
    .gi-split:not(.show-detail) .gi-map-pane { height: calc(100vh - 52px); }
}
