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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    overflow: hidden;
}

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

.sidebar {
    width: 420px;
    background: #ffffff;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-header {
    padding: 24px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.sidebar h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
}

.subtitle {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 4px;
}

.controls {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.btn {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    color: #475569;
    transition: all 0.2s;
}

.btn:hover {
    background: #e2e8f0;
}

.btn-primary {
    background: #0ea5e9;
    color: white;
    border-color: #0ea5e9;
}

.btn-primary:hover {
    background: #0284c7;
}

.content-area {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
}

.sensor-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.sensor-card h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: #0ea5e9;
    font-weight: 700;
}

.data-group {
    margin-bottom: 16px;
}

.data-group-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 8px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
}

.data-row:last-child {
    border-bottom: none;
}

.data-label {
    color: #475569;
}

.data-value {
    font-weight: 600;
    color: #1e293b;
}

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

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

/* Map Markers */
.custom-marker-bubble {
    background: white;
    border: 2px solid #0ea5e9;
    border-radius: 30px;
    padding: 4px 10px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
    text-align: center;
    white-space: nowrap;
    cursor: grab;
}

.custom-marker-bubble.edit-mode {
    border-color: #ef4444;
    background: #fee2e2;
    color: #991b1b;
}

/* Edit Form inside Popup */
.edit-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 200px;
}

.edit-form label {
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edit-form input[type="text"] {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-top: 4px;
}

.edit-form button {
    margin-top: 8px;
}

/* Grid Wind Particles */
.grid-wind-container {
    position: absolute;
    pointer-events: none;
}

.grid-wind-particle {
    position: absolute;
    color: #94a3b8;
    font-size: 1.2rem;
    opacity: 0;
    animation: flow var(--duration) linear infinite;
    animation-delay: var(--delay);
}

/* Add to styles.css */
.wind-canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 400;
    /* Stays above map tiles, below popups */
    pointer-events: none;
    /* Let mouse clicks pass through to the map */
}

@keyframes flow {
    0% {
        transform: translate(0, 0) rotate(var(--rot));
        opacity: 0;
    }

    20% {
        opacity: 0.6;
    }

    80% {
        opacity: 0.6;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) rotate(var(--rot));
        opacity: 0;
    }
}

/* Fix Map Container Visibility */
.map-container {
    flex-grow: 1;
    position: relative;
    min-width: 0;
    /* Crucial fix for flexbox layout collapse */
    height: 100vh;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Sidebar Setup for Desktop */
.sidebar {
    width: 420px;
    flex-shrink: 0;
    background: #ffffff;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: margin-left 0.3s ease;
}

.sidebar.hidden {
    margin-left: -420px;
    /* Slides left on desktop */
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .app-container {
        display: block;
        /* Remove flexbox on mobile */
    }

    .map-container {
        height: 100vh;
        width: 100%;
    }

    .sidebar {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 50vh;
        z-index: 1001;
        transition: transform 0.3s ease;
        /* Animate transform instead of margin */
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        /* Shadow on top edge */
    }

    .sidebar.hidden {
        margin-left: 0;
        /* Cancel the desktop left slide */
        transform: translateY(100%);
        /* Slides down off the bottom of the screen */
    }
}

/* Replace the mobile media query in styles.css */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        order: 2;
        /* Forces sidebar to the bottom */
        width: 100%;
        height: 50vh;
        transition: margin-bottom 0.3s ease;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    }

    .sidebar.hidden {
        margin-left: 0;
        /* Cancel the desktop slide-left */
        margin-bottom: -50vh;
        /* Slide down off the screen */
    }
}

.map-toggle-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-size: 1rem;
    padding: 10px 16px;
}

/* Apple Weather Style Markers */
.apple-marker {
    background-color: #1e293b;
    color: #ffffff;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.apple-marker.edit-mode {
    background-color: #ef4444;
    border-color: #fca5a5;
}