/* ============================================
   JSILTracker — UI Styles
   ============================================ */

/* CSS Custom Properties */
:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-surface: #eaeaea;
    --bg-surface-hover: #dcdcdc;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #999999;
    --accent: #c0392b;
    --accent-hover: #e74c3c;
    --border: #d0d0d0;
    --border-light: #e0e0e0;
    --header-height: 48px;
    --sidebar-width: 360px;
    --timeline-height: 40px;

    /* Faction colors */
    --color-iof: #2255cc;
    --color-settlers: #ff8800;
    --color-il-govt: #1a3a8a;
    --color-hamas: #006600;
    --color-pij: #228B22;
    --color-hezbollah: #FFD700;
    --color-houthis: #8B0000;
    --color-irgc: #800080;
    --color-pa: #009933;
    --color-civilians: #888888;
    --color-un: #00AAFF;
    --color-intl: #44BB44;

    /* Reliability colors */
    --reliability-green: #22cc44;
    --reliability-yellow: #ddcc00;
    --reliability-red: #cc2222;
}

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

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

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

/* ---- Header ---- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    position: relative;
}

.header-brand {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-title a {
    color: var(--text-primary);
}

.header-title a:hover {
    color: var(--accent);
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-nav {
    display: flex;
    gap: 4px;
}

.nav-tab {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.nav-tab:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--bg-surface);
    color: var(--accent);
}

.nav-action {
    background: var(--accent) !important;
    color: #fff !important;
    font-weight: 600;
}

.nav-action:hover {
    background: var(--accent-hover) !important;
    color: #fff !important;
}

.nav-support {
    background: transparent !important;
    color: var(--accent) !important;
    border: 1px solid var(--accent);
    font-weight: 600;
}

.nav-support:hover {
    background: var(--accent) !important;
    color: #fff !important;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
}

/* ---- Main Layout ---- */
.app-main {
    height: calc(100vh - var(--header-height) - var(--timeline-height));
}

.map-layout {
    display: flex;
    height: 100%;
    position: relative;
}

/* ---- Map ---- */
.map-container {
    flex: 1;
    height: 100%;
    z-index: 1;
}

/* Leaflet control overrides */
.leaflet-control-zoom a {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-surface) !important;
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8) !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
}

.leaflet-control-attribution a {
    color: var(--text-secondary) !important;
}

/* Geocoder control */
.leaflet-control-geocoder {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border) !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.leaflet-control-geocoder .leaflet-control-geocoder-icon {
    background-color: var(--bg-secondary);
    border-radius: 4px;
}

.leaflet-control-geocoder input {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: none !important;
    font-size: 0.85rem !important;
}

.leaflet-control-geocoder input::placeholder {
    color: var(--text-muted) !important;
}

.leaflet-control-geocoder-alternatives {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border) !important;
    border-top: none !important;
}

.leaflet-control-geocoder-alternatives li {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border) !important;
    font-size: 0.82rem;
}

.leaflet-control-geocoder-alternatives li:hover,
.leaflet-control-geocoder-alternatives .leaflet-control-geocoder-selected {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

/* Layer control */
.leaflet-control-layers {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.leaflet-control-layers-toggle {
    background-color: var(--bg-secondary) !important;
}

.leaflet-control-layers label {
    color: var(--text-primary) !important;
    font-size: 0.82rem;
}

.leaflet-control-layers-separator {
    border-top-color: var(--border) !important;
}

/* Custom popup styling */
.leaflet-popup-content-wrapper {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-radius: 6px !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-popup-tip {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border) !important;
}

.leaflet-popup-close-button {
    color: var(--text-secondary) !important;
}

.leaflet-popup-close-button:hover {
    color: var(--accent) !important;
}

.event-popup {
    min-width: 200px;
    max-width: 300px;
}

.event-popup h3 {
    font-size: 0.9rem;
    margin-bottom: 6px;
    line-height: 1.3;
}

.event-popup .popup-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.event-popup .popup-reliability {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-inline-end: 4px;
    vertical-align: middle;
}

.popup-reliability.green { background: var(--reliability-green); }
.popup-reliability.yellow { background: var(--reliability-yellow); }
.popup-reliability.red { background: var(--reliability-red); }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-secondary);
    border-inline-start: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 2;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-filter-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-filter-toggle:hover,
.sidebar-filter-toggle.active {
    background: var(--bg-surface);
    color: var(--accent);
    border-color: var(--accent);
}

/* Search bar (always visible) */
.sidebar-search {
    padding: 8px 14px 4px;
}

/* Filters (collapsible) */
.sidebar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 14px 8px;
    border-bottom: 1px solid var(--border);
}

