* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent: #2ecc71;
    --accent-secondary: #43b581;
    --bg-dark: #0f1115;
    --bg-panel: #16181d;
    --bg-hover: #1e2128;
    --border: #2a2d35;
    --text: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-muted: #5f6368;
    --danger: #ea4335;
    --warning: #fbbc04;
    --radius: 8px;
    --radius-sm: 4px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
}

/* ========== NAVBAR ========== */
.navbar {
    height: 56px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 16px;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.nav-logo-img {
    height: 32px;
    max-width: 180px;
    width: auto;
    object-fit: contain;
}

.nav-title {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-site {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.nav-community {
    font-size: 12px;
    color: var(--text-secondary);
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(234, 67, 53, 0.2);
    transition: all 0.3s;
}

.status-dot.online {
    background: var(--accent-secondary);
    box-shadow: 0 0 0 3px rgba(67, 181, 129, 0.2);
}

.status-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.server-players {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.server-players svg {
    opacity: 0.6;
}

/* Nav Indicators */
.nav-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.aop-indicator {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.peacetime-indicator {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    animation: peacetimePulse 2s ease-in-out infinite;
}

@keyframes peacetimePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--accent);
    color: white;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}

.nav-btn:hover {
    filter: brightness(1.1);
}

.nav-btn-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== APP LAYOUT ========== */
.app {
    display: flex;
    height: calc(100vh - 56px);
    transition: all 0.3s;
}

.app.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    z-index: 1000;
}

.app.fullscreen .navbar {
    display: none;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 300px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: width 0.2s, margin 0.2s;
    z-index: 50;
}

.sidebar.collapsed {
    width: 0;
    margin-left: -1px;
}

.sidebar.collapsed .panel {
    opacity: 0;
    pointer-events: none;
}

.sidebar-toggle {
    position: absolute;
    right: -14px;
    top: 20px;
    width: 28px;
    height: 28px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.sidebar.collapsed .sidebar-toggle {
    right: -42px;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* ========== PANELS ========== */
.panel {
    border-bottom: 1px solid var(--border);
    transition: opacity 0.2s;
}

.panel-players {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    gap: 8px;
}

.panel-header:hover {
    background: var(--bg-hover);
}

.panel-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    flex: 1;
}

.panel-count {
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.panel-count.call-count {
    background: var(--danger);
}

.panel-chevron {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.panel.collapsed .panel-chevron {
    transform: rotate(-90deg);
}

.panel.collapsed .panel-body {
    display: none;
}

.panel-search {
    margin: 0 12px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-dark);
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: border 0.15s;
}

.panel-search:focus-within {
    border-color: var(--accent);
}

.panel-search svg {
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 12px;
}

.panel-search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-size: 13px;
    padding: 10px 12px 10px 0;
    outline: none;
}

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

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 8px;
}

/* ========== PLAYER LIST ========== */
.player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 2px;
}

.player:hover {
    background: var(--bg-hover);
}

.player.selected {
    background: var(--accent);
}

.player-sprite {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #6b7280;
    border: 2px solid rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.player-sprite svg {
    width: 20px;
    height: 20px;
    color: white;
}

.player-sprite.sirens {
    animation: sirenFlash 0.5s ease-in-out infinite;
}

.player.selected .player-sprite {
    border-color: white;
    box-shadow: 0 0 0 2px var(--accent);
}

.player-info {
    flex: 1;
    min-width: 0;
}

.player-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-meta,
.player-id {
    font-size: 12px;
    color: var(--text-muted);
}

.player.selected .player-meta,
.player.selected .player-id {
    color: rgba(255,255,255,0.7);
}

.player-dept {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    color: white;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.siren-icon {
    font-size: 10px;
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.player-stats {
    display: flex;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
}

.stat-hp { color: var(--danger); }
.stat-armor { color: #3b82f6; }

/* ========== CALLS LIST ========== */
.call-item {
    padding: 12px;
    background: var(--bg-dark);
    border-radius: var(--radius);
    margin-bottom: 6px;
    cursor: pointer;
    border-left: 3px solid var(--danger);
    transition: background 0.15s;
}

.call-item:hover {
    background: var(--bg-hover);
}

.call-item.call-311 {
    border-left-color: var(--warning);
}

.call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.call-type-badge {
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 700;
}

.call-item.call-311 .call-type-badge {
    background: var(--warning);
    color: #000;
}

.call-time {
    font-size: 11px;
    color: var(--text-muted);
}

.call-item .call-message {
    font-size: 13px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.call-caller {
    font-size: 11px;
    color: var(--text-muted);
}

/* ========== FILTERS ========== */
.filter-section {
    margin-bottom: 16px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding: 0 4px;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.filter-toggle:hover {
    background: var(--bg-hover);
}

.filter-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.filter-toggle span {
    font-size: 13px;
    color: var(--text-secondary);
}

.filter-dept {
    position: relative;
    padding-left: 16px;
}

.filter-dept::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--dept-color);
}

/* ========== BLIP LIST ========== */
.blip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    transition: all 0.15s;
}

.blip:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.blip-icon {
    width: 8px;
    height: 8px;
    background: var(--warning);
    border-radius: 50%;
    flex-shrink: 0;
}

/* ========== SETTINGS ========== */
.setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.15s;
}

.setting:hover {
    background: var(--bg-hover);
}

.setting span {
    font-size: 13px;
    color: var(--text-secondary);
}

.setting input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
}

.empty-state.small {
    padding: 20px;
}

.empty-state svg {
    opacity: 0.4;
}

.empty-state p {
    font-size: 13px;
}

/* ========== MAP ========== */
.map-area {
    flex: 1;
    position: relative;
    background: var(--bg-dark);
}

#map {
    width: 100%;
    height: 100%;
    background: #0a0c0f;
}

.map-tools {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
}

.tool-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.tool-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.map-coords {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    z-index: 1000;
    display: flex;
    gap: 12px;
}

/* ========== MODAL ========== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 380px;
    max-width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.modal-body {
    padding: 16px 20px;
}

.modal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.modal-row:last-child {
    border-bottom: none;
}

.modal-label {
    font-size: 13px;
    color: var(--text-muted);
}

.modal-value {
    font-weight: 500;
}

.duty-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.5px;
}

.siren-indicator {
    animation: pulse 0.5s ease-in-out infinite;
}

.bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 180px;
}

.bar-track {
    flex: 1;
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.bar-fill.hp { background: var(--danger); }
.bar-fill.armor { background: #3b82f6; }

.bar span {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 36px;
    text-align: right;
}

/* ========== LEAFLET OVERRIDES ========== */
.leaflet-container {
    background: #0a0c0f !important;
    font-family: inherit;
}

.marker-icon {
    position: relative;
}

.marker-sprite {
    width: 28px;
    height: 28px;
    background: #6b7280;
    border: 2px solid rgba(255,255,255,0.95);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}

.marker-sprite svg {
    width: 16px;
    height: 16px;
    color: white;
}

.marker-sprite:hover {
    transform: scale(1.15);
}

/* Siren flashing animation */
.marker-sprite.sirens {
    animation: sirenFlash 0.5s ease-in-out infinite;
    border-color: white !important;
}

@keyframes sirenFlash {
    0%, 100% {
        background-color: #ef4444;
        box-shadow: 0 0 12px 4px rgba(239, 68, 68, 0.6);
    }
    50% {
        background-color: #3b82f6;
        box-shadow: 0 0 12px 4px rgba(59, 130, 246, 0.6);
    }
}

.marker-label {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    color: white;
    pointer-events: none;
}

.marker-label.hidden {
    display: none;
}

/* Call Markers */
.call-marker {
    width: 32px;
    height: 32px;
    background: var(--danger);
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(234, 67, 53, 0.5);
    animation: callPulse 1.5s ease-in-out infinite;
}

.call-marker svg {
    width: 18px;
    height: 18px;
    color: white;
}

.call-marker.call-311 {
    background: var(--warning);
    box-shadow: 0 2px 8px rgba(251, 188, 4, 0.5);
}

.call-marker.call-311 svg {
    color: #000;
}

@keyframes callPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.call-popup {
    min-width: 180px;
}

.call-popup .call-type {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--danger);
}

