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

:root {
    /* UI/UX Pro Max Core Colors */
    --color-primary: #2563EB;
    --color-secondary: #3B82F6;
    --color-cta: #F97316;
    
    /* Dark Mode Foundations */
    --bg-base: #0f1115;
    --sidebar-bg: #16181d;
    --text-primary: #F8FAFC;
    --text-secondary: #94a3b8;
    --accent: #2563EB;
    --danger: #ef4444;
    --danger-dim: rgba(239, 68, 68, 0.2);
    --border: #334155;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* UI/UX Pro Max Spacing Tokens */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* UI/UX Pro Max Shadow Depths (Dark Mode Tuned) */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.6);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.7);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.8);
    
    /* Standardized Smooth Micro-interactions (150-300ms) */
    --transition: all 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes auroraFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body {
    font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-primary);
    background: linear-gradient(-45deg, #0f1115, #16181d, #0b1a36, #16181d);
    background-size: 400% 400%;
    animation: auroraFlow 20s ease infinite;
    height: 100vh;
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Fira Code', monospace;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    background: radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.08) 0%, transparent 60%);
}

/* Top Navigation Bar */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    z-index: 100;
    position: sticky;
    top: 0;
}

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



.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-container h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.radar-dot {
    width: 12px;
    height: 12px;
    background-color: var(--danger);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 16px var(--danger);
}

.radar-dot.blue {
    background-color: var(--accent);
    box-shadow: 0 0 16px var(--accent);
}

.pulse::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--danger);
    animation: pulse 2s infinite ease-out;
}

.pulse.blue::after {
    border-color: var(--accent);
}

@keyframes pulse {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 1px solid rgba(255,255,255,0.1);
    padding-left: 16px;
}

.filters {
    display: flex;
    gap: 16px;
    align-items: center;
    flex: 1;
    max-width: 600px;
    justify-content: flex-end;
}

.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.filters input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 17, 21, 0.4);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-family: 'Fira Sans', sans-serif;
    font-size: 0.875rem;
    transition: var(--transition);
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.filters input:focus {
    border-color: rgba(37, 99, 235, 0.5);
    background: rgba(15, 17, 21, 0.8);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), inset 0 2px 4px rgba(0,0,0,0.2);
}

.maplibregl-popup-content {
    background: rgba(15, 17, 21, 0.95);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-xl);
    color: var(--text-primary);
    font-family: 'Fira Sans', sans-serif;
}

.maplibregl-popup-tip {
    border-top-color: rgba(15, 17, 21, 0.95) !important;
}

/* Fix popup flickering on hover */
.maplibregl-popup {
    pointer-events: none;
}

/* --- Detail Drawer --- */
.detail-drawer {
    position: fixed;
    top: 0;
    right: -50%;
    width: 50%;
    height: 100vh;
    background: rgba(8, 9, 10, 0.85);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border-left: 1px solid var(--glass-border);
    box-shadow: -30px 0 60px rgba(0,0,0,0.8);
    z-index: 1000;
    transition: right 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-family: 'Fira Sans', sans-serif;
    color: var(--text-primary);
}

.detail-drawer.open {
    right: 0;
}

.drawer-header {
    padding: 30px 40px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: sticky;
    top: 0;
    background: rgba(8, 9, 10, 0.6);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.close-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    transform: scale(1.1) rotate(90deg);
    border-color: rgba(255,255,255,0.2);
}

.drawer-content {
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.drawer-hero {
    display: flex;
    gap: 32px;
    align-items: center;
}

.drawer-mugshot {
    width: 140px;
    height: 140px;
    border-radius: 20px;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.1);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    transition: transform 0.4s ease;
}

.drawer-mugshot:hover {
    transform: scale(1.05);
}

.drawer-hero-info h2 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.drawer-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.drawer-tag {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.drawer-tag:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 8px;
}

.ai-badge.violent {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.ai-badge.felony {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.ai-badge.misdemeanor {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.ai-badge.traffic {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.drawer-section {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 20px;
    padding: 28px;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.05);
}

.drawer-section h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.charge-item {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: #fcd34d;
    line-height: 1.5;
    transition: var(--transition);
}

.charge-item:hover {
    color: #fbbf24;
    padding-left: 4px;
}

.charge-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.county-dropdown {
    width: 220px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 17, 21, 0.4);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-family: 'Fira Sans', sans-serif;
    font-size: 0.875rem;
    transition: var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    cursor: pointer;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.county-dropdown:focus {
    border-color: rgba(37, 99, 235, 0.5);
    background: rgba(15, 17, 21, 0.8);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), inset 0 2px 4px rgba(0,0,0,0.2);
}

.county-dropdown option {
    background: #0f1115;
    color: var(--text-primary);
}

/* Main Dashboard Body */
.dashboard-main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    /* Aurora Gradient Overlay on Main Space */
    background: transparent; 
}

.feed-header {
    padding: 32px 40px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.feed-header h3 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #e2e8f0;
}

.badge {
    background: rgba(37, 99, 235, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #60a5fa;
    border: 1px solid rgba(37, 99, 235, 0.3);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.1);
}

.feed-container {
    padding: 0 40px 40px;
    flex: 1;
}

/* Grid Layout for Feed */
.grid-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
    align-items: stretch;
    grid-auto-rows: min-content;
}

/* Glassmorphism Feed Items */
.card {
    background: rgba(20, 25, 35, 0.45);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.card:hover {
    transform: translateY(-6px) scale(1.01);
    background: rgba(30, 36, 48, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 40px 0 rgba(0, 0, 0, 0.5), 0 0 20px rgba(37, 99, 235, 0.15);
}

.card:hover::before {
    opacity: 1;
}

@keyframes fadeUp {
    to { opacity: 1; transform: translateY(0); }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    background: rgba(255,255,255,0.02);
}

.card-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: 'Fira Code', monospace;
    line-height: 1.2;
}

.card-county {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 8px;
    background: rgba(37, 99, 235, 0.15);
    color: var(--color-secondary);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 6px;
    font-weight: 600;
}

.card-body {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.card-row {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}

.card-row.align-start {
    align-items: flex-start;
}

.charge-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
    color: var(--text-primary);
}

.charge-item-text {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.charge-badge {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.bond-highlight {
    color: #34d399;
}
.bond-highlight svg {
    color: #10b981;
}



/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 16px;
    }
    
    .logo-container h1 { font-size: 1.25rem; }
    .subtitle { display: none; /* Hide for space */ }
    
    .filters {
        max-width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .search-wrapper { max-width: 100%; }
    .county-dropdown { width: 100%; }
    
    .feed-header { padding: 24px 16px 16px; }
    .feed-container { padding: 0 16px 32px; }
    
    .grid-feed {
        grid-template-columns: 1fr; /* Single column */
        gap: 16px;
    }
    
    .detail-drawer {
        width: 100%;
        right: -100%;
    }
    
    .drawer-header { padding: 20px; }
    .drawer-content { padding: 20px; gap: 24px; }
    
    .drawer-hero {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .drawer-tags { justify-content: center; }
    .drawer-section { padding: 20px; }
}
