:root {
    --primary-color: #764ba2;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --background-color: #051025;
    --card-background: #0e1a35;
    --element-background: #15223e;
    --text-color: #ffffff;
    --text-secondary: #a0aab5;
    --error-color: #ff6b6b;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px 0;
}

.container {
    width: 100%;
    max-width: 400px;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    padding: 20px;
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.container::-webkit-scrollbar {
    display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
.container {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

header h1 {
    margin-bottom: 20px;
    color: var(--text-color);
    font-weight: 700;
}

button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.6);
}

.hidden {
    display: none !important;
}

.loading {
    margin: 20px 0;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#error-message {
    color: var(--error-color);
    background-color: #fde8e7;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
}

/* Search Container */
.search-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

#location-input {
    width: 100%;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid var(--element-background);
    background: var(--element-background);
    color: var(--text-color);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

#search-btn, #current-location-btn {
    padding: 10px 15px;
    box-shadow: none;
    font-size: 16px;
    width: 100%;
}

#current-location-btn {
    background: var(--element-background);
    font-size: 16px;
    padding: 10px 15px;
}

#current-location-btn:hover {
    background: var(--primary-gradient);
    transform: translateY(-2px);
}

/* Header Row for Location and Toggle */
.header-row {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.header-row h2 {
    margin: 0;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
}

.unit-toggle {
    background: var(--element-background);
    border: none;
    color: var(--primary-color);
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 20px;
    box-shadow: none;
    font-weight: 600;
}

.unit-toggle:hover {
    background: var(--primary-gradient);
    color: white;
    transform: none;
    box-shadow: none;
}

.current-weather {
    margin: 30px 0;
}

.temp {
    font-size: 56px;
    font-weight: bold;
    margin: 10px 0;
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.desc {
    font-size: 18px;
    text-transform: capitalize;
    color: var(--text-secondary);
}

.feels-like-text {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 5px;
    font-weight: 500;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

/* .extra-details {
    grid-template-columns: 1fr 1fr 1fr; 
} Removed to use uniform 2-column grid */

.detail-item {
    background: var(--element-background);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

/* Hourly Forecast */
.hourly-list {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 10px; /* Space for scrollbar */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Custom scrollbar for hourly list */
.hourly-list::-webkit-scrollbar {
    height: 6px;
    display: block; /* Show scrollbar here specifically */
}

.hourly-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.hourly-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.hourly-item {
    background: var(--element-background);
    padding: 15px 10px;
    border-radius: 10px;
    min-width: 80px;
    text-align: center;
    flex-shrink: 0; /* Prevent shrinking */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.hourly-time {
    font-size: 14px;
    color: var(--text-secondary);
}

.hourly-icon img {
    width: 30px;
    height: 30px;
}

.hourly-temp {
    font-weight: 600;
    font-size: 16px;
}

/* Forecast Section */
.forecast-section {
    margin-top: 30px;
    text-align: left;
}

.forecast-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-secondary);
    border-bottom: none;
    padding-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.forecast-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.forecast-item {
    background: var(--element-background);
    border-radius: 10px;
    padding: 0; /* Reset padding for inner elements */
    border-bottom: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    overflow: hidden; /* Ensure rounded corners */
}

.forecast-item:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

.forecast-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
}

.forecast-item:last-child {
    border-bottom: none;
}

.forecast-day {
    flex: 1;
    font-weight: 500;
    color: var(--text-color);
}

.forecast-icon {
    flex: 0 0 40px;
    text-align: center;
}

.forecast-icon img {
    width: 30px;
    height: 30px;
    vertical-align: middle;
}

.forecast-temp {
    flex: 1;
    text-align: right;
    font-weight: 600;
    color: var(--text-color);
}

.forecast-temp span {
    margin-left: 5px;
}

.min-temp {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Forecast Details (Hidden by default) */
.forecast-details {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
    color: var(--text-secondary);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

#refresh-btn {
    margin-top: 25px;
    width: 100%;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    box-shadow: none;
}

#refresh-btn:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
}

.welcome-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}