.call-popup .call-message {
    font-size: 13px;
    margin-bottom: 6px;
}

.call-popup .call-caller {
    font-size: 12px;
    color: var(--text-muted);
}

.blip-marker {
    width: 12px;
    height: 12px;
    background: var(--warning);
    border: 2px solid rgba(255,255,255,0.9);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.leaflet-popup-content-wrapper {
    background: var(--bg-panel);
    color: var(--text);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.leaflet-popup-tip {
    background: var(--bg-panel);
}

.leaflet-popup-content {
    margin: 12px 14px;
    font-size: 13px;
}

/* ========== MOBILE SHEET ========== */
.mobile-sheet {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-height: 50vh;
    transition: transform 0.3s;
}

.mobile-sheet.expanded {
    max-height: 80vh;
}

.mobile-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 12px auto;
    cursor: pointer;
}

.mobile-sheet-content {
    padding: 0 16px 16px;
    max-height: calc(50vh - 28px);
    overflow-y: auto;
}

.mobile-sheet.expanded .mobile-sheet-content {
    max-height: calc(80vh - 28px);
}

.mobile-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.mobile-tab {
    padding: 8px 16px;
    background: var(--bg-dark);
    border: none;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.mobile-tab.active {
    background: var(--accent);
    color: white;
}

.mobile-tab-content {
    min-height: 100px;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========== RESPONSIVE ========== */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .nav-center {
        display: none;
    }
    
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        left: -300px;
        top: 56px;
        height: calc(100vh - 56px);
        transition: left 0.3s;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .sidebar.collapsed {
        left: -300px;
        margin: 0;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .mobile-sheet {
        display: block;
    }
    
    .map-coords {
        bottom: calc(50vh + 16px);
    }
    
    .map-tools {
        top: 12px;
        right: 12px;
    }
    
    .tool-btn {
        width: 40px;
        height: 40px;
    }
    
    .app.fullscreen .mobile-sheet {
        display: none;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0 12px;
    }
    
    .nav-logo-img {
        max-width: 120px;
        height: 28px;
    }
}