.sidebar-filters[hidden] {
    display: none;
}

.filter-select {
    flex: 1;
    min-width: 100px;
    padding: 5px 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-input {
    width: 100%;
    padding: 5px 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: inherit;
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-input::placeholder {
    color: var(--text-muted);
}

.filter-date {
    width: calc(50% - 3px);
    flex: none;
}

/* Event list */
.event-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.event-list::-webkit-scrollbar {
    width: 6px;
}

.event-list::-webkit-scrollbar-track {
    background: transparent;
}

.event-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.event-list-loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Individual event card in feed */
.event-card {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    border-inline-start: 3px solid transparent;
}

.event-card:hover {
    background: var(--bg-surface);
}

.event-card.active {
    background: var(--bg-surface);
    border-inline-start-color: var(--accent);
}

/* Faction border colors */
.event-card[data-faction="iof"] { border-inline-start-color: var(--color-iof); }
.event-card[data-faction="settlers"] { border-inline-start-color: var(--color-settlers); }
.event-card[data-faction="il_govt"] { border-inline-start-color: var(--color-il-govt); }
.event-card[data-faction="hamas"] { border-inline-start-color: var(--color-hamas); }
.event-card[data-faction="pij"] { border-inline-start-color: var(--color-pij); }
.event-card[data-faction="hezbollah"] { border-inline-start-color: var(--color-hezbollah); }
.event-card[data-faction="houthis"] { border-inline-start-color: var(--color-houthis); }
.event-card[data-faction="irgc"] { border-inline-start-color: var(--color-irgc); }
.event-card[data-faction="pa"] { border-inline-start-color: var(--color-pa); }
.event-card[data-faction="civilians"] { border-inline-start-color: var(--color-civilians); }
.event-card[data-faction="un"] { border-inline-start-color: var(--color-un); }
.event-card[data-faction="intl"] { border-inline-start-color: var(--color-intl); }

.event-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.event-card-title {
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.3;
    flex: 1;
}

.event-card-reliability {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.event-card-reliability.green { background: var(--reliability-green); }
.event-card-reliability.yellow { background: var(--reliability-yellow); }
.event-card-reliability.red { background: var(--reliability-red); }

.event-card-meta {
    display: flex;
    gap: 10px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.event-card-type {
    text-transform: capitalize;
}

.event-card-casualties {
    color: var(--accent);
    font-weight: 600;
}

/* ---- Timeline Bar ---- */
.timeline-bar {
    height: var(--timeline-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.timeline-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}

.timeline-btn:hover {
    background: var(--bg-surface-hover);
}

.timeline-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 120px;
    text-align: center;
}

/* ---- Legend Panel ---- */
.legend-panel {
    position: fixed;
    top: var(--header-height);
    inset-inline-end: 0;
    width: 320px;
    height: calc(100vh - var(--header-height));
    background: var(--bg-secondary);
    border-inline-start: 1px solid var(--border);
    z-index: 1100;
    overflow-y: auto;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.legend-panel[hidden] {
    transform: translateX(100%);
    display: block;
    visibility: hidden;
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.legend-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.legend-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
}

.legend-close:hover {
    color: var(--text-primary);
}

.legend-content {
    padding: 14px 16px;
}

.legend-content h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    margin-top: 16px;
}

.legend-content h3:first-child {
    margin-top: 0;
}

.legend-list {
    list-style: none;
    margin-bottom: 12px;
}

.legend-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.legend-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot.green { background: var(--reliability-green); }
.legend-dot.yellow { background: var(--reliability-yellow); }
.legend-dot.red { background: var(--reliability-red); }

.legend-events li {
    padding: 2px 0;
    padding-inline-start: 22px;
}

/* Legend event type icons */
.legend-events-icons li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 0.8rem;
}

.legend-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: var(--text-primary);
    stroke-width: 1.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Legend territory hatch swatch */
.legend-hatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    border: 1px solid rgba(180, 40, 40, 0.4);
    border-radius: 2px;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(180, 40, 40, 0.25) 2px,
        rgba(180, 40, 40, 0.25) 4px
    );
}

/* ---- Event Detail Panel ---- */
.detail-panel {
    position: fixed;
    top: var(--header-height);
    inset-inline-end: 0;
    width: 400px;
    max-width: 100%;
    height: calc(100vh - var(--header-height) - var(--timeline-height));
    background: var(--bg-secondary);
    border-inline-start: 1px solid var(--border);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.detail-panel[hidden] {
    transform: translateX(100%);
    display: flex;
    visibility: hidden;
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.detail-header h2 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
}

.detail-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}

.detail-close:hover {
    color: var(--text-primary);
}

.detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.detail-meta-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.detail-status {
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-status.status-verified { background: rgba(34, 204, 68, 0.15); color: var(--reliability-green); }
.detail-status.status-pending { background: rgba(221, 204, 0, 0.15); color: var(--reliability-yellow); }
.detail-status.status-disputed { background: rgba(204, 34, 34, 0.15); color: var(--reliability-red); }

.detail-reliability {
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
}

.detail-reliability.green { background: rgba(34, 204, 68, 0.15); color: var(--reliability-green); }
.detail-reliability.yellow { background: rgba(221, 204, 0, 0.15); color: var(--reliability-yellow); }
.detail-reliability.red { background: rgba(204, 34, 34, 0.15); color: var(--reliability-red); }

.detail-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 3px 0;
    font-size: 0.82rem;
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    min-width: 90px;
}

.detail-casualties {
    color: var(--accent);
    font-weight: 600;
}

.detail-description {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.detail-sources {
    list-style: none;
}

.detail-sources li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 0.8rem;
}

.detail-sources a {
    color: var(--accent);
    word-break: break-all;
}

.detail-reliability-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.detail-reliability-dot.green { background: var(--reliability-green); }
.detail-reliability-dot.yellow { background: var(--reliability-yellow); }
.detail-reliability-dot.red { background: var(--reliability-red); }

.source-type {
    padding: 1px 6px;
    background: var(--bg-surface);
    border-radius: 3px;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.source-archive {
    font-size: 0.7rem;
    color: var(--text-muted) !important;
}

/* ---- Action Engagement Banner ---- */
.action-banner {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 1200;
    background: var(--bg-surface);
    border-bottom: 2px solid var(--accent);
    transform: translateY(-100%);
    transition: transform 0.4s ease;
}

.action-banner[hidden] {
    display: block;
    visibility: hidden;
}

.action-banner.visible {
    transform: translateY(0);
    visibility: visible;
}

.action-banner-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.action-banner-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.action-banner-text strong {
    color: var(--accent);
}

.action-banner-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}

.action-banner-close:hover {
    color: var(--text-primary);
}

/* ---- Action Page ---- */
.action-coming-soon {
    margin-top: 32px;
    padding: 16px;
    background: var(--bg-surface);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    font-style: italic;
}

/* ---- About Page ---- */
.about-page {
    height: 100%;
    overflow-y: auto;
    padding: 40px 20px;
}

.about-content {
    max-width: 700px;
    margin: 0 auto;
}

.about-content h1 {
    font-size: 1.6rem;
    margin-bottom: 16px;
    color: var(--accent);
}

.about-content h2 {
    font-size: 1.1rem;
    margin-top: 28px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.about-content p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.about-content ul {
    padding-inline-start: 20px;
    margin-bottom: 12px;
}

.about-content li {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.reliability-green { color: var(--reliability-green); }
.reliability-yellow { color: var(--reliability-yellow); }
.reliability-red { color: var(--reliability-red); }

/* ---- Admin & Login Forms ---- */
.admin-form {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

textarea.form-control {
    resize: vertical;
}

.form-row {
    margin-bottom: 0;
}

.form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-error {
    padding: 8px 12px;
    background: rgba(204, 34, 34, 0.15);
    color: var(--reliability-red);
    border-radius: 4px;
    font-size: 0.82rem;
    margin: 12px 0;
}

.form-success {
    padding: 8px 12px;
    background: rgba(34, 204, 68, 0.15);
    color: var(--reliability-green);
    border-radius: 4px;
    font-size: 0.82rem;
    margin: 12px 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.form-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.form-section h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
}

.btn-small {
    padding: 4px 12px;
    font-size: 0.78rem;
}

.btn-danger {
    background: #c0392b;
    color: #fff;
}

.btn-danger:hover {
    background: #e74c3c;
}

.btn-danger-outline {
    background: transparent;
    color: #c0392b;
    border: 1px solid #c0392b;
}

.btn-danger-outline:hover {
    background: rgba(192, 57, 43, 0.15);
}

/* ---- Admin Layout ---- */
.admin-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.admin-sidebar {
    width: 220px;
    background: var(--bg-secondary);
    border-inline-end: 1px solid var(--border);
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.admin-sidebar h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-nav-btn {
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    text-align: start;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
    font-family: inherit;
}

.admin-nav-btn:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.admin-nav-btn.active {
    background: var(--bg-surface);
    color: var(--accent);
}

.admin-user {
    margin-top: auto;
    padding-top: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

.admin-content h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.admin-tab {
    display: none;
}

.admin-tab.active {
    display: block;
}

.admin-event-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-event-card {
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-event-card-info h3 {
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.admin-event-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.admin-event-card-actions {
    display: flex;
    gap: 6px;
}

/* Source row in form */
.source-row {
    display: grid;
    grid-template-columns: 1fr 1fr 100px 80px 30px;
    gap: 8px;
    align-items: end;
    margin-bottom: 8px;
}

.source-remove {
    background: none;
    border: 1px solid var(--border);
    color: var(--accent);
    cursor: pointer;
    border-radius: 4px;
    font-size: 1rem;
    padding: 6px;
}

/* ---- Data Feeds ---- */
.feed-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.feed-section:last-child {
    border-bottom: none;
}

.feed-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.feed-description {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.feed-result {
    margin-top: 10px;
}

.feed-status-card {
    margin-bottom: 10px;
}

/* ---- User Management ---- */
.user-actions-bar {
    margin-bottom: 16px;
}

.user-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    vertical-align: middle;
    margin-inline-start: 6px;
}

.user-badge-active {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.user-badge-inactive {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.user-role-select {
    width: auto;
    min-width: 110px;
}

/* ---- Event Marker Icons ---- */
.event-marker {
    background: none !important;
    border: none !important;
}

/* ---- Territory Overlay ---- */
.leaflet-territories-pane {
    pointer-events: none;
}

/* ---- Apartheid Infrastructure ---- */
.checkpoint-icon {
    background: none !important;
    border: none !important;
}

.checkpoint-popup {
    min-width: 160px;
    max-width: 260px;
}

.checkpoint-popup strong {
    font-size: 0.88rem;
}

.checkpoint-popup .checkpoint-ar {
    font-size: 0.78rem;
    color: var(--text-muted);
    direction: rtl;
}

.checkpoint-popup p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}

.checkpoint-popup .road-ban {
    color: var(--accent);
    font-weight: 600;
}

.checkpoint-popup .road-partial {
    color: #b07020;
    font-weight: 500;
}

/* Infrastructure pane — lines non-interactive, checkpoints stay interactive */
.leaflet-infrastructure-pane {
    pointer-events: none;
}

.leaflet-infrastructure-pane .checkpoint-icon {
    pointer-events: auto;
}

/* Legend infrastructure swatches */
.legend-infra-wall {
    display: inline-block;
    width: 20px;
    height: 4px;
    flex-shrink: 0;
    background: repeating-linear-gradient(
        90deg,
        #b02020 0px,
        #b02020 8px,
        transparent 8px,
        transparent 11px,
        #b02020 11px,
        #b02020 13px,
        transparent 13px,
        transparent 16px
    );
    border-radius: 1px;
}

.legend-infra-checkpoint {
    flex-shrink: 0;
}

.legend-infra-road {
    display: inline-block;
    width: 20px;
    height: 3px;
    flex-shrink: 0;
    background: repeating-linear-gradient(
        90deg,
        #b02020 0px,
        #b02020 4px,
        transparent 4px,
        transparent 10px
    );
    border-radius: 1px;
    opacity: 0.7;
}

/* ---- Marker Cluster Override ---- */
.marker-cluster-small {
    background-color: rgba(233, 69, 96, 0.4) !important;
}
.marker-cluster-small div {
    background-color: rgba(233, 69, 96, 0.7) !important;
    color: #fff !important;
}

.marker-cluster-medium {
    background-color: rgba(233, 69, 96, 0.5) !important;
}
.marker-cluster-medium div {
    background-color: rgba(233, 69, 96, 0.8) !important;
    color: #fff !important;
}

.marker-cluster-large {
    background-color: rgba(233, 69, 96, 0.6) !important;
}
.marker-cluster-large div {
    background-color: rgba(233, 69, 96, 0.9) !important;
    color: #fff !important;
}

/* ---- Mobile Responsive ---- */
@media (max-width: 768px) {
    .header-subtitle {
        display: none;
    }

    .header-nav {
        display: none;
    }

    .header-nav.open {
        display: flex;
        position: absolute;
        top: var(--header-height);
        inset-inline-end: 0;
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        flex-direction: column;
        padding: 8px;
        border-radius: 0 0 6px 6px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .map-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 40%;
        border-inline-start: none;
        border-top: 1px solid var(--border);
    }

    .legend-panel {
        width: 100%;
    }

    .detail-panel {
        width: 100%;
        height: calc(100vh - var(--header-height));
        z-index: 1200;
    }

    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 8px 12px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .admin-sidebar h2 {
        margin-bottom: 0;
    }

    .admin-nav {
        flex-direction: row;
    }

    .admin-user {
        margin-top: 0;
        margin-inline-start: auto;
    }

    .admin-content {
        padding: 16px;
    }

    .source-row {
        grid-template-columns: 1fr 1fr;
    }

    .form-row.two-col {
        grid-template-columns: 1fr;
    }
}

/* ---- Palestinian Place Name Labels ---- */

.place-label {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    white-space: nowrap;
    text-shadow:
        1px 1px 2px rgba(255, 255, 255, 0.9),
        -1px -1px 2px rgba(255, 255, 255, 0.9),
        1px -1px 2px rgba(255, 255, 255, 0.9),
        -1px 1px 2px rgba(255, 255, 255, 0.9);
    pointer-events: none;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.3;
}

/* Arabic script (above English) */
.label-ar {
    direction: rtl;
    opacity: 0.55;
}

/* Region labels */
.place-label-region .label-en {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: rgba(80, 80, 100, 0.55);
}

.place-label-region .label-ar {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    color: rgba(80, 80, 100, 0.4);
}

/* City labels */
.place-label-city .label-en {
    font-size: 13px;
    font-weight: 600;
    color: #2a2a3a;
}

.place-label-city .label-ar {
    font-size: 12px;
    color: rgba(42, 42, 58, 0.6);
}

/* Town labels */
.place-label-town .label-en {
    font-size: 11px;
    font-weight: 500;
    color: #3a3a4a;
}

.place-label-town .label-ar {
    font-size: 10px;
    color: rgba(58, 58, 74, 0.5);
}

/* Destroyed village labels */
.place-label-destroyed .label-en {
    font-size: 10px;
    font-weight: 400;
    font-style: italic;
    color: rgba(140, 60, 60, 0.65);
}

.place-label-destroyed .label-ar {
    font-size: 9px;
    color: rgba(140, 60, 60, 0.4);
}

.place-label-erased .label-en {
    font-style: italic;
}

.place-label-destroyed .label-en::before {
    content: "\2022 ";
    color: rgba(180, 60, 60, 0.5);
    font-style: normal;
}

/* Labels on dark base layer */
.labels-on-dark .place-label {
    text-shadow:
        1px 1px 3px rgba(0, 0, 0, 0.9),
        -1px -1px 3px rgba(0, 0, 0, 0.9),
        1px -1px 3px rgba(0, 0, 0, 0.9),
        -1px 1px 3px rgba(0, 0, 0, 0.9);
}

.labels-on-dark .place-label-region .label-en {
    color: rgba(200, 200, 220, 0.55);
}

.labels-on-dark .place-label-region .label-ar {
    color: rgba(200, 200, 220, 0.4);
}

.labels-on-dark .place-label-city .label-en {
    color: #d0d0e0;
}

.labels-on-dark .place-label-city .label-ar {
    color: rgba(208, 208, 224, 0.6);
}

.labels-on-dark .place-label-town .label-en {
    color: #b0b0c0;
}

.labels-on-dark .place-label-town .label-ar {
    color: rgba(176, 176, 192, 0.5);
}

.labels-on-dark .place-label-destroyed .label-en {
    color: rgba(255, 140, 140, 0.65);
}

.labels-on-dark .place-label-destroyed .label-ar {
    color: rgba(255, 140, 140, 0.4);
}

.labels-on-dark .place-label-destroyed .label-en::before {
    color: rgba(255, 140, 140, 0.5);
}

@media (max-width: 768px) {
    .place-label-region .label-en { font-size: 11px; letter-spacing: 2px; }
    .place-label-region .label-ar { font-size: 10px; }
    .place-label-city .label-en { font-size: 11px; }
    .place-label-city .label-ar { font-size: 10px; }
    .place-label-town .label-en { font-size: 9px; }
    .place-label-town .label-ar { font-size: 8px; }
    .place-label-destroyed .label-en { font-size: 8px; }
    .place-label-destroyed .label-ar { font-size: 7px; }
}

/* ---- RTL Support ---- */
