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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 50%, #0369a1 100%);
    min-height: 100vh;
    color: #333;
}

header {
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    max-width: 1300px;
    margin: 0 auto;
    background: transparent;
    box-shadow: none;
}

header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: .5rem;
    color: white;
}

header h1 img.logo {
    height: 40px;
    width: auto;
}

#location-search {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

#location-input {
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border: 2px solid #0284c7;
    border-radius: 8px;
    min-width: 200px;
}

button {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    background: #0284c7;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

button:hover {
    background: #0369a1;
}

#search-btn {
    background: transparent;
    color: white;
    border: 2px solid white;
}

#search-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

#geolocation-btn {
    background: #48bb78;
}

#geolocation-btn:hover {
    background: #38a169;
}

main {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1rem;
}

#weather-section {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.hidden {
    display: none !important;
}

#loading {
    text-align: center;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(2, 132, 199, 0.2);
    border-top-color: #0284c7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.2rem;
    color: #0284c7;
    font-weight: 500;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

#loading.hidden {
    display: none !important;
}

/* Weather Alerts Section */
#weather-alerts {
    margin-bottom: 0rem;
}

.alert-box {
    background: white;
    border-radius: 0.75rem;
    padding: 0.5rem 1rem .25rem 1rem;
    margin-bottom: .75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.alert-box:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.alert-box.severity-extreme {
    background: #fee;
    border-left-color: #dc2626;
}

.alert-box.severity-severe {
    background: #ffedd5;
    border-left-color: #ea580c;
}

.alert-box.severity-moderate {
    background: #fef9c3;
    border-left-color: #eab308;
}

.alert-box.severity-minor {
    background: #dbeafe;
    border-left-color: #3b82f6;
}

.alert-box.no-alerts {
    background: #84fea7;
    padding: 0.5rem 1rem .5rem 1rem;
    text-align: center;
    color: #166534;
    font-weight: 500;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.25rem;
}

.alert-event {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111;
}

.alert-severity {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
    text-transform: uppercase;
}

.severity-extreme .alert-severity {
    background: #dc2626;
    color: white;
}

.severity-severe .alert-severity {
    background: #ea580c;
    color: white;
}

.severity-moderate .alert-severity {
    background: #eab308;
    color: white;
}

.severity-minor .alert-severity {
    background: #3b82f6;
    color: white;
}

.alert-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.alert-toggle {
    color: #0284c7;
    text-decoration: underline;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-expires {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

.alert-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

/* Weather News Section */
#weather-news {
    margin: 1.5rem 0;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

#weather-news h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    color: #0284c7;
    margin-bottom: 1rem;
}

.news-category-header {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #0369a1;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid #0ea5e9;
}

.news-category-header:first-child {
    margin-top: 0;
}

.news-item {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid #0284c7;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.news-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.news-item.breaking-news {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-left-color: #dc2626;
}

.news-item.breaking-news:hover {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.news-item.featured-story {
    border: 2px solid #dc2626;
    border-left-width: 6px;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.25);
    margin-bottom: 1.5rem;
}

.news-item.featured-story:hover {
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35);
    transform: translateY(-3px);
}

.news-item.featured-story .news-item-title {
    font-size: 1.3rem;
}

.news-item.featured-story .breaking-badge {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

.breaking-badge {
    display: inline-block;
    background: #dc2626;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.regional-badge {
    display: inline-block;
    background: #0284c7;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.news-item.breaking-news .regional-badge {
    background: #b91c1c;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.news-item.featured-story .regional-badge {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
}

.news-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.news-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0369a1;
    flex: 1;
}

.news-item-source {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    font-weight: 500;
    white-space: nowrap;
}

.news-item-summary {
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.news-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #64748b;
}

.news-item-date {
    font-style: italic;
}

.news-item-link {
    color: #0284c7;
    text-decoration: none;
    font-weight: 500;
}

.news-item-link:hover {
    text-decoration: underline;
}

#error {
    background: #fed7d7;
    color: #c53030;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

#current-weather h2,
#forecast h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    color: #0284c7;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid #0284c7;
    padding-bottom: 0.5rem;
}

