/* Import Tailwind base styles */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Define your brand colors */
:root {
    --brand-bg: #111827;
    --brand-text: #F3F4F6;
    --brand-primary: #F59E0B;
    --brand-primary-hover: #D97706;
    --brand-secondary: #374151;
    --brand-input: #1F2937;
}

/* Base Styles */
body {
    background-color: var(--brand-bg);
    color: var(--brand-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Map Container */
#map {
    width: 100%;
    height: 100%;
    background-color: #1a1a1a;
}

/* Dashboard Panel Transition */
#dashboard-panel {
    transition: transform 0.3s ease-in-out;
}

#dashboard-panel.collapsed {
    transform: translateY(100%);
}

/* Custom Scrollbar for Feature List */
#feature-list::-webkit-scrollbar {
    width: 6px;
}

#feature-list::-webkit-scrollbar-track {
    background: var(--brand-input);
}

#feature-list::-webkit-scrollbar-thumb {
    background: var(--brand-secondary);
    border-radius: 3px;
}

#feature-list::-webkit-scrollbar-thumb:hover {
    background: #4B5563;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    background-color: var(--brand-secondary);
    color: var(--brand-text);
    border-radius: 0.5rem;
    border: 1px solid var(--brand-primary);
    padding: 0;
}

.leaflet-popup-content {
    margin: 10px;
    line-height: 1.5;
}

.leaflet-popup-tip {
    background-color: var(--brand-secondary);
    border: 1px solid var(--brand-primary);
    border-top: none;
    border-left: none;
}

.leaflet-container a.leaflet-popup-close-button {
    color: var(--brand-text);
}

/* Loader */
.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--brand-primary);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Feature List Item Hover */
.feature-item:hover {
    background-color: rgba(245, 158, 11, 0.1);
    cursor: pointer;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

    /* Left panel visible on mobile but scrollable */
    .control-panel {
        position: relative !important;
        width: 100% !important;
        min-width: unset !important;
        height: auto !important;
        max-height: 50vh;
        overflow-y: auto;
        border-right: none;
        border-bottom: 1px solid var(--brand-secondary);
    }

    /* Make dashboard smaller on mobile */
    #dashboard-panel {
        height: 40vh !important;
        max-height: 400px;
    }

    /* Stack dashboard content vertically */
    #dashboard-panel>div>div {
        flex-direction: column !important;
    }

    /* Full width dashboard sections */
    #dashboard-panel .w-1/4 {
        width: 100% !important;
        min-width: unset !important;
        margin-bottom: 0.5rem;
    }

    /* Smaller text on mobile */
    #dashboard-panel .text-2xl {
        font-size: 1.25rem !important;
    }

    /* Compact feature list */
    .feature-item {
        font-size: 0.65rem !important;
        padding: 0.25rem !important;
    }

    /* Smaller chart */
    #hazardChart {
        max-height: 150px;
    }

    /* Map takes remaining space */
    #map {
        flex: 1;
        min-height: 300px;
    }

    /* Stack layout vertically on mobile */
    body>div:nth-child(2) {
        flex-direction: column !important;
    }
}

/* Desktop: normal layout */
@media (min-width: 769px) {
    #map {
        position: relative;
    }

    .control-panel {
        position: relative !important;
    }
}