/* Base styles */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --background-color: #f5f6fa;
    --text-color: #2c3e50;
    --increasing-color: #e74c3c;
    --decreasing-color: #2ecc71;
    --steady-color: #f1c40f;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header styles */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

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

.logo-container img {
    height: 50px;
    width: auto;
}

.title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    margin: 0 auto;
    padding: 10px 0;
}

.title-container h1 {
    font-size: 2rem;
    margin: 0;
    color: white;
    font-weight: 600;
    line-height: 1.2;
}

.title-container p {
    font-size: 1rem;
    margin: 5px 0 0 0;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.2;
}

/* Legend styles */
.legend {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 1000;
    max-width: 90%;
    margin: 0 10px;
}

.legend-section {
    margin-bottom: 8px;
}

.legend-section:last-child {
    margin-bottom: 0;
}

.legend-section h4 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    color: #333;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.8rem;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
    margin-right: 8px;
}

.legend-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

/* Filter buttons */
.filter-buttons {
    display: flex;
    gap: 10px;
    padding: 10px;
    background-color: var(--primary-color);
    justify-content: center;
    position: relative;
    z-index: 1000;
}

.filter-button {
    padding: 8px 12px;
    background-color: var(--primary-color);
    color: var(--primary-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    flex: 1;
    text-align: center;
}

.filter-button.active {
    background-color: #3498db; /* Blue for on state */
    color: white;
}

.filter-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* Map container */
#map {
    width: 100%;
    height: calc(100vh - 120px); /* Adjust based on header height */
    position: relative;
    z-index: 1;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        padding: 10px;
    }

    .logo-container {
        position: absolute;
        right: 10px;
        top: 10px;
    }

    .logo-container img {
        height: 40px;
    }

    .title-container {
        margin-top: 10px;
        margin-bottom: 10px;
    }

    .title-container h1 {
        font-size: 1.1rem;
        text-align: center;
    }

    .title-container p {
        font-size: 0.6rem;
    }

    .filter-buttons {
        padding: 5px;
        gap: 5px;
        margin-top: 10px;
    }

    .filter-button {
        padding: 6px 10px;
        font-size: 0.5rem;
    }

    #map {
        height: calc(100vh - 150px); /* Adjust based on header + buttons height */
    }
}

/* Debug styles to make sure elements are visible */
#map:empty::before {
    content: "Map container is empty";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: red;
    font-weight: bold;
}

/* Buoy view styles */
#buoy-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.chart-container {
    padding: 20px;
    background-color: #000000;
    min-height: 100vh;
}

.chart {
    width: 100%;
    height: 300px;
    margin-bottom: 20px;
    background-color: #000000;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #FFFFFF;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* Footer styles */
footer {
    text-align: center;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    width: 100%;
    font-size: 0.9rem;
    flex-shrink: 0;
}

footer p {
    margin: 0;
}

.copyright {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Marker styles */
.buoy-marker {
    background: none;
    border: none;
}

.buoy-marker img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

.buoy-marker.steady img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) brightness(0) invert(1);
}

.buoy-marker.increasing img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) hue-rotate(0deg);
}

.buoy-marker.decreasing img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) hue-rotate(240deg);
}

.met-marker {
    background: none;
    border: none;
}

.met-marker img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

.met-marker.steady img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) brightness(0) invert(1);
}

.met-marker.increasing img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) hue-rotate(0deg);
}

.met-marker.decreasing img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) hue-rotate(240deg);
}

.tidal-marker {
    background: none;
    border: none;
}

.tidal-marker img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

.tidal-marker.steady img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) brightness(0) invert(1);
}

.tidal-marker.increasing img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) hue-rotate(0deg);
}

.tidal-marker.decreasing img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) hue-rotate(240deg);
}

/* Tooltip styles */
.station-tooltip {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    max-width: 300px;
    font-family: Arial, sans-serif;
}

.station-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
    text-align: center;
}

.station-timestamp {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    text-align: center;
}

.station-data {
    display: flex;
    flex-direction: row;
    gap: 16px;
    justify-content: space-between;
}

.data-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 14px;
    color: #666;
    min-width: 60px;
}

.data-value span {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
}

/* Leaflet tooltip styles */
.leaflet-tooltip {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.leaflet-tooltip-content {
    margin: 0 !important;
}

/* Mobile-specific tooltip adjustments */
@media (max-width: 768px) {
    .station-tooltip {
        min-width: 180px !important;
        max-width: 90vw !important;
        font-size: 14px !important;
        padding: 8px !important;
    }

    .station-name {
        font-size: 16px !important;
    }

    .station-timestamp {
        font-size: 12px !important;
    }

    .data-value {
        font-size: 12px !important;
        min-width: 50px !important;
    }

    .data-value span {
        font-size: 16px !important;
    }

    .chart {
        height: 250px;
    }

    .chart-legend {
        flex-wrap: wrap;
        gap: 10px;
    }

    .legend-item {
        font-size: 14px;
    }
}

/* Marker styles */
.buoy-marker img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

.buoy-marker.steady img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) brightness(0) invert(1);
}

.buoy-marker.increasing img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) hue-rotate(0deg);
}

.buoy-marker.decreasing img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5)) hue-rotate(240deg);
}

.met-marker svg {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

/* Mobile-friendly styles */
@media (max-width: 768px) {
    .station-tooltip {
        min-width: 180px !important;
        max-width: 90vw !important;
        font-size: 14px !important;
        padding: 8px !important;
    }

    .station-name {
        font-size: 16px !important;
    }

    .station-timestamp {
        font-size: 12px !important;
    }

    .data-value {
        font-size: 12px !important;
    }

    .data-value span {
        font-size: 16px !important;
    }

    .legend {
        font-size: 12px !important;
        padding: 8px !important;
    }

    .legend h4 {
        font-size: 14px !important;
        margin: 0 0 4px 0 !important;
    }

    .legend img {
        width: 16px !important;
        height: 16px !important;
    }
} 

.chart-scroll-wrapper {
    overflow-x: visible; /* default: no scroll on desktop */
}

/* Enable horizontal scroll only on small screens */
@media (max-width: 768px) {
    .chart-scroll-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chart {
        min-width: 600px; /* forces the chart to be wider than the screen */
    }
}