/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    overflow: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(34, 197, 94, 0.3);
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(34, 197, 94, 0.5);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(34, 197, 94, 0.3) rgba(15, 23, 42, 0.5);
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(34, 197, 94, 0.3);
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 2rem;
    color: #22c55e;
    animation: pulse 2s infinite;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: nowrap; /* keep single row */
    overflow-x: auto; /* allow horizontal scroll instead of wrap */
    overflow-y: visible; /* let tooltips spill outside vertically */
    -webkit-overflow-scrolling: touch;
}

/* Subtle scrollbar for stats row */
.header-stats::-webkit-scrollbar {
    height: 6px;
}
.header-stats::-webkit-scrollbar-track {
    background: transparent;
}
.header-stats::-webkit-scrollbar-thumb {
    background: rgba(34, 197, 94, 0.25);
    border-radius: 4px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 0.65rem;
    transition: all 0.3s ease;
    min-width: 130px;
}

.stat-item:hover {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(34, 197, 94, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.stat-item.critical {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

.stat-item.critical:hover {
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.15);
}

.stat-item.positive {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.1);
}

.stat-item.positive:hover {
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.15);
}

.stat-item i {
    font-size: 1.1rem;
    color: #22c55e;
    flex-shrink: 0;
}

.stat-item.critical i {
    color: #ef4444;
    animation: pulse 2s infinite;
}

.stat-item.positive i {
    color: #22c55e;
}

.stat-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.stat-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.critical-text {
    color: #ef4444 !important;
    animation: pulse 2s infinite;
}

/* Main Content Layout */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* News Panel Styles - Floating overlay */
.news-panel {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 300px;
    max-height: calc(100vh - 160px);
    background: rgba(15, 23, 42, 0.75); /* more see-through */
    backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 0.85rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1200; /* above region info */
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
    animation: fadeInScale 0.5s ease-out;
}

.panel-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(34, 197, 94, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1600; /* header area for minimize sits above other panels */
    background: rgba(15, 23, 42, 0.6);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-minimize-btn {
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.panel-minimize-btn:hover {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    transform: scale(1.1);
}

.panel-minimize-btn i {
    font-size: 0.875rem;
    transition: transform 0.3s ease;
}

/* Panel content wrapper */
.panel-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Minimized button (hidden by default) */
.minimized-btn {
    display: none;
    width: 50px;
    height: 50px;
    background: rgba(34, 197, 94, 0.3);
    border: 2px solid rgba(34, 197, 94, 0.6);
    border-radius: 50%;
    color: #22c55e;
    font-size: 1.2rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.minimized-btn:hover {
    background: rgba(34, 197, 94, 0.5);
    border-color: rgba(34, 197, 94, 0.8);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.news-panel.minimized .minimized-btn:hover,
.map-controls.minimized .minimized-btn:hover {
    transform: scale(1.1);
}

/* Header minimize button positioning */
.header-minimize {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 1001;
}

/* Minimized states - floating button at bottom left */
.news-panel.minimized {
    position: fixed !important;
    bottom: 2rem !important;
    left: 2rem !important;
    top: auto !important;
    width: 60px;
    height: 60px;
    max-height: none;
    min-width: auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.98);
    border: 2px solid rgba(34, 197, 94, 0.6);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 40px rgba(34, 197, 94, 0.2);
    z-index: 1003;
    animation: bounceIn 0.3s ease;
    transition: all 0.3s ease;
}

.news-panel.minimized:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 50px rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.8);
    background: rgba(34, 197, 94, 0.1);
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.news-panel.minimized .panel-content {
    display: none !important;
}

.news-panel.minimized .minimized-btn {
    display: flex !important;
    position: static;
    transform: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1003;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: #22c55e;
    font-size: 1.5rem;
}

.map-controls.minimized {
    display: none !important; /* Hide map controls when minimized - single button opens both */
}

.map-controls.minimized .panel-content {
    display: none !important;
}

.map-controls.minimized .minimized-btn {
    display: flex !important;
    position: static;
    transform: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1003;
}

/* Ensure minimized button is hidden when panel is expanded */
.news-panel:not(.minimized) .minimized-btn {
    display: none !important;
}

/* Debug: Ensure minimized button is always visible when minimized */
.news-panel.minimized .minimized-btn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.map-controls:not(.minimized) .minimized-btn {
    display: none !important;
}

/* Minimize button animations */
.panel-minimize-btn i {
    transition: transform 0.3s ease;
}

.minimized .panel-minimize-btn i {
    transform: rotate(180deg);
}

.panel-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #f8fafc;
}

.panel-header i {
    color: #22c55e;
    margin-right: 0.5rem;
}

.refresh-indicator {
    color: #22c55e;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-indicator:hover {
    background: rgba(34, 197, 94, 0.1);
    transform: rotate(180deg) scale(1.1);
}

.refresh-indicator.spinning {
    animation: spin 1s linear infinite;
    background: rgba(34, 197, 94, 0.2);
}

/* Air Quality Section */
.air-quality-section {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(34, 197, 94, 0.1);
    flex-shrink: 0;
    max-height: 300px;
    display: flex;
    flex-direction: column;
}

.air-quality-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #f8fafc;
    flex-shrink: 0;
}

