/* ------------------------------------------- */
/* MIKES WEATHER - SEA CADETS THEME */
/* ------------------------------------------- */

:root {
    --mw-blue-navy: #003366;
    --mw-gold-brass: #FFCC00;
    --mw-teal-accent: #00A3A3;
    --mw-light-bg: #f4f4f9;
    --mw-dark-text: #333333;
    --mw-green-success: #3CB371;
    --mw-red-error: #DC143C;
}

/* ------------------------------------------- */
/* MAIN WIDGET CONTAINER */
/* ------------------------------------------- */
.mikes-weather-widget {
    max-width: 400px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.weather-display {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 51, 102, 0.2);
}

/* ------------------------------------------- */
/* HEADER SECTION */
/* ------------------------------------------- */
.weather-header {
    background: linear-gradient(135deg, var(--mw-blue-navy) 0%, var(--mw-teal-accent) 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.weather-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
}

.weather-icon {
    font-size: 2.5em;
}

/* ------------------------------------------- */
/* LOCATION SELECTOR */
/* ------------------------------------------- */
.location-selector {
    background: linear-gradient(135deg, var(--mw-blue-navy) 0%, var(--mw-teal-accent) 100%);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 3px solid var(--mw-gold-brass);
}

.location-selector label {
    color: white;
    font-size: 0.9em;
    font-weight: 600;
    white-space: nowrap;
}

.unit-location-select {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--mw-blue-navy);
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.unit-location-select:hover {
    border-color: var(--mw-gold-brass);
}

.unit-location-select:focus {
    outline: none;
    border-color: var(--mw-gold-brass);
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.3);
}

.unit-location-select optgroup {
    font-weight: bold;
    color: var(--mw-blue-navy);
    background: var(--mw-light-bg);
}

.unit-location-select option {
    padding: 8px;
    font-weight: normal;
}

.location-name {
    display: none; /* Hidden, used for JS reference */
}

/* ------------------------------------------- */
/* MAIN WEATHER DISPLAY */
/* ------------------------------------------- */
.weather-main {
    background: white;
    padding: 30px 20px;
    text-align: center;
    border-bottom: 3px solid var(--mw-gold-brass);
}

.temperature {
    font-size: 4em;
    font-weight: bold;
    color: var(--mw-blue-navy);
    margin: 0;
    line-height: 1;
}

.description {
    font-size: 1.3em;
    color: var(--mw-teal-accent);
    margin-top: 10px;
    font-weight: 500;
}

/* ------------------------------------------- */
/* WEATHER DETAILS GRID */
/* ------------------------------------------- */
.weather-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--mw-light-bg);
    padding: 0;
}

.weather-details.has-moon {
    grid-template-columns: 1fr 1fr 1fr;
}

.detail-item {
    text-align: center;
    padding: 15px;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}

.detail-item:last-child {
    border-right: none;
}

.weather-details:not(.has-moon) .detail-item:nth-child(2) {
    border-right: none;
}

