/**
 * Weather Dashboard - Styles.css
 * A responsive weather dashboard with real-time data, forecasts, and interactive charts.
 * 
 * Developer: Kabelo Kgosana
 * Location: Pretoria, South Africa
 */

/* ================================
   CSS Variables & Root Styles
================================ */
:root {
    /* Primary Colors */
    --primary-color: #4a90e2;
    --primary-dark: #357abd;
    --primary-light: #7ab3f0;
    
    /* Secondary Colors */
    --secondary-color: #f39c12;
    --secondary-dark: #e67e22;
    --secondary-light: #f5b041;
    
    /* Background Colors */
    --bg-primary: #0f1419;
    --bg-secondary: #1a2332;
    --bg-card: #242d3d;
    --bg-card-hover: #2d3748;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    
    /* Accent Colors */
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --error-color: #fc8181;
    --info-color: #63b3ed;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #4a90e2 0%, #7b68ee 100%);
    --gradient-sunny: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    --gradient-rainy: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-cloudy: linear-gradient(135deg, #757f9a 0%, #d7dde8 100%);
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
}

/* ================================
   Reset & Base Styles
================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(74, 144, 226, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(123, 104, 238, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(243, 156, 18, 0.05) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ================================
   Header Styles
================================ */
.header {
    background: var(--bg-secondary);
    padding: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo i {
    font-size: 2rem;
    color: var(--secondary-color);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.developer-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.developer-info strong {
    color: var(--primary-light);
}

/* ================================
   Search Section
================================ */
.search-section {
    padding: var(--spacing-xl) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-sm);
    box-shadow: var(--shadow-lg);
    transition: var(--transition-normal);
}

.search-box:focus-within {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.search-box i {
    padding: 0 var(--spacing-md);
    color: var(--text-muted);
    font-size: 1.25rem;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    padding: var(--spacing-sm) 0;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.search-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-sm);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    z-index: 50;
    display: none;
}

.search-suggestions.active {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.suggestion-item {
    padding: var(--spacing-md);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.suggestion-item:hover {
    background: var(--bg-card-hover);
}

.current-location {
    display: flex;
    gap: var(--spacing-sm);
}

.location-btn {
    background: var(--bg-card);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-lg);
    color: var(--primary-light);
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.location-btn:hover {
    background: var(--primary-color);
    color: var(--text-primary);
}

/* ================================
   Error Display
================================ */
.error-display {
    background: rgba(252, 129, 129, 0.1);
    border: 1px solid var(--error-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-display i {
    color: var(--error-color);
    font-size: 1.25rem;
}

.error-display span {
    flex: 1;
    color: var(--error-color);
}

.close-error {
    background: transparent;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    padding: var(--spacing-xs);
    transition: var(--transition-fast);
}

.close-error:hover {
    transform: scale(1.2);
}

.hidden {
    display: none !important;
}

/* ================================
   Loading Spinner
================================ */
.loading-spinner {
    text-align: center;
    padding: var(--spacing-2xl);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-card);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

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

.loading-spinner p {
    color: var(--text-secondary);
}

/* ================================
   Weather Dashboard
================================ */
.weather-dashboard {
    display: grid;
    gap: var(--spacing-xl);
    animation: fadeIn 0.5s ease;
}

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

/* ================================
   Current Weather Section
================================ */
.current-weather {
    animation: slideUp 0.5s ease;
}

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

.current-weather-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.current-weather-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(74, 144, 226, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.weather-main {
    display: flex;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    position: relative;
    z-index: 1;
}

.weather-icon img {
    width: 150px;
    height: 150px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.temperature-display h2 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.temperature-display p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: var(--spacing-md);
}

.temperature {
    display: flex;
    align-items: flex-start;
}

.temperature span:first-child {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.unit {
    font-size: 2rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-sm);
}

.weather-description {
    text-transform: capitalize;
    font-size: 1.25rem !important;
    color: var(--primary-light) !important;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
    position: relative;
    z-index: 1;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
}

.detail-item:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.detail-item i {
    font-size: 1.5rem;
    color: var(--primary-light);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(74, 144, 226, 0.1);
    border-radius: var(--radius-sm);
}

.detail-content {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ================================
   Section Headers
================================ */
.section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.section-header i {
    font-size: 1.5rem;
    color: var(--secondary-color);
    background: rgba(243, 156, 18, 0.1);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
}

.section-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ================================
   Forecast Section
================================ */
.forecast-section {
    animation: slideUp 0.5s ease 0.1s both;
}

.forecast-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
}

.forecast-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.forecast-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.forecast-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.forecast-date {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.forecast-icon {
    margin: var(--spacing-md) 0;
}

.forecast-icon img {
    width: 60px;
    height: 60px;
    transition: var(--transition-normal);
}

.forecast-card:hover .forecast-icon img {
    transform: scale(1.2);
}

.forecast-temp {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.forecast-temp span {
    font-size: 1rem;
    color: var(--text-muted);
}

.forecast-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.forecast-details {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--bg-secondary);
}

.forecast-detail {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.forecast-detail i {
    font-size: 0.875rem;
}

/* ================================
   Charts Section
================================ */
.charts-section {
    animation: slideUp 0.5s ease 0.2s both;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--spacing-lg);
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    transition: var(--transition-normal);
}

.chart-card:hover {
    box-shadow: var(--shadow-xl);
}

.chart-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

.chart-card canvas {
    max-height: 250px;
}

/* ================================
   Metrics Section
================================ */
.metrics-section {
    animation: slideUp 0.5s ease 0.3s both;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.metric-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: var(--transition-normal);
}

.metric-card:hover::after {
    transform: scaleX(1);
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.temperature-icon {
    background: rgba(243, 156, 18, 0.2);
    color: var(--secondary-color);
}

.cloud-icon {
    background: rgba(160, 174, 192, 0.2);
    color: var(--text-secondary);
}

.rain-icon {
    background: rgba(72, 187, 120, 0.2);
    color: var(--success-color);
}

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ================================
   Footer
================================ */
.footer {
    background: var(--bg-secondary);
    padding: var(--spacing-xl) 0;
    margin-top: var(--spacing-2xl);
    border-top: 1px solid var(--bg-card);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.footer-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-xs);
}

.footer-info strong {
    color: var(--primary-light);
}

.footer-links {
    display: flex;
    gap: var(--spacing-md);
}

.footer-links a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-normal);
    text-decoration: none;
}

.footer-links a:hover {
    background: var(--primary-color);
    color: var(--text-primary);
    transform: translateY(-3px);
}

/* ================================
   Age Modal
================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    max-width: 450px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.4s ease;
}

.modal-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.modal-header i {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: var(--spacing-md);
    display: block;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-body {
    text-align: center;
}

.modal-body p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

.age-input-container {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.age-input-container input {
    flex: 1;
    background: var(--bg-secondary);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition-normal);
}

.age-input-container input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.age-input-container input::placeholder {
    color: var(--text-muted);
}

.age-submit-btn {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.age-submit-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.skip-age-btn {
    background: transparent;
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-lg);
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    transition: var(--transition-normal);
}

.skip-age-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

/* Gender Selection */
.gender-selection {
    margin-bottom: var(--spacing-lg);
}

.gender-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
}

.gender-options {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

.gender-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
    min-width: 80px;
}

.gender-option:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.gender-option input {
    display: none;
}

.gender-option input:checked + .gender-icon {
    color: var(--primary-light);
    transform: scale(1.1);
}

.gender-option input:checked ~ span:last-child {
    color: var(--primary-light);
}

.gender-icon {
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: var(--transition-normal);
}

.gender-option span:last-child {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: var(--transition-normal);
}

/* ================================
   Outfit Section
================================ */
.outfit-section {
    background: var(--bg-secondary);
    padding: var(--spacing-xl) 0;
    margin-top: var(--spacing-xl);
    animation: slideUp 0.5s ease 0.4s both;
}

.outfit-section .section-header {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.edit-age-btn {
    background: var(--bg-card);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-md);
    color: var(--primary-light);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-left: auto;
}

.edit-age-btn:hover {
    background: var(--primary-color);
    color: var(--text-primary);
}

.outfit-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.outfit-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(26, 35, 50, 0.95) 0%, rgba(36, 45, 61, 0.9) 100%);
    z-index: 0;
}

.outfit-content > * {
    position: relative;
    z-index: 1;
}

.outfit-header {
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.outfit-header h4 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: var(--spacing-sm);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.outfit-tips {
    color: var(--text-secondary);
    font-size: 1rem;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(74, 144, 226, 0.15);
    border-radius: var(--radius-md);
    display: inline-block;
}

.outfit-age-note {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.outfit-age-note i {
    margin-right: var(--spacing-sm);
}

.outfit-age-note span {
    color: var(--primary-light);
    font-weight: 500;
}

.outfit-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.outfit-item {
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    transition: var(--transition-normal);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.outfit-item:hover {
    background: rgba(74, 144, 226, 0.2);
    transform: translateY(-3px);
    border-color: var(--primary-color);
}

.outfit-link {
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.95rem;
    transition: var(--transition-normal);
}

.outfit-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    flex-shrink: 0;
}

.outfit-item-name {
    flex: 1;
    font-weight: 500;
}

.outfit-link .fa-external-link-alt {
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: var(--transition-normal);
}

.outfit-link:hover {
    color: var(--primary-light);
}

.outfit-link:hover .outfit-icon {
    background: var(--primary-light);
}

.outfit-link:hover .fa-external-link-alt {
    transform: translate(3px, -3px);
    color: var(--primary-light);
}

/* ================================
   Responsive Design
================================ */

/* Tablet Styles */
@media screen and (max-width: 1024px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .weather-details {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet Portrait */
@media screen and (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .search-box {
        flex-wrap: wrap;
    }
    
    .search-box input {
        flex: 1 1 100%;
        min-width: 200px;
    }
    
    .search-btn {
        width: 100%;
        justify-content: center;
    }
    
    .weather-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .temperature-display h2 {
        font-size: 2rem;
    }
    
    .temperature span:first-child {
        font-size: 4rem;
    }
    
    .weather-details {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .forecast-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .chart-card canvas {
        max-height: 200px;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* Mobile Styles */
@media screen and (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .logo i {
        font-size: 1.5rem;
    }
    
    .logo h1 {
        font-size: 1rem;
    }
    
    .developer-info {
        display: none;
    }
    
    .search-section {
        padding: var(--spacing-lg) 0;
    }
    
    .search-box input {
        font-size: 0.875rem;
    }
    
    .current-weather-card {
        padding: var(--spacing-lg);
    }
    
    .weather-icon img {
        width: 100px;
        height: 100px;
    }
    
    .temperature-display h2 {
        font-size: 1.75rem;
    }
    
    .temperature span:first-child {
        font-size: 3rem;
    }
    
    .weather-details {
        grid-template-columns: 1fr;
    }
    
    .detail-item {
        padding: var(--spacing-sm);
    }
    
    .detail-item i {
        width: 35px;
        height: 35px;
        font-size: 1.25rem;
    }
    
    .section-header h3 {
        font-size: 1.25rem;
    }
    
    .forecast-container {
        grid-template-columns: 1fr;
    }
    
    .forecast-card {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        text-align: left;
    }
    
    .forecast-date,
    .forecast-icon,
    .forecast-temp,
    .forecast-description {
        margin: 0;
    }
    
    .forecast-details {
        width: 100%;
        justify-content: flex-start;
        border-top: none;
        padding-top: 0;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-card {
        padding: var(--spacing-md);
    }
    
    .metric-value {
        font-size: 1.25rem;
    }
    
    .chart-card {
        padding: var(--spacing-md);
    }
    
    .chart-card h4 {
        font-size: 1rem;
    }
    
    .footer-info p {
        font-size: 0.75rem;
    }
    
    /* Modal Responsive */
    .modal-content {
        padding: var(--spacing-lg);
        width: 95%;
    }
    
    .modal-header i {
        font-size: 2.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .age-input-container {
        flex-direction: column;
    }
    
    .age-input-container input {
        width: 100%;
    }
    
    .age-submit-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Outfit Responsive */
    .outfit-section .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .edit-age-btn {
        margin-left: 0;
        margin-top: var(--spacing-sm);
    }
    
    .outfit-items {
        grid-template-columns: 1fr;
    }
}

/* Large Desktop */
@media screen and (min-width: 1400px) {
    .container {
        max-width: 1600px;
    }
    
    .weather-details {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .forecast-container {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ================================
   Utility Classes
================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }

/* ================================
   Animations
================================ */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.slide-up {
    animation: slideUp 0.5s ease forwards;
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ================================
   Responsive Design - Complete Mobile Optimization
   with Chart Scrolling Fix
================================ */

/* Base mobile-first adjustments */
:root {
    /* Fluid typography using clamp */
    --font-size-base: clamp(14px, 2vw, 16px);
    --font-size-lg: clamp(18px, 3vw, 24px);
    --font-size-xl: clamp(24px, 4vw, 32px);
    --font-size-xxl: clamp(32px, 5vw, 48px);
    
    /* Fluid spacing */
    --space-unit: clamp(4px, 1vw, 8px);
    --space-sm: calc(var(--space-unit) * 2);
    --space-md: calc(var(--space-unit) * 3);
    --space-lg: calc(var(--space-unit) * 4);
    --space-xl: calc(var(--space-unit) * 6);
}

html {
    font-size: var(--font-size-base);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 100%;
    padding-left: max(env(safe-area-inset-left), var(--space-md));
    padding-right: max(env(safe-area-inset-right), var(--space-md));
    margin: 0 auto;
}

/* ================================
   Chart Container with Horizontal Scroll
================================ */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--spacing-lg);
    width: 100%;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    transition: var(--transition-normal);
    width: 100%;
    overflow: hidden;
}

.chart-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-secondary);
    padding-bottom: var(--spacing-sm);
}

/* Custom scrollbar styling */
.chart-wrapper::-webkit-scrollbar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.chart-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.chart-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

.chart-wrapper canvas {
    min-width: 350px;
    max-width: none;
    height: auto;
    display: block;
}

.chart-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.chart-card h4 i {
    color: var(--secondary-color);
}

/* Scroll hint indicator */
.scroll-hint {
    display: none;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: var(--spacing-xs);
    animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ================================
   iPhone SE / Small Phones (320px - 375px)
================================ */
@media screen and (max-width: 375px) {
    .header-content {
        padding: var(--space-sm) 0;
    }
    
    .logo {
        width: 100%;
        justify-content: center;
    }
    
    .logo i {
        font-size: 1.75rem;
    }
    
    .logo h1 {
        font-size: 1.1rem;
        white-space: nowrap;
    }
    
    .developer-info {
        display: none;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .search-box {
        flex-direction: column;
        gap: var(--space-sm);
        padding: var(--space-sm);
    }
    
    .search-box i {
        display: none;
    }
    
    .search-box input {
        width: 100%;
        padding: var(--space-md);
        font-size: 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .search-btn {
        width: 100%;
        padding: var(--space-md);
        justify-content: center;
    }
    
    .current-location {
        width: 100%;
    }
    
    .location-btn {
        width: 100%;
        justify-content: center;
        padding: var(--space-md);
    }
    
    .current-weather-card {
        padding: var(--space-lg) var(--space-md);
    }
    
    .weather-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--space-md);
    }
    
    .weather-icon img {
        width: 120px;
        height: 120px;
    }
    
    .temperature-display {
        width: 100%;
    }
    
    .temperature {
        justify-content: center;
    }
    
    .temperature span:first-child {
        font-size: 3.5rem;
    }
    
    .unit {
        font-size: 1.5rem;
    }
    
    .weather-description {
        font-size: 1.1rem !important;
    }
    
    .weather-details {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .detail-item {
        padding: var(--space-md);
    }
    
    .section-header {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
    
    .section-header h3 {
        font-size: 1.2rem;
    }
    
    /* Charts Section - Mobile Optimized */
    .charts-section {
        width: 100%;
        overflow: visible;
    }
    
    .charts-container {
        display: flex;
        flex-direction: column;
        gap: var(--space-lg);
        width: 100%;
    }
    
    .chart-card {
        padding: var(--space-md);
        width: 100%;
        border-radius: var(--radius-lg);
    }
    
    .chart-card h4 {
        font-size: 1rem;
        margin-bottom: var(--space-md);
    }
    
    .chart-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        padding-bottom: var(--space-sm);
    }
    
    .chart-wrapper canvas {
        min-width: 300px;
        height: 180px;
    }
    
    .scroll-hint {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-xs);
    }
    
    .scroll-hint i {
        font-size: 0.875rem;
    }
    
    .forecast-card {
        padding: var(--space-md);
    }
    
    .forecast-icon img {
        width: 50px;
        height: 50px;
    }
    
    .forecast-temp {
        font-size: 1.2rem;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-card {
        padding: var(--space-md);
    }
    
    .outfit-items {
        grid-template-columns: 1fr;
    }
    
    .outfit-item {
        padding: var(--space-sm);
    }
    
    .modal-content {
        width: 95%;
        padding: var(--space-lg);
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .age-input-container {
        flex-direction: column;
    }
    
    .age-submit-btn {
        width: 100%;
        justify-content: center;
    }
    
    .gender-options {
        flex-direction: column;
        align-items: stretch;
    }
    
    .gender-option {
        flex-direction: row;
        justify-content: center;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: var(--space-md);
    }
    
    .footer-links {
        justify-content: center;
    }
}

/* ================================
   iPhone 6/7/8 / Standard Phones (376px - 480px)
================================ */
@media screen and (min-width: 376px) and (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .developer-info {
        display: none;
    }
    
    .search-box {
        flex-wrap: nowrap;
    }
    
    .search-box i {
        font-size: 1rem;
    }
    
    .search-box input {
        font-size: 0.9rem;
        min-width: 0;
    }
    
    .weather-main {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .weather-icon {
        flex: 0 0 100px;
    }
    
    .weather-icon img {
        width: 100px;
        height: 100px;
    }
    
    .temperature-display {
        flex: 1;
        min-width: 200px;
    }
    
    .weather-details {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .forecast-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .forecast-card {
        padding: var(--space-sm);
    }
    
    .forecast-icon img {
        width: 40px;
        height: 40px;
    }
    
    .forecast-temp {
        font-size: 1.1rem;
    }
    
    /* Charts Section - Medium Phones */
    .charts-container {
        display: flex;
        flex-direction: column;
        gap: var(--space-lg);
    }
    
    .chart-card {
        padding: var(--space-lg);
    }
    
    .chart-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chart-wrapper canvas {
        min-width: 350px;
        height: 200px;
    }
    
    .scroll-hint {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-xs);
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .outfit-items {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gender-options {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* ================================
   iPhone Plus / Max / Large Phones (481px - 640px)
================================ */
@media screen and (min-width: 481px) and (max-width: 640px) {
    .header-content {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .developer-info {
        display: block;
        font-size: 0.8rem;
    }
    
    .search-section {
        padding: var(--space-lg) 0;
    }
    
    .weather-details {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .forecast-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .forecast-card {
        padding: var(--space-md);
    }
    
    /* Charts Section - Large Phones */
    .charts-container {
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .chart-card {
        padding: var(--space-lg);
    }
    
    .chart-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chart-wrapper canvas {
        min-width: 400px;
        height: 220px;
    }
    
    .scroll-hint {
        display: none; /* Hide hint on larger screens */
    }
    
    .metrics-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .outfit-items {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ================================
   Small Tablets / iPad Mini (641px - 768px)
================================ */
@media screen and (min-width: 641px) and (max-width: 768px) {
    .container {
        max-width: 720px;
        margin: 0 auto;
    }
    
    .header-content {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .developer-info {
        display: block;
    }
    
    .search-section {
        padding: var(--space-xl) 0;
    }
    
    .search-box {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .current-weather-card {
        padding: var(--space-xl);
    }
    
    .weather-main {
        flex-direction: row;
        gap: var(--space-xl);
    }
    
    .weather-icon img {
        width: 130px;
        height: 130px;
    }
    
    .temperature span:first-child {
        font-size: 4rem;
    }
    
    .weather-details {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .forecast-container {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .forecast-card {
        padding: var(--space-md);
    }
    
    /* Charts Section - Small Tablets */
    .charts-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }
    
    .chart-card {
        padding: var(--space-lg);
    }
    
    .chart-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chart-wrapper canvas {
        min-width: 300px;
        height: 200px;
    }
    
    .chart-wrapper::-webkit-scrollbar {
        height: 4px;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .outfit-items {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .outfit-section .section-header {
        flex-direction: row;
        align-items: center;
    }
    
    .modal-content {
        width: 80%;
        max-width: 500px;
    }
    
    .gender-options {
        flex-direction: row;
        justify-content: center;
    }
}

/* ================================
   iPad / Tablets Portrait (769px - 1024px)
================================ */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 960px;
        padding: 0 var(--space-lg);
    }
    
    .header-content {
        padding: var(--space-md) 0;
    }
    
    .logo h1 {
        font-size: 1.4rem;
    }
    
    .search-box {
        max-width: 500px;
    }
    
    .current-weather-card {
        padding: var(--space-xl);
    }
    
    .weather-main {
        gap: var(--space-xl);
    }
    
    .weather-icon img {
        width: 140px;
        height: 140px;
    }
    
    .temperature span:first-child {
        font-size: 4.5rem;
    }
    
    .weather-details {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .forecast-container {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .forecast-card {
        padding: var(--space-lg);
    }
    
    /* Charts Section - Tablets */
    .charts-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xl);
    }
    
    .chart-card {
        padding: var(--space-xl);
    }
    
    .chart-wrapper {
        width: 100%;
        overflow-x: hidden; /* No scroll needed on tablets */
    }
    
    .chart-wrapper canvas {
        min-width: 100%;
        height: 250px;
    }
    
    .scroll-hint {
        display: none;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .outfit-items {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .outfit-content {
        padding: var(--space-xl);
    }
    
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* ================================
   iPad Pro / Large Tablets Landscape (1025px - 1366px)
================================ */
@media screen and (min-width: 1025px) and (max-width: 1366px) {
    .container {
        max-width: 1200px;
    }
    
    .weather-details {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .forecast-container {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .charts-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-wrapper canvas {
        height: 280px;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .outfit-items {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ================================
   Landscape Mode Optimization
================================ */
@media screen and (orientation: landscape) and (max-height: 600px) {
    .header {
        position: relative;
    }
    
    .search-section {
        padding: var(--space-md) 0;
    }
    
    .current-weather-card {
        padding: var(--space-lg);
    }
    
    .weather-icon img {
        width: 80px;
        height: 80px;
    }
    
    .temperature span:first-child {
        font-size: 3rem;
    }
    
    .weather-details {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .forecast-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .forecast-card {
        padding: var(--space-sm);
    }
    
    .forecast-icon img {
        width: 40px;
        height: 40px;
    }
    
    /* Charts in Landscape */
    .charts-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-card {
        padding: var(--space-md);
    }
    
    .chart-wrapper canvas {
        min-width: 250px;
        height: 150px;
    }
    
    .modal-content {
        max-height: 85vh;
        overflow-y: auto;
    }
}

/* ================================
   Notch / Dynamic Island Support
================================ */
@supports (padding: max(0px)) {
    .header {
        padding-top: max(env(safe-area-inset-top), var(--space-sm));
        padding-left: max(env(safe-area-inset-left), var(--space-sm));
        padding-right: max(env(safe-area-inset-right), var(--space-sm));
    }
    
    .footer {
        padding-bottom: max(env(safe-area-inset-bottom), var(--space-md));
    }
    
    .modal {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* Adjust chart containers for safe area */
    .chart-wrapper {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ================================
   Touch-friendly Improvements
================================ */
@media (hover: none) and (pointer: coarse) {
    .search-btn,
    .location-btn,
    .suggestion-item,
    .forecast-card,
    .detail-item,
    .metric-card,
    .outfit-item {
        cursor: default;
        -webkit-tap-highlight-color: rgba(74, 144, 226, 0.3);
    }
    
    .search-btn:active,
    .location-btn:active,
    .suggestion-item:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    
    input, 
    button {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Improve scroll experience on touch devices */
    .chart-wrapper {
        cursor: grab;
    }
    
    .chart-wrapper:active {
        cursor: grabbing;
    }
}

/* ================================
   Print Styles
================================ */
@media print {
    .header,
    .search-section,
    .footer,
    .modal,
    .outfit-section {
        display: none;
    }
    
    .current-weather-card,
    .forecast-card,
    .chart-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .chart-wrapper {
        overflow: visible;
    }
    
    .chart-wrapper canvas {
        min-width: 100%;
    }
}

/* ================================
   High-DPI / Retina Displays
================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .weather-icon img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .chart-wrapper canvas {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ================================
   Accessibility - Reduced Motion
================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .scroll-hint {
        animation: none !important;
    }
}

/* ================================
   Dark Mode Support
================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f1419;
        --bg-secondary: #1a2332;
        --bg-card: #242d3d;
        --text-primary: #ffffff;
    }
    
    .chart-wrapper::-webkit-scrollbar {
        background: var(--bg-secondary);
    }
    
    .chart-wrapper::-webkit-scrollbar-thumb {
        background: var(--primary-color);
    }
}

/* ================================
   Container Queries for Components
================================ */
@container (max-width: 400px) {
    .weather-details {
        grid-template-columns: 1fr;
    }
    
    .forecast-container {
        grid-template-columns: 1fr;
    }
    
    .chart-wrapper canvas {
        min-width: 280px;
    }
}

/* Apply container queries to main elements */
.current-weather-card,
.forecast-section,
.charts-section {
    container-type: inline-size;
}

/* ================================
   Chart Visibility Fix for All Devices
================================ */
/* Ensure charts are always visible with scroll on small devices */
@media screen and (max-width: 640px) {
    .charts-section {
        display: block !important;
        visibility: visible !important;
    }
    
    .chart-card {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .chart-wrapper {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .chart-wrapper canvas {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Fix for specific iPhone models */
/* iPhone 12/13/14 Mini */
@media screen and (min-width: 360px) and (max-width: 375px) and (min-height: 780px) {
    .chart-wrapper canvas {
        min-width: 320px;
    }
}

/* iPhone 12/13/14 Pro */
@media screen and (min-width: 390px) and (max-width: 390px) and (min-height: 844px) {
    .chart-wrapper canvas {
        min-width: 340px;
    }
}

/* iPhone 15 Pro */
@media screen and (min-width: 393px) and (max-width: 393px) and (min-height: 852px) {
    .chart-wrapper canvas {
        min-width: 340px;
    }
}

/* iPhone 15 Pro Max */
@media screen and (min-width: 430px) and (max-width: 430px) and (min-height: 932px) {
    .chart-wrapper canvas {
        min-width: 380px;
    }
}