.aqi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    overflow-y: auto;
    max-height: 200px;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(34, 197, 94, 0.5) rgba(15, 23, 42, 0.3);
}

.aqi-grid::-webkit-scrollbar {
    width: 6px;
}

.aqi-grid::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 3px;
}

.aqi-grid::-webkit-scrollbar-thumb {
    background: rgba(34, 197, 94, 0.5);
    border-radius: 3px;
}

.aqi-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(34, 197, 94, 0.7);
}

.aqi-item {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 0.5rem;
    padding: 0.75rem 0.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.aqi-item:hover {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.aqi-location {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.aqi-value {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.aqi-pollutant {
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.aqi-live-indicator {
    font-size: 0.7rem;
    color: #22c55e;
    text-align: center;
    margin-top: 0.5rem;
    animation: pulse 2s infinite;
    font-weight: 500;
    flex-shrink: 0;
    padding: 0.25rem;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 0.25rem;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* AQI Status Colors */
.aqi-good { color: #22c55e; }
.aqi-moderate { color: #eab308; }
.aqi-unhealthy-for-sensitive-groups { color: #f97316; }
.aqi-unhealthy { color: #ef4444; }
.aqi-very-unhealthy { color: #dc2626; }
.aqi-hazardous { color: #991b1b; }
.aqi-unhealthy { color: #f97316; }
.aqi-hazardous { color: #ef4444; }

/* News Feed */
.news-feed {
    flex: 1;
    padding: 1rem 1.25rem;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 200px;
    max-height: 400px;
    border-top: 1px solid rgba(34, 197, 94, 0.1);
    border-bottom: 1px solid rgba(34, 197, 94, 0.1);
    scrollbar-width: thin;
    scrollbar-color: rgba(34, 197, 94, 0.5) rgba(15, 23, 42, 0.3);
}

.news-feed::-webkit-scrollbar {
    width: 6px;
}

.news-feed::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 3px;
}

.news-feed::-webkit-scrollbar-thumb {
    background: rgba(34, 197, 94, 0.5);
    border-radius: 3px;
}

.news-feed::-webkit-scrollbar-thumb:hover {
    background: rgba(34, 197, 94, 0.7);
}

.news-article {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.4s ease-out;
}

.news-article::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.news-article:hover::before {
    transform: scaleX(1);
}

.news-article:hover {
    border-color: rgba(34, 197, 94, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.15);
    background: rgba(15, 23, 42, 0.8);
}

.news-article:active {
    transform: translateY(-1px);
    transition: transform 0.1s ease;
}

.news-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.news-summary {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.625rem;
    color: #64748b;
}

.news-source {
    font-weight: 500;
}

.news-time {
    color: #22c55e;
}

/* Deforestation Alerts */
.deforestation-alerts {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(34, 197, 94, 0.1);
    flex-shrink: 0;
    max-height: 280px;
    display: flex;
    flex-direction: column;
}

.deforestation-alerts h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #f8fafc;
    flex-shrink: 0;
}

.alerts-list {
    overflow-y: auto;
    max-height: 200px;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(239, 68, 68, 0.5) rgba(15, 23, 42, 0.3);
}

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

.alerts-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 3px;
}

.alerts-list::-webkit-scrollbar-thumb {
    background: rgba(239, 68, 68, 0.5);
    border-radius: 3px;
}

.alerts-list::-webkit-scrollbar-thumb:hover {
    background: rgba(239, 68, 68, 0.7);
}

.alert-item {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    backdrop-filter: blur(5px);
}

.alert-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #ef4444;
    border-radius: 0.5rem 0 0 0.5rem;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.alert-item:hover::before {
    transform: scaleY(1);
}

.alert-item:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateX(4px);
}

.alert-location {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ef4444;
    margin-bottom: 0.25rem;
}

.alert-description {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.4;
}

/* Map Container */
.map-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.map-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 360px;
    max-height: calc(100vh - 160px);
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 0.85rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1500; /* ensure controls header sits above region info */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
    animation: fadeInScale 0.5s ease-out;
}

.map-controls .panel-minimize-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 1001;
}

/* Panel hover effects */
.news-panel:hover {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
}

.map-controls:hover {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
}

.control-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.control-btn {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #f8fafc;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.2), transparent);
    transition: left 0.5s ease;
}

.control-btn:hover::before {
    left: 100%;
}

.control-btn:hover {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.control-btn.active {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    color: #22c55e;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.control-btn:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

/* Legend */
.legend {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 0.65rem;
    padding: 0.65rem;
    min-width: 180px;
}

.legend h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #f8fafc;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.legend-color {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Map */
.map {
    flex: 1;
    position: relative;
    z-index: 1;
}

/* Map Info Panel */
.map-info-panel {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(10px) saturate(140%);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem;
    max-width: 300px;
    z-index: 1100; /* below map controls and news header */
    pointer-events: auto;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.map-info-panel h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: #f8fafc;
}

.close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    pointer-events: auto;
    z-index: 1000;
}

.close-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

.region-info-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: 50%;
    color: #22c55e;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000; /* lower than panel headers so it doesn't block minimize */
}

.region-info-toggle:hover {
    background: rgba(15, 23, 42, 1);
    border-color: rgba(34, 197, 94, 0.6);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.info-content {
    font-size: 0.875rem;
    color: #94a3b8;
    line-height: 1.5;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    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-spinner {
    text-align: center;
}

.loading-spinner i {
    font-size: 3rem;
    color: #22c55e;
    margin-bottom: 1rem;
    animation: pulse 2s infinite, rotate 3s linear infinite;
}

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

.loading-spinner p {
    font-size: 1.125rem;
    color: #f8fafc;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

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

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .news-panel {
        width: 280px;
    }
    
    .header-stats {
        gap: 1rem;
        overflow-y: visible; /* Allow tooltips to show */
    }
    
    .control-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
}

@media (max-width: 768px) {
    .news-panel {
        position: static;
        width: 100%;
        max-height: 35vh;
        height: auto;
        top: auto;
        left: auto;
        border-radius: 0;
        box-shadow: none;
        border-left: none;
        border-right: none;
    }
    
    .news-panel.minimized {
        position: fixed !important;
        bottom: 1.5rem !important;
        left: 1.5rem !important;
        width: 50px;
        height: 50px;
        border-radius: 50%;
    }
    
    .map-controls {
        position: static;
        top: auto;
        right: auto;
        flex-direction: row;
        justify-content: space-between;
        border-radius: 0;
        box-shadow: none;
        border-left: none;
        border-right: none;
    }
    
    .map-controls.minimized {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        justify-content: center;
    }
    
    .header-minimize {
        position: static;
    }
    
    .main-content {
        display: flex;
        flex-direction: column;
    }
    
    .map-container {
        height: calc(100vh - 160px); /* fill remaining space */
        order: 1;
    }
    
    .news-panel { order: 2; }
    
    .header {
        padding: 0.5rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .header-stats {
        flex-direction: row;
        gap: 1rem;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .stat-item {
        min-width: 120px;
        padding: 0.5rem 0.75rem;
    }
    
    .stat-item i {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .stat-value {
        font-size: 0.9rem;
    }
    
    .map-controls {
        padding: 0.5rem 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .control-group {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .control-btn {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
        min-width: auto;
    }
    
    .control-btn i {
        font-size: 0.7rem;
        margin-right: 0.25rem;
    }
    
    .legend {
        min-width: auto;
        width: 100%;
        max-height: 200px;
        overflow-y: auto;
    }
    
    .legend h4, .legend h5 {
        font-size: 0.75rem;
    }
    
    .legend-item {
        font-size: 0.65rem;
        margin-bottom: 0.25rem;
    }
    
    .map-info-panel {
        position: relative;
        top: auto;
        right: auto;
        margin: 0.5rem;
        max-width: none;
        font-size: 0.75rem;
    }
    
    .news-feed {
        padding: 1rem;
        min-height: 150px;
        max-height: 300px;
    }
    
    .news-article {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .news-title {
        font-size: 0.8rem;
    }
    
    .news-summary {
        font-size: 0.7rem;
    }
    
    .air-quality-section {
        max-height: 250px;
    }
    
    .aqi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        max-height: 150px;
    }
    
    .aqi-item {
        padding: 0.5rem;
        min-height: 70px;
    }
    
    .deforestation-alerts {
        max-height: 220px;
    }
    
    .alerts-list {
        max-height: 150px;
    }
    
    .alert-item {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.5rem;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .header-stats {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .stat-item {
        min-width: auto;
        padding: 0.5rem;
        justify-content: center;
    }
    
    .stat-content {
        align-items: center;
        text-align: center;
    }
    
    .stat-label {
        font-size: 0.6rem;
    }
    
    .stat-value {
        font-size: 0.85rem;
    }
    
    .control-group {
        grid-template-columns: repeat(2, 1fr);
        display: grid;
        gap: 0.25rem;
        width: 100%;
    }
    
    .control-btn {
        font-size: 0.65rem;
        padding: 0.35rem 0.5rem;
        justify-content: center;
    }
    
    .map-controls {
        padding: 0.5rem;
    }
    
    .legend {
        padding: 0.75rem;
        max-height: 150px;
    }
    
    .news-panel {
        height: 40vh;
    }
    
    .map-container {
        height: 60vh;
    }
    
    .aqi-grid {
        grid-template-columns: 1fr;
    }
}

/* Custom Leaflet Styles */
.leaflet-popup-pane {
    z-index: 2000 !important;
}

/* Completely hide any Leaflet attribution and bottom controls */
.leaflet-control-attribution,
.leaflet-attribution-flag,
.leaflet-bottom,
.leaflet-control-container .leaflet-bottom,
.leaflet-control-container .leaflet-bottom .leaflet-control-attribution,
.leaflet-control-container .leaflet-bottom .leaflet-control,
.leaflet-control-container .leaflet-bottom-left,
.leaflet-control-container .leaflet-bottom-right {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Force hide any bottom elements that might appear */
*[class*="leaflet"][class*="bottom"],
*[class*="attribution"],
*[class*="credit"] {
    display: none !important;
}

/* Ensure map takes full height without any bottom spacing */
.map-container,
#map {
    height: 100% !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* Additional aggressive hiding for any bottom elements */
.leaflet-container .leaflet-control-container .leaflet-bottom {
    display: none !important;
    height: 0 !important;
    visibility: hidden !important;
}

/* Bottom bar already removed via Leaflet settings */

/* Version Badge */
.version-badge {
    position: fixed;
    bottom: 0.5rem;
    left: 0.5rem;
    background: rgba(15, 23, 42, 0.8);
    color: #94a3b8;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid rgba(34, 197, 94, 0.2);
    z-index: 500;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    font-family: 'Inter', monospace;
    letter-spacing: 0.02em;
}

.version-badge:hover {
    background: rgba(15, 23, 42, 0.95);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
}

.leaflet-popup {
    z-index: 2000 !important;
}

.leaflet-popup-content-wrapper {
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: 0.75rem;
    color: #f8fafc;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    min-width: 200px;
}

.leaflet-popup-content {
    margin: 1rem !important;
    font-size: 0.875rem;
    line-height: 1.5;
}

.leaflet-popup-tip {
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.leaflet-control-zoom a {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #f8fafc;
}

.leaflet-control-zoom a:hover {
    background: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
}

/* Forest Region Styles */
.forest-region {
    transition: all 0.3s ease;
}

.forest-region:hover {
    stroke-width: 3 !important;
    filter: brightness(1.1);
}

/* Deforestation Hotspot Animations */
.deforestation-hotspot.pulse-critical {
    animation: pulseCritical 2s infinite;
}

.deforestation-hotspot.pulse-high {
    animation: pulseHigh 3s infinite;
}

.deforestation-hotspot.pulse-moderate {
    animation: pulseModerate 4s infinite;
}

/* Local hotspot styling - enhanced visibility on zoom */
.deforestation-hotspot.local-hotspot {
    transition: opacity 0.3s ease, fill-opacity 0.3s ease;
}

.local-hotspot-note {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 0.25rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

@keyframes pulseCritical {
    0%, 100% { 
        stroke-opacity: 1;
        stroke-width: 3;
    }
    50% { 
        stroke-opacity: 0.3;
        stroke-width: 6;
    }
}

@keyframes pulseHigh {
    0%, 100% { 
        stroke-opacity: 0.9;
        stroke-width: 2.5;
    }
    50% { 
        stroke-opacity: 0.4;
        stroke-width: 5;
    }
}

@keyframes pulseModerate {
    0%, 100% { 
        stroke-opacity: 0.8;
        stroke-width: 2;
    }
    50% { 
        stroke-opacity: 0.5;
        stroke-width: 4;
    }
}

/* Region-specific styling */
.region-amazon {
    filter: hue-rotate(10deg);
}

.region-indonesia {
    filter: hue-rotate(-10deg);
}

.region-congo-basin {
    filter: hue-rotate(5deg);
}

/* Protected Areas Styling */
.protected-area {
    transition: all 0.3s ease;
}

.protected-area:hover {
    stroke-width: 3 !important;
    fill-opacity: 0.5 !important;
}

/* Enhanced map interactions */
.leaflet-interactive:hover {
    cursor: pointer;
}

/* Improved control buttons */
.control-btn {
    font-weight: 500;
    letter-spacing: 0.025em;
    position: relative;
}

.control-btn i {
    font-size: 0.875rem;
}

.control-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #22c55e;
    border-radius: 1px;
}

/* Enhanced legend styling for combined view */
.legend h5 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
}

.legend-item {
    font-size: 0.75rem;
}

/* Air quality markers enhanced visibility */
.leaflet-marker-icon {
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important;
}

/* Deforestation hotspots enhanced for overlay */
.deforestation-hotspot {
    z-index: 1000;
}

/* Forest regions lower z-index for background */
.forest-region {
    z-index: 100;
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
    .control-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem 0.75rem;
    }
    
    .news-article {
        min-height: 44px;
        padding: 1rem;
    }
    
    .leaflet-control-zoom a {
        width: 44px;
        height: 44px;
        line-height: 44px;
        font-size: 1.2rem;
    }
    
    .leaflet-popup-content {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .map-info-panel {
        font-size: 0.85rem;
        line-height: 1.5;
    }
}

/* Prevent text selection on mobile */
.control-btn, .news-article, .legend {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Improve tap targets */
.leaflet-interactive {
    cursor: pointer;
}

/* Enhanced mobile popup styling */
@media (max-width: 768px) {
    .leaflet-popup-content-wrapper {
        max-width: 280px;
        font-size: 0.8rem;
    }
    
    .leaflet-popup-content {
        margin: 0.75rem;
        line-height: 1.5;
    }
}
