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

:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --accent: #f093fb;
    --dark: #1a1a2e;
    --light: #f8f9ff;
    --text-dark: #2d3748;
    --text-light: #718096;
    --success: #48bb78;
    --warning: #ed8936;
    --error: #f56565;
    --font-sans: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto', 'Helvetica Neue', monospace;
    --font-heading: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header Styles */
header {
    text-align: center;
    color: white;
    margin-bottom: 50px;
    animation: slideDown 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 10;
}

header h1 {
    font-size: 3.5em;
    margin-bottom: 15px;
    font-weight: 800;
    letter-spacing: -1px;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #fff 0%, #f0f0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: var(--font-heading);
}

/* Icon spacing and sizing */
.emoji.icon svg,
.logo svg {
    display: block;
}

.btn-icon, .theme-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 10px;
}

.btn-icon svg, .theme-icon svg {
    width: 18px;
    height: 18px;
}

.theme-toggle {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.12);
    color: white;
    padding: 8px 12px;
    border-radius: 10px;
    backdrop-filter: blur(6px);
    cursor: pointer;
}

header p {
    font-size: 1.2em;
    opacity: 0.95;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* Search Box */
.search-box {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    margin-bottom: 40px;
    animation: slideUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.search-box form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-box input {
    flex: 1;
    padding: 15px 25px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1em;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: #f8fafc;
    font-weight: 500;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.search-box input::placeholder {
    color: #cbd5e0;
}

.search-box button {
    padding: 15px 45px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
    letter-spacing: 0.5px;
}

.search-box button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

.search-box button:active {
    transform: translateY(-1px);
}

/* Loading State */
.loading {
    text-align: center;
    color: white;
    font-size: 1.2em;
    margin: 40px 0;
    animation: fadeIn 0.5s ease-out;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 30px auto;
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Results Section */
.results {
    animation: slideUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Current Weather Card */
.current-weather {
    background: rgba(255, 255, 255, 0.95);
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    margin-bottom: 40px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.current-weather::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
}

.current-weather h2 {
    font-size: 2.2em;
    margin-bottom: 30px;
    color: var(--primary);
    font-weight: 700;
}

.weather-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.weather-item {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f8 100%);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(102, 126, 234, 0.1);
    cursor: pointer;
}

.weather-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.2);
    background: linear-gradient(135deg, white 0%, #f0f4f8 100%);
}

.weather-item .emoji {
    font-size: 2.5em;
    margin-bottom: 12px;
    display: block;
}

.weather-item .label {
    font-size: 0.85em;
    color: var(--text-light);
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.weather-item .value {
    font-size: 2.5em;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

/* Prevent large numeric values from overflowing into adjacent cards */
.weather-item .value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Forecast Section */
.forecast-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    margin-bottom: 40px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.forecast-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--secondary), var(--primary));
}

.forecast-section h2 {
    font-size: 2.2em;
    margin-bottom: 30px;
    color: var(--primary);
    font-weight: 700;
}

.forecast-section h3 {
    margin-top: 40px;
    color: var(--primary);
    font-size: 1.4em;
    font-weight: 700;
}

.chart-container {
    margin-bottom: 50px;
    height: 400px;
    position: relative;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f8 100%);
    border-radius: 15px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

/* Forecast Table */
.forecast-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 25px;
    overflow: hidden;
    border-radius: 10px;
}

.forecast-table th {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 18px 20px;
    text-align: left;
    font-weight: 700;
    letter-spacing: 0.3px;
    font-size: 0.95em;
}

.forecast-table td {
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text-dark);
    font-weight: 500;
}

.forecast-table tr {
    transition: all 0.3s ease;
}

.forecast-table tbody tr:hover {
    background: linear-gradient(135deg, #f0f4f8 0%, #e8ecf1 100%);
    box-shadow: inset 0 0 10px rgba(102, 126, 234, 0.05);
}

.forecast-table tr:last-child td {
    border-bottom: none;
}

/* Error Styling */
.error {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 12px;
    color: var(--error);
    border-left: 5px solid var(--error);
    animation: slideUp 0.5s ease-out;
    margin-top: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.error::before {
    content: "⚠️ ";
    margin-right: 10px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.success-animation {
    animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Responsive Design */
@media (max-width: 992px) {
    header h1 {
        font-size: 2.5em;
    }

    .search-box {
        padding: 30px;
    }

    .search-box form {
        flex-direction: column;
    }

    .search-box input,
    .search-box button {
        width: 100%;
    }

    .current-weather,
    .forecast-section {
        padding: 35px;
    }

    .weather-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        margin-bottom: 30px;
    }

    header h1 {
        font-size: 2em;
    }

    header p {
        font-size: 1em;
    }

    .search-box {
        padding: 25px;
        margin-bottom: 25px;
        border-radius: 15px;
    }

    .current-weather,
    .forecast-section {
        padding: 25px;
        border-radius: 15px;
    }

    .weather-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .weather-item {
        padding: 20px;
    }

    .weather-item .emoji {
        font-size: 2em;
    }

    .weather-item .value {
        font-size: 1.8em;
    }

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

    .forecast-table th,
    .forecast-table td {
        padding: 12px 10px;
    }

    .chart-container {
        height: 300px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5em;
    }

    .search-box {
        padding: 20px;
    }

    .search-box button {
        padding: 12px 25px;
    }

    .current-weather,
    .forecast-section {
        padding: 20px;
        margin-bottom: 25px;
    }

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

    .forecast-table {
        font-size: 0.85em;
    }

    .forecast-table th,
    .forecast-table td {
        padding: 10px 8px;
    }

    .chart-container {
        height: 250px;
        padding: 15px;
    }

    .current-weather h2,
    .forecast-section h2 {
        font-size: 1.5em;
    }

    header p {
        font-size: 0.9em;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--secondary), var(--primary));
}

/* Accessibility Enhancements */
.theme-toggle {
    margin-top: 20px;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    background: white;
    color: #333;
}

body.dark-mode {
    background: linear-gradient(135deg, #1e1e2f 0%, #12121c 100%);
    color: #e2e8f0;
}

body.dark-mode .search-box,
body.dark-mode .current-weather,
body.dark-mode .forecast-section {
    background: #1f2937;
    color: #e2e8f0;
}

body.dark-mode .weather-item {
    background: #2d3748;
}
