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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #ffffff;
    color: #1e293b;
    overflow-x: hidden;
    padding-bottom: 60px;
}

#visualization {
    width: 100%;
    min-height: 100vh;
    position: relative;
}


#loading {
    display: none;
}

.error {
    color: #ef4444;
    background-color: #7f1d1d;
    padding: 1rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* D3 visualization styles */
.location-label {
    fill: #1e293b;
    font-weight: 500;
    font-family: 'Arial Narrow', Arial, sans-serif;
}

.hour-label {
    fill: #475569;
}

.grid-cell {
    stroke: none;
}

.grid-cell:hover {
    stroke: #60a5fa;
    stroke-width: 1.5;
}

.temp-text {
    font-size: 8px;
    font-weight: 600;
    pointer-events: none;
}

.snow-text {
    font-size: 7px;
    font-weight: 500;
    pointer-events: none;
}

.snow-indicator-forecast {
    fill: #3b82f6;
    opacity: 1.0;
}

.snow-indicator-observed {
    fill: #1e40af;
    opacity: 1.0;
}

.tooltip {
    position: absolute;
    background-color: #1e293b;
    color: #e2e8f0;
    border: 1px solid #475569;
    border-radius: 6px;
    padding: 0.75rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.875rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.tooltip.visible {
    opacity: 1;
}

/* Line chart legend styles */
.legend-item {
    cursor: pointer;
    user-select: none;
}

.legend-item.disabled,
.legend-item.disabled:hover {
    opacity: 0.3;
}

.legend-item:not(.disabled):hover {
    opacity: 0.7;
}

#data-info {
    margin: 0;
    padding: 8px 20px;
    background-color: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    font-size: 11px;
    color: #475569;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
}

#data-info h3 {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
}

.data-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.data-source-name {
    font-weight: 500;
    color: #475569;
}

.data-source-time {
    color: #15181d;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

/* Webcam styles */
#webcam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.webcam-location {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.webcam-location h3 {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #1e293b;
    text-transform: capitalize;
}

.webcam-images {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.webcam-image-item {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
}

.webcam-image-wrapper {
    overflow: hidden;
    cursor: pointer;
    position: relative;
    /* Enforce 16:9 (1.77:1) aspect ratio */
    aspect-ratio: 1.77;
}

.webcam-image-wrapper:hover::after {
    content: '🔍 Click for full size';
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.85em;
}

.webcam-image-item img {
    width: 100%;
    height: 100%;
    display: block;
    /* Center crop for images that don't match 1.77:1 */
    object-fit: cover;
    object-position: center;
}

/* Modal styles */
.webcam-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

.webcam-modal.active {
    display: flex;
}

.webcam-modal-content {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

.webcam-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.webcam-modal-close:hover {
    color: #ccc;
}

.webcam-image-label {
    padding: 8px;
    background-color: #f8fafc;
    font-size: 0.85em;
    color: #475569;
}

.webcam-image-label strong {
    color: #1e293b;
}

/* Old per-camera cropping rules removed - now using generic aspect-ratio: 1.77 + object-fit: cover */

/* Mobile responsive styles */
@media (max-width: 768px) {
    body {
        padding-bottom: 40px;
        overflow-x: hidden;
    }

    #visualization {
        width: 100%;
    }

    .location-label {
        font-size: 0.7em;
    }

    .hour-label {
        font-size: 0.7em;
    }

    .temp-text {
        font-size: 8px;
    }

    .snow-text {
        font-size: 7px;
    }

    .tooltip {
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    #data-info {
        padding: 6px 12px;
        font-size: 10px;
        gap: 4px 10px;
    }

    #data-info h3 {
        font-size: 10px;
    }

    .data-source-time {
        font-size: 9px;
    }
}
