:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --bg-main: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(0,0,0,0.2);
    --header-bg: rgba(15, 23, 42, 0.8);
    --input-text: white;
    
    --status-new: #ef4444;
    --status-process: #eab308;
    --status-done: #22c55e;
}

[data-theme="light"] {
    --bg-main: #f1f5f9;
    --panel-bg: rgba(255, 255, 255, 0.9);
    --text-main: #0f172a;
    --text-muted: #475569;
    --border-color: rgba(0, 0, 0, 0.1);
    --input-bg: rgba(255,255,255,0.8);
    --header-bg: rgba(255, 255, 255, 0.9);
    --input-text: #0f172a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--header-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

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

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-main);
    line-height: 1.1;
    margin: 0;
}

.logo-subtext {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
    opacity: 0.8;
}

nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

nav a:hover, nav a.active {
    color: var(--text-main);
}

.btn-report {
    background-color: var(--primary);
    color: white !important;
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-report:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

[data-theme="light"] .btn-theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
    display: inline-block;
}

.btn-profile {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-profile:hover {
    background: var(--input-bg);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 120%;
    min-width: 200px;
    padding: 10px;
    z-index: 1000;
    flex-direction: column;
}

.dropdown-content.active {
    display: flex;
}

.profile-info {
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.profile-info strong {
    color: var(--text-main);
    font-size: 0.95rem;
}

.profile-info span {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}

.btn-logout-nav {
    width: 100%;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-align: left;
    transition: all 0.3s ease;
}

.btn-logout-nav:hover {
    background: rgba(239, 68, 68, 0.2);
}


/* Map Container */
main {
    flex: 1;
    position: relative;
    display: flex;
}

.map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Leaflet adjustments removed for White Mode */

.leaflet-container {
    background: #0f172a;
}

.legend {
    position: absolute;
    bottom: 30px;
    right: 30px;
    padding: 1rem;
    z-index: 1000;
    min-width: 200px;
}

.legend h3 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.color-box {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.red { background-color: var(--status-new); box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
.yellow { background-color: var(--status-process); box-shadow: 0 0 8px rgba(234, 179, 8, 0.6); }
.green { background-color: var(--status-done); box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }

.leaflet-popup-content-wrapper {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

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

.popup-content h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
}

.popup-content p {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.popup-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-new { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.badge-process { background: rgba(234, 179, 8, 0.2); color: #fde047; }
.badge-done { background: rgba(34, 197, 94, 0.2); color: #86efac; }

/* Forms & Admin Dashboard styles */
.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    width: 100%;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input, textarea, select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--input-text);
    font-family: inherit;
    transition: border-color 0.3s;
}

option {
    background: var(--bg-main);
    color: var(--text-main);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

button[type="submit"] {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

button[type="submit"]:hover {
    background: var(--primary-hover);
}

/* Admin Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    cursor: pointer;
}
.btn-sm:hover {
    background: rgba(255,255,255,0.2);
}

/* Floating Stats Card */
.floating-stats-card {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 300px;
    max-height: calc(100vh - 380px);
    z-index: 1000;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

/* Custom Scrollbar for Floating Card */
.floating-stats-card::-webkit-scrollbar {
    width: 6px;
}
.floating-stats-card::-webkit-scrollbar-track {
    background: transparent;
}
.floating-stats-card::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
[data-theme="light"] .floating-stats-card::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

.collapse-icon {
    display: none;
}

.stats-header {
    background: var(--header-bg);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.stats-header h3 {
    font-size: 0.95rem;
    margin: 0;
    color: var(--text-main);
}

.live-indicator {
    font-size: 0.7rem;
    color: #ef4444;
    font-weight: 700;
    animation: pulse 2s infinite;
}

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

.stats-overview {
    display: flex;
    padding: 15px;
    gap: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-val {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hotspots-section {
    padding: 15px;
}

.hotspots-section h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.hotspot-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.hotspot-item:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateX(-2px);
}

.hotspot-info strong {
    display: block;
    font-size: 0.8rem;
    color: var(--text-main);
}
.hotspot-info span {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.hotspot-votes {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ticker-box {
    background: rgba(0,0,0,0.3);
    padding: 8px 15px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 0.8rem;
        padding: 1rem;
    }

    .logo-text {
        align-items: center;
        text-align: center;
    }

    .logo-text h1 {
        font-size: 1.5rem;
    }
    
    nav {
        width: 100%;
        justify-content: center;
        gap: 1.5rem;
    }
    
    nav a {
        font-size: 0.85rem;
    }
    
    .floating-stats-card {
        top: auto;
        bottom: 0;
        right: 0;
        width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 45vh;
        overflow-y: auto;
        background: var(--bg-main); /* Solid background on mobile for better readability */
        border: none;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -5px 25px rgba(0,0,0,0.3);
    }
    
    .stats-header { cursor: pointer; }
    .collapse-icon { display: block; }
    
    .floating-stats-card.collapsed .stats-body {
        display: none;
    }
    .floating-stats-card.collapsed .collapse-icon {
        transform: rotate(180deg);
    }
    
    .legend {
        display: none !important;
    }
    
    .btn-mobile-only { display: block !important; }
    .btn-desktop-only { display: none !important; }
    
    /* Report Layout */
    .report-layout {
        flex-direction: column;
        height: auto;
    }
    
    .form-section {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding: 1.5rem 1rem;
    }
    
    .map-section {
        display: none; /* Hide map on mobile by default */
        height: 100vh;
        width: 100vw;
    }
    
    .map-section.active-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 9999;
    }
    
    .map-section.active-overlay #mobile-bottom-sheet {
        display: block !important;
    }
    
    /* Admin Layout Mobile Sidebar */
    .admin-layout {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        top: 64px;
        height: calc(100vh - 64px);
        width: 250px;
        z-index: 1001;
        transition: left 0.3s ease;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .btn-menu-mobile {
        display: block !important;
        background: var(--input-bg);
        color: var(--text-main);
        border: 1px solid var(--border-color);
        padding: 8px 15px;
        border-radius: 6px;
        cursor: pointer;
        margin-bottom: 15px;
    }
    

    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .content {
        padding: 1rem;
    }
    
    /* Tables on mobile */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
