/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #1a1a2e;
    color: #333;
    font-size: 13px;
}

/* ===== TOP CONTROL BAR ===== */
.top-control-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 55px;
    background: linear-gradient(90deg, #2c3e50 0%, #34495e 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    z-index: 2000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    overflow: hidden;
    background: white;
    padding: 3px;
    border: 2px solid #4cc9f0;
    flex-shrink: 0;
}

.app-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.app-title {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-title h2 {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-subtitle {
    font-size: 10px;
    color: #a0a0a0;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 1;
}

.control-item {
    position: relative;
}

.top-control-btn {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    height: 36px;
    white-space: nowrap;
}

.top-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.top-control-btn.active {
    background: #4cc9f0;
    border-color: #4cc9f0;
    box-shadow: 0 2px 8px rgba(76, 201, 240, 0.4);
}

.desktop-text {
    display: inline;
}

.mobile-text {
    display: none;
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    min-width: 140px;
    justify-content: space-between;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 2px);
    right: 0;
    min-width: 160px;
    background: #2c3e50;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
    z-index: 3000;
    margin-top: 0;
    overflow: hidden;
}

/* Remove hover behavior - now controlled by JavaScript */
.dropdown:hover .dropdown-menu {
    /* Removed - using JavaScript click handling instead */
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    color: #fff;
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dropdown-item i {
    width: 16px;
    color: #4cc9f0;
    font-size: 12px;
}

.status-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    color: #bdc3c7;
    flex-shrink: 0;
}

.status-label i {
    color: #f39c12;
    font-size: 10px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    position: fixed;
    top: 60px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    z-index: 1001;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.close-sidebar-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 14px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1002;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 55px;
    left: 0;
    width: 100%;
    height: calc(100vh - 55px);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #4cc9f0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content p {
    font-size: 14px;
    color: #fff;
}

/* ===== NOTIFICATION MODAL ===== */
.notification-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.notification-modal.hidden {
    display: none;
}

.notification-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.notification-header {
    margin-bottom: 20px;
}

.notification-header i {
    font-size: 48px;
    color: #27ae60;
    margin-bottom: 10px;
}

.notification-header h3 {
    color: #fff;
    font-size: 18px;
    margin: 0;
}

.notification-body {
    margin-bottom: 20px;
}

.notification-body p {
    color: #fff;
    margin: 10px 0;
    font-size: 14px;
}

.notification-body .timestamp {
    color: #bdc3c7;
    font-size: 12px;
}

.export-options {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    justify-content: center;
}

.export-btn {
    padding: 10px 15px;
    background: rgba(76, 201, 240, 0.2);
    border: 1px solid rgba(76, 201, 240, 0.3);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    justify-content: center;
}

.export-btn:hover {
    background: rgba(76, 201, 240, 0.3);
    transform: translateY(-2px);
}

.export-btn i {
    font-size: 16px;
}

.notification-close {
    background: #4cc9f0;
    color: #fff;
    border: none;
    padding: 10px 30px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
    width: 100%;
}

.notification-close:hover {
    background: #3aa8d4;
}

/* ===== MAIN CONTAINER ===== */
.container {
    display: flex;
    height: calc(100vh - 55px);
    overflow: hidden;
    margin-top: 55px;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 320px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    position: relative;
    transition: transform 0.3s ease;
}

/* Section Titles */
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.section-title h3 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    flex: 1;
}

.section-title h3 small {
    font-size: 11px;
    color: #a0a0a0;
    font-weight: normal;
}

.section-title i {
    color: #4cc9f0;
    font-size: 13px;
}

.data-summary {
    font-size: 11px;
    color: #a0a0a0;
    margin-left: auto;
    padding-left: 10px;
}