#current-data {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.weather-card {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    min-height: 120px;
    height: auto;
    display: flex;
    flex-direction: column;
}

.weather-card h3 {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.weather-card .value {
    font-size: 2rem;
    font-weight: bold;
}

#forecast-data {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem;
    cursor: grab;
    user-select: none;
}

#forecast-data:active {
    cursor: grabbing;
}

#forecast-data::-webkit-scrollbar {
    height: 8px;
}

#forecast-data::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#forecast-data::-webkit-scrollbar-thumb {
    background: #0284c7;
    border-radius: 4px;
}

#forecast-data::-webkit-scrollbar-thumb:hover {
    background: #0369a1;
}

.forecast-card {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    display: grid;
    grid-template-rows: auto auto auto auto auto auto;
    align-items: center;
    min-width: 190px;
    flex-shrink: 0;
    position: relative;
}

.forecast-info-btn {
    position: absolute !important;
    top: 0.5rem !important;
    right: 0.5rem !important;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 0;
    margin: 0;
    line-height: 1;
    z-index: 10;
    width: auto;
    height: auto;
}

.forecast-info-btn:hover {
    opacity: 1;
}

.forecast-card .day {
    font-weight: bold;
    color: #0284c7;
    margin-bottom: 0.5rem;
}

.forecast-card .temp {
    font-size: 1.5rem;
    margin: 0.5rem 0;
}

.forecast-card .condition {
    color: #666;
    font-size: 0.9rem;
}

footer {
    text-align: center;
    color: white;
    padding: 2rem;
    margin-top: 0;
    margin-bottom: 0;
}

.forecast-timestamp {
    margin-top: 1rem;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: #666;
}

.forecast-timestamp-grid {
    grid-column: 1 / -1;
    margin-top: 1rem;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: #666;
}

.unit-toggle-btn {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    align-self: flex-start;
}

.unit-option {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    color: white;
    background: #38bdf8;
    transition: all 0.3s;
    min-width: 50px;
    text-align: center;
}

.unit-option.active {
    background: #0284c7;
    font-weight: bold;
}

/* Weather data display classes */
.weather-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.2rem;
}

.weather-value-large {
    font-size: 1.6rem;
    margin-bottom: 0.8rem;
}

.weather-value-medium {
    font-size: 1.4rem;
}

.weather-detail {
    font-size: 0.95rem;
    line-height: 1.4;
}

.weather-subtext {
    font-size: 0.9rem;
    margin-top: 0.3rem;
    opacity: 0.9;
}

.weather-subtext-smaller {
    font-size: 0.85rem;
    opacity: 0.85;
}

.weather-feels-like {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    opacity: 0.9;
}

.weather-sea-level {
    font-size: 0.7rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

.condition-icon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
}

.condition-icon {
    width: 80px;
    height: 80px;
    margin: 4px;
}

.condition-text {
    font-size: 1.2rem;
}

.condition-temp {
    font-size: 1.2rem;
    margin-top: 0.25rem;
    width: 100%;
}

.forecast-icon {
    width: 60px;
    height: 60px;
    justify-self: center;
}

.forecast-detail {
    font-size: 0.85rem;
    color: #888;
}

.forecast-condition-start {
    align-self: start;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.4) 0%, rgba(2, 132, 199, 0.4) 100%);
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    color: white;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    color: #0284c7;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
    padding: 0;
}

.modal-close:hover {
    background: #e0f2fe;
}

.modal-content h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: white;
}

.modal-content p {
    line-height: 1.6;
    font-size: 1rem;
    color: white;
}

.conditions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: .5rem;
}

.conditions-header h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    margin: 0;
}

.observation-footer {
    grid-column: 1 / -1;
    margin-top: -0.5rem;
    padding: 0.75rem 1rem;
    background: #e0f2fe;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #0369a1;
    text-align: left;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
    }

    header h1 {
        font-size: 2rem;
        justify-content: center;
    }

    #location-search {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }

    #location-input {
        flex: 1 1 100%;
        min-width: 100%;
    }

    #search-btn,
    #geolocation-btn {
        flex: 1 1 auto;
        min-width: fit-content;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .conditions-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .conditions-header h2 {
        margin-bottom: 0 !important;
    }
}