.detail-item .label {
    display: block;
    font-size: 0.75em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.detail-item .value {
    display: block;
    font-weight: bold;
    font-size: 1.1em;
    color: var(--mw-blue-navy);
}

.detail-item.moon-phase .value {
    color: var(--mw-teal-accent);
}

/* ------------------------------------------- */
/* ACTION BUTTONS */
/* ------------------------------------------- */
.weather-actions {
    background: white;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    border-top: 1px solid #eee;
}

.weather-actions button {
    padding: 10px 16px;
    border: 2px solid var(--mw-blue-navy);
    border-radius: 25px;
    background: white;
    color: var(--mw-blue-navy);
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.weather-actions button:hover {
    background: var(--mw-blue-navy);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

.weather-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ------------------------------------------- */
/* FORECAST SECTION */
/* ------------------------------------------- */
.forecast-section {
    background: white;
    border-top: 3px solid var(--mw-gold-brass);
}

.forecast-tabs {
    display: flex;
    background: var(--mw-light-bg);
    padding: 10px;
    gap: 10px;
}

.forecast-tab {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--mw-blue-navy);
    background: white;
    color: var(--mw-blue-navy);
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.forecast-tab:hover {
    background: var(--mw-light-bg);
}

.forecast-tab.active {
    background: var(--mw-teal-accent);
    border-color: var(--mw-teal-accent);
    color: white;
}

.forecast-content {
    display: none;
    padding: 15px;
}

.forecast-content.active {
    display: block;
}

.forecast-scroll {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 5px 0 10px;
}

.forecast-scroll::-webkit-scrollbar {
    height: 6px;
}

.forecast-scroll::-webkit-scrollbar-track {
    background: var(--mw-light-bg);
    border-radius: 3px;
}

.forecast-scroll::-webkit-scrollbar-thumb {
    background: var(--mw-teal-accent);
    border-radius: 3px;
}

.forecast-item {
    flex: 0 0 auto;
    min-width: 70px;
    text-align: center;
    padding: 12px 10px;
    background: var(--mw-light-bg);
    border-radius: 10px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.forecast-item:hover {
    border-color: var(--mw-teal-accent);
    transform: translateY(-2px);
}

.forecast-item:first-child {
    background: linear-gradient(135deg, var(--mw-blue-navy) 0%, var(--mw-teal-accent) 100%);
    color: white;
}

.forecast-item:first-child .forecast-day,
.forecast-item:first-child .forecast-time,
.forecast-item:first-child .temp-high,
.forecast-item:first-child .temp-low,
.forecast-item:first-child .forecast-temp {
    color: white;
}

.forecast-day,
.forecast-time {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 600;
}

.forecast-icon {
    font-size: 1.5em;
    margin: 5px 0;
}

.forecast-temps {
    font-size: 0.9em;
}

.temp-high {
    font-weight: bold;
    color: var(--mw-blue-navy);
}

.temp-low {
    color: #888;
    margin-left: 4px;
}

.forecast-temp {
    font-size: 0.95em;
    font-weight: bold;
    color: var(--mw-blue-navy);
}

.forecast-rain {
    font-size: 0.75em;
    color: var(--mw-teal-accent);
    margin-top: 4px;
    font-weight: 600;
}

.forecast-rain::before {
    content: "💧 ";
}

/* ------------------------------------------- */
/* TIDES SECTION */
/* ------------------------------------------- */
.tides-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tide-day {
    background: var(--mw-light-bg);
    border-radius: 10px;
    padding: 12px;
    border-left: 4px solid var(--mw-teal-accent);
}

.tide-day:first-child {
    border-left-color: var(--mw-gold-brass);
    background: linear-gradient(135deg, rgba(0, 51, 102, 0.05) 0%, rgba(0, 163, 163, 0.05) 100%);
}

.tide-day-header {
    font-weight: 700;
    color: var(--mw-blue-navy);
    font-size: 0.95em;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 51, 102, 0.1);
}

.tide-events {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.tide-event {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    background: white;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.tide-event:hover {
    border-color: var(--mw-teal-accent);
    transform: translateY(-2px);
}

.tide-event.high {
    border-left: 3px solid var(--mw-teal-accent);
}

.tide-event.low {
    border-left: 3px solid var(--mw-blue-navy);
}

.tide-icon {
    font-size: 1.2em;
    margin-bottom: 2px;
}

.tide-type {
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    font-weight: 600;
}

.tide-time {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--mw-blue-navy);
}

.tide-height {
    font-size: 0.85em;
    color: var(--mw-teal-accent);
    font-weight: 600;
}

/* ------------------------------------------- */
/* ERROR STATE */
/* ------------------------------------------- */
.mikes-weather-error {
    background: linear-gradient(135deg, var(--mw-red-error) 0%, #B01030 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(220, 20, 60, 0.3);
}

/* ------------------------------------------- */
/* UPDATE ANIMATION */
/* ------------------------------------------- */
.weather-display.updated {
    animation: weatherPulse 0.5s ease;
}

@keyframes weatherPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ------------------------------------------- */
/* NIGHT MODE STYLING */
/* ------------------------------------------- */
.weather-display.nighttime .weather-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, var(--mw-blue-navy) 100%);
}

.weather-display.nighttime .weather-main {
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
}

.weather-display.nighttime .temperature {
    color: #1a1a2e;
}

/* ------------------------------------------- */
/* RESPONSIVE DESIGN */
/* ------------------------------------------- */
@media (max-width: 480px) {
    .mikes-weather-widget {
        max-width: 100%;
        margin: 10px;
    }

    .temperature {
        font-size: 3em;
    }

    .weather-actions {
        flex-direction: column;
    }

    .weather-actions button {
        width: 100%;
    }

    .forecast-item {
        min-width: 60px;
        padding: 10px 8px;
    }

    .weather-details.has-moon {
        grid-template-columns: 1fr 1fr;
    }

    .weather-details.has-moon .detail-item:nth-child(2) {
        border-right: none;
    }

    .weather-details.has-moon .detail-item.moon-phase {
        grid-column: span 2;
        border-right: none;
    }
}