.filter-controls {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.filter-control-btn {
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Search Container */
.search-container {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.search-box:focus-within {
    background: rgba(255, 255, 255, 0.08);
    border-color: #4cc9f0;
    box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.2);
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 12px;
    outline: none;
    padding-right: 25px;
}

.search-box input::placeholder {
    color: #666;
    font-size: 11px;
}

.clear-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 3px;
    transition: color 0.2s;
    font-size: 10px;
}

.clear-btn:hover {
    color: #fff;
}

.search-results {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    display: none;
}

.search-results.show {
    display: block;
}

.search-results-count {
    padding: 6px 10px 8px;
    font-size: 11px;
    color: #a0a0a0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.result-item {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
    font-size: 11px;
}

.result-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.result-item:last-child {
    border-bottom: none;
}

.result-name {
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
    font-size: 11px;
}

.result-details {
    font-size: 10px;
    color: #a0a0a0;
    display: flex;
    justify-content: space-between;
}

/* Statistics - 6 COLUMNS */
.stats-container.compact {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-container.compact .section-title {
    margin-bottom: 8px;
}

.stats-container.compact .section-title h3 {
    font-size: 13px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.stats-grid.six-columns {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

@media (max-width: 1400px) {
    .stats-grid.six-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid.six-columns {
        grid-template-columns: repeat(3, 1fr);
    }
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    min-height: 50px;
}

.stat-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

.stat-total { border-top: 3px solid #4361ee; }
.stat-valid { border-top: 3px solid #27ae60; }
.stat-expired { border-top: 3px solid #e74c3c; }
.stat-noconsent { border-top: 3px solid #95a5a6; }
.stat-valid-cte { border-top: 3px solid #27ae60; }
.stat-valid-cto { border-top: 3px solid #2ecc71; }
.stat-expired-cte { border-top: 3px solid #e74c3c; }
.stat-expired-cto { border-top: 3px solid #c0392b; }
.stat-refused { border-top: 3px solid #f39c12; }
.stat-without-consent { border-top: 3px solid #95a5a6; }

.stat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-number {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    margin-bottom: 3px;
}

.stat-label {
    font-size: 10px;
    color: #a0a0a6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filters */
.filter-container {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.filter-btn {
    padding: 6px 4px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #a0a0a0;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.2s;
    min-height: 40px;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.filter-btn.active {
    background: #4cc9f0;
    color: #fff;
    box-shadow: 0 2px 8px rgba(76, 201, 240, 0.3);
}

.filter-btn i {
    font-size: 10px;
}

/* Controls */
.controls-container {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 12px;
}

.control-group:hover {
    background: rgba(255, 255, 255, 0.05);
}

.control-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.control-label i {
    color: #4cc9f0;
    width: 16px;
    font-size: 12px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #666;
    transition: .2s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4cc9f0;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Legend */
.legend-container {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 11px;
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.legend-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.legend-text {
    color: #fff;
    flex: 1;
}

.legend-count {
    color: #4cc9f0;
    font-weight: 600;
    font-size: 11px;
    min-width: 20px;
    text-align: right;
}

/* ===== MAP CONTAINER ===== */
.map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
}

.map-control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.map-control-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    transition: all 0.2s;
}

.map-control-btn:hover {
    background: #4cc9f0;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(76, 201, 240, 0.4);
}

/* Bottom Information Bar - Semi-transparent (50% opacity) */
.bottom-info-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35px;
    background: rgba(0, 0, 0, 0.5); /* Changed from 0.9 to 0.5 for transparency */
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 15px;
}

.bottom-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 20px;
}

.bottom-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 11px;
    flex-shrink: 0;
}

.bottom-item i {
    color: #4A90E2; /* Lighter blue - less intense than dark blue */
    font-size: 10px;
    width: 14px;
}

.coordinate-input {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.coordinate-input input {
    width: 150px;
    padding: 3px 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    color: #fff;
    font-size: 11px;
    font-family: monospace;
    outline: none;
}

.coordinate-input input::placeholder {
    color: rgba(255, 255, 255, 0.8); /* White with 80% opacity for better visibility - changed from #666 */
    font-size: 10px;
}

.coordinate-input input:focus {
    border-color: #4cc9f0;
}

.coordinate-input button {
    padding: 3px 8px;
    background: #4cc9f0;
    border: none;
    border-radius: 3px;
    color: #fff;
    cursor: pointer;
    font-size: 10px;
    transition: background 0.2s;
}

.coordinate-input button:hover {
    background: #3aa8d4;
}

/* Developer Footer - Left side */
.developer-footer-left {
    position: absolute;
    bottom: 40px;
    left: 15px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    padding: 6px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #fff;
    z-index: 999;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: auto;
    max-width: 350px;
    flex-wrap: wrap;
}

.dev-label {
    color: #bdc3c7;
    font-weight: normal;
}

.dev-link {
    color: #4cc9f0;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s;
}

.dev-link:hover {
    color: #3aa8d4;
    text-decoration: underline;
}

.dev-separator {
    color: #666;
    font-weight: normal;
}

.dev-version {
    color: #f39c12;
    font-weight: bold;
    font-style: italic;
    margin-left: auto;
}

/* Buffer Controls */
.buffer-controls {
    position: absolute;
    top: 70px;
    right: 15px;
    width: 200px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
}

.buffer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(76, 201, 240, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px 8px 0 0;
}

.buffer-header h4 {
    font-size: 12px;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.buffer-header i {
    color: #4cc9f0;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 10px;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.close-btn:hover {
    opacity: 1;
}

.buffer-content {
    padding: 12px;
}

.buffer-input {
    margin-bottom: 12px;
}

.buffer-input label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #fff;
    margin-bottom: 6px;
}

.buffer-input label i {
    color: #4cc9f0;
}

.buffer-input input {
    width: 100%;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 12px;
    outline: none;
}

.buffer-input input:focus {
    border-color: #4cc9f0;
    box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.2);
}

.buffer-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.buffer-action-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    background: rgba(76, 201, 240, 0.2);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.buffer-action-btn:hover {
    background: rgba(76, 201, 240, 0.3);
}

.buffer-action-btn:last-child {
    background: rgba(231, 76, 60, 0.2);
}

.buffer-action-btn:last-child:hover {
    background: rgba(231, 76, 60, 0.3);
}

.buffer-info {
    font-size: 10px;
    color: #bdc3c7;
    text-align: center;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.buffer-info i {
    color: #4cc9f0;
    margin-right: 4px;
}

/* Buffer cursor - apply to map container for all layers */
.buffer-mode .leaflet-container {
    cursor: crosshair !important;
}

/* Buffer cursor on markers and clusters */
.buffer-mode .leaflet-marker-icon,
.buffer-mode .leaflet-marker-icon img,
.buffer-mode .custom-cluster-icon,
.buffer-mode .custom-cluster-icon div,
.buffer-mode .marker-cluster,
.buffer-mode .marker-cluster div {
    cursor: crosshair !important;
}

/* Buffer cursor on GeoJSON layers (district/tehsil boundaries) */
.buffer-mode .leaflet-interactive,
.buffer-mode .leaflet-interactive path,
.buffer-mode .leaflet-interactive polygon,
.buffer-mode .leaflet-interactive polyline,
.buffer-mode .leaflet-pane svg path {
    cursor: crosshair !important;
}

/* Ensure cursor doesn't apply to controls/tools */
.buffer-mode .leaflet-control-container,
.buffer-mode .sidebar,
.buffer-mode .top-control-bar {
    cursor: default !important;
}

/* ===== DATA VALIDATION DASHBOARD ===== */
.validation-container {
    margin: 15px 0;
    padding: 12px;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 6px;
}

.validation-container .section-title {
    margin-bottom: 10px;
    color: #ffc107;
}

.validation-content {
    margin-top: 10px;
}

.validation-content.hidden {
    display: none;
}

.toggle-section-btn {
    background: transparent;
    border: none;
    color: #ffc107;
    cursor: pointer;
    padding: 5px;
    margin-left: auto;
    font-size: 12px;
}

.toggle-section-btn:hover {
    color: #ffd54f;
}

.validation-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.validation-stat-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 10px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.validation-stat-card.invalid-count {
    border-color: rgba(244, 67, 54, 0.5);
}

.validation-stat-card.missing-coords {
    border-color: rgba(255, 152, 0, 0.5);
}

.validation-stat-card.invalid-coords {
    border-color: rgba(255, 193, 7, 0.5);
}

.validation-stat-number {
    display: block;
    font-size: 20px;
    font-weight: bold;
    color: #ffc107;
    margin-bottom: 4px;
}

.validation-stat-label {
    display: block;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
}

.export-invalid-btn {
    width: 100%;
    padding: 10px;
    background: #ffc107;
    color: #1a1a2e;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 12px;
    transition: background 0.2s;
    font-size: 12px;
}

.export-invalid-btn:hover {
    background: #ffd54f;
}

.export-invalid-btn i {
    margin-right: 5px;
}

.invalid-records-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
}

.invalid-records-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invalid-record-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 10px;
    border-left: 3px solid #ffc107;
}

.invalid-record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.invalid-record-name {
    font-weight: bold;
    color: #fff;
    font-size: 12px;
}

.invalid-record-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
}

.invalid-record-badge.badge-missing {
    background: rgba(255, 152, 0, 0.3);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.5);
}

.invalid-record-badge.badge-invalid {
    background: rgba(244, 67, 54, 0.3);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.5);
}

.invalid-record-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.invalid-record-detail {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 6px;
}

.invalid-record-detail i {
    color: #ffc107;
    font-size: 9px;
    width: 12px;
}

.no-invalid-data {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    padding: 20px;
}

.validation-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.validation-actions .export-invalid-btn {
    flex: 1;
    margin-bottom: 0;
}

.validation-actions .copy-btn {
    background: rgba(76, 201, 240, 0.3);
    color: #fff;
    border: 1px solid rgba(76, 201, 240, 0.5);
}

.validation-actions .copy-btn:hover {
    background: rgba(76, 201, 240, 0.5);
}

/* ===== FILTER CHIPS (Region / Division) ===== */
.filter-chips-container {
    padding: 10px 15px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-chips-section {
    margin-bottom: 8px;
}

.filter-chips-section:last-child {
    margin-bottom: 0;
}

.filter-chips-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #a0a0a0;
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
    transition: color 0.2s;
}

.filter-chips-header:hover {
    color: #4cc9f0;
}

.filter-chips-toggle {
    font-size: 10px;
    transition: transform 0.2s;
}

.filter-chips-section.collapsed .filter-chips-toggle {
    transform: rotate(-90deg);
}

.filter-chips-content {
    overflow: hidden;
    transition: max-height 0.25s ease-out;
    max-height: 200px;
}

.filter-chips-section.collapsed .filter-chips-content {
    max-height: 0 !important;
    overflow: hidden;
}

.filter-chips-label {
    flex: 1;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    padding: 4px 10px;
    font-size: 10px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.1);
}

.filter-chip.selected {
    background: rgba(76, 201, 240, 0.3);
    border-color: #4cc9f0;
    color: #fff;
}

/* ===== COLLAPSE SIDEBAR (Thin strip) ===== */
.collapse-sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -14px;
    transform: translateY(-50%);
    width: 28px;
    height: 56px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 8px 8px 0;
    color: #4cc9f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: all 0.2s;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
}

.collapse-sidebar-toggle:hover {
    background: rgba(76, 201, 240, 0.2);
}

.sidebar.collapsed {
    width: 48px;
    min-width: 48px;
    overflow: hidden;
}

.sidebar.collapsed .search-container,
.sidebar.collapsed .stats-container,
.sidebar.collapsed .filter-container,
.sidebar.collapsed .validation-container,
.sidebar.collapsed .controls-container,
.sidebar.collapsed .legend-container,
.sidebar.collapsed .filter-chips-container {
    display: none !important;
}

.sidebar.collapsed .collapse-sidebar-toggle {
    right: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 8px;
}

.sidebar.collapsed .collapse-sidebar-toggle i {
    transform: rotate(180deg);
}

/* ===== EXPORT MAP MODAL (theme-matched) ===== */
.modal-label {
    display: block;
    font-size: 12px;
    color: #fff;
    margin-bottom: 8px;
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    margin-bottom: 10px;
}

.modal-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.modal-input:focus {
    outline: none;
    border-color: #4cc9f0;
}

.modal-hint {
    font-size: 11px;
    color: #a0a0a0;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions .export-btn {
    flex: 1;
}

.modal-actions .notification-close {
    flex: 1;
}

.share-toast-content {
    max-width: 300px;
}

/* ===== SCROLLBAR STYLING ===== */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.search-results::-webkit-scrollbar {
    width: 3px;
}

.search-results::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .sidebar {
        width: 280px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .top-control-btn span.desktop-text {
        display: none;
    }
    
    .top-control-btn {
        padding: 8px;
    }
    
    .dropdown-toggle {
        min-width: auto;
    }
    
    .bottom-bar-content {
        gap: 15px;
    }
    
    .coordinate-input input {
        width: 70px;
    }
    
    .developer-footer-left {
        max-width: 300px;
        font-size: 10px;
    }
}

@media (max-width: 992px) {
    .top-control-bar {
        padding: 0 10px;
    }
    
    .app-title h2 {
        font-size: 14px;
    }
    
    .app-subtitle {
        font-size: 10px;
    }
    
    .status-label span.desktop-text {
        display: none;
    }
    
    .status-label {
        padding: 6px;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        top: 55px;
        left: 0;
        height: calc(100vh - 55px);
        transform: translateX(-100%);
        z-index: 1001;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .close-sidebar-btn {
        display: flex;
    }
    
    .map-container {
        width: 100%;
    }
    
    .bottom-info-bar {
        height: 40px;
        padding: 0 10px;
    }
    
    .bottom-bar-content {
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .bottom-item {
        flex-shrink: 0;
    }
    
    .coordinate-input {
        flex-shrink: 0;
    }
    
    .coordinate-input input {
        width: 65px;
    }
    
    .developer-footer-left {
        bottom: 45px;
        left: 10px;
        max-width: 280px;
    }
    
    .map-controls {
        top: 70px;
    }
}

@media (max-width: 768px) {
    .top-bar-left {
        gap: 10px;
    }
    
    .app-logo {
        width: 35px;
        height: 35px;
    }
    
    .app-title h2 {
        font-size: 12px;
    }
    
    .app-subtitle {
        font-size: 9px;
    }
    
    .top-control-btn {
        padding: 6px;
    }
    
    .dropdown-toggle span.desktop-text {
        display: none;
    }
    
    .sidebar {
        width: 280px;
    }
    
    .stats-grid.six-columns {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bottom-info-bar {
        height: 45px;
        flex-direction: column;
        padding: 5px 10px;
    }
    
    .bottom-bar-content {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 10px 15px;
    }
    
    .bottom-item {
        font-size: 10px;
    }
    
    .coordinate-input {
        order: 4;
        width: 100%;
        justify-content: flex-start;
        margin-top: 5px;
    }
    
    .coordinate-input input {
        width: 80px;
    }
    
    .developer-footer-left {
        bottom: 50px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        max-width: 200px;
        padding: 5px 8px;
    }
    
    .dev-version {
        margin-left: 0;
    }
    
    .buffer-controls {
        top: 120px;
        right: 10px;
        width: 180px;
    }
}

@media (max-width: 480px) {
    .app-title h2 {
        font-size: 11px;
    }
    
    .app-subtitle {
        font-size: 8px;
    }
    
    .top-control-btn {
        padding: 5px;
    }
    
    .top-bar-right {
        gap: 5px;
    }
    
    .status-label {
        display: none;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .stats-grid.six-columns {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .filter-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .bottom-info-bar {
        height: auto;
        padding: 8px 10px;
    }
    
    .bottom-bar-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .bottom-item {
        width: 100%;
        justify-content: space-between;
    }
    
    .coordinate-input {
        width: 100%;
        margin-top: 0;
    }
    
    .coordinate-input input {
        flex: 1;
        max-width: 80px;
    }
    
    .developer-footer-left {
        display: none;
    }
    
    .buffer-controls {
        width: 160px;
        font-size: 10px;
    }
    
    .buffer-action-btn {
        font-size: 10px;
        padding: 6px;
    }
}

/* Mobile optimization for touch */
@media (hover: none) and (pointer: coarse) {
    .top-control-btn, .map-control-btn, .filter-btn, .buffer-action-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .search-box input {
        font-size: 16px;
        height: 44px;
    }
    
    .clear-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .result-item {
        min-height: 44px;
        padding: 12px;
    }
    
    .stat-card {
        min-height: 60px;
    }
    
    .control-group {
        min-height: 44px;
    }
    
    .legend-item {
        min-height: 44px;
    }
    
    .coordinate-input input {
        height: 36px;
        font-size: 16px;
    }
    
    .coordinate-input button {
        height: 36px;
        min-width: 44px;
    }
}

/* ===== LEAFLET SPECIFIC STYLES ===== */

/* District and Tehsil Labels - Enhanced visibility with updated colors */
.district-label {
    background: transparent !important;
    border: none !important;
    color: #adb5bd !important; /* Neutral gray - matches theme and boundaries (Option B) */
    font-weight: 700 !important;
    font-size: 10px !important; /* Reduced from 11px to 10px */
    text-shadow: 
        2px 2px 4px rgba(255, 255, 255, 1),
        -1px -1px 2px rgba(255, 255, 255, 1),
        1px 1px 2px rgba(255, 255, 255, 1),
        0 0 8px rgba(255, 255, 255, 0.8) !important;
    box-shadow: none !important;
    padding: 0 !important;
    pointer-events: none !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tehsil-label {
    background: transparent !important;
    border: none !important;
    color: #FFD700 !important; /* Yellow - changed from #ced4da */
    font-weight: 700 !important;
    font-size: 12px !important;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        -1px -1px 2px rgba(0, 0, 0, 0.8),
        1px 1px 2px rgba(0, 0, 0, 0.8) !important; /* Dark shadow for yellow text */
    box-shadow: none !important;
    padding: 0 !important;
    pointer-events: none !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0; /* Start transparent for fade-in transition */
    transition: opacity 0.5s ease-in;
}

/* Custom Cluster Icons - 30% smaller with visible numbers */
.custom-cluster-icon {
    background: transparent !important;
    border: none !important;
}

/* Override default cluster styles for better visibility and 30% size reduction */
.marker-cluster {
    background-color: rgba(255, 152, 0, 0.8) !important;
    border: 3px solid rgba(255, 255, 255, 0.9) !important;
}

.marker-cluster-small {
    background-color: rgba(255, 235, 59, 0.8) !important;
    width: 40px !important;  /* 30% smaller than typical 57px */
    height: 40px !important;
}

.marker-cluster-medium {
    background-color: rgba(255, 152, 0, 0.8) !important;
    width: 48px !important;  /* 30% smaller than typical 68px */
    height: 48px !important;
}

.marker-cluster-large {
    background-color: rgba(255, 87, 34, 0.8) !important;
    width: 56px !important;  /* 30% smaller than typical 80px */
    height: 56px !important;
}

.marker-cluster div {
    background-color: transparent !important;
    color: #ffffff !important;
    font-weight: bold !important;
    font-size: 14px !important;  /* Adjusted for smaller clusters */
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        -1px -1px 2px rgba(0, 0, 0, 0.8),
        1px 1px 2px rgba(0, 0, 0, 0.8) !important;
    border: none !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
}

.marker-cluster-small div {
    font-size: 12px !important;
}

.marker-cluster-medium div {
    font-size: 14px !important;
}

.marker-cluster-large div {
    font-size: 16px !important;
}

/* Leaflet Icon Rendering - Crisp/Sharp Images */
.leaflet-marker-icon {
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: crisp-edges !important;
    image-rendering: pixelated !important;
    -ms-interpolation-mode: nearest-neighbor !important;
}

.leaflet-container img.leaflet-marker-icon {
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: crisp-edges !important;
    -ms-interpolation-mode: nearest-neighbor !important;
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
    border-radius: 6px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}

.leaflet-popup-content {
    margin: 0;
}

/* Ensure map container takes full height */
#map {
    height: 100%;
    width: 100%;
    z-index: 1;
}