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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1a2980, #26d0ce);
    color: #333;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 25px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #2c3e50, #4a6491);
    color: white;
    padding: 25px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    border-radius: 0 0 20px 20px;
}

.header-content h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-content h1 i {
    color: #f39c12;
    animation: float 3s ease-in-out infinite;
}

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

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 25px;
}

.unit-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 5px;
}

.unit-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: white;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.unit-btn.active {
    background: #3498db;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.unit-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

.api-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e74c3c;
    animation: pulse 2s infinite;
}

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

.status-dot.connected {
    background: #2ecc71;
}

/* Main Content */
.main-content {
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Search Section */
.search-section {
    background: #f8f9fa;
    border-radius: 20px;
    padding: 25px;
    border: 2px solid #e9ecef;
}

.search-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 15px;
    padding: 5px;
    border: 2px solid #dee2e6;
    transition: all 0.3s;
}

.search-box:focus-within {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.search-box i {
    font-size: 1.2rem;
    color: #6c757d;
    margin: 0 15px;
}

.search-box input {
    flex: 1;
    border: none;
    padding: 18px 10px;
    font-size: 1.1rem;
    background: transparent;
    outline: none;
    font-family: inherit;
}

.search-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 18px 30px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    white-space: nowrap;
}

.search-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3);
}

.search-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.location-btn, .popular-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.location-btn {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
}

.popular-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
}

.location-btn:hover, .popular-btn:hover {
    transform: translateY(-3px);
    opacity: 0.9;
}

/* Search History */
.search-history {
    margin-top: 25px;
}

.search-history h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.history-item {
    background: white;
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-item:hover {
    background: #e3f2fd;
    border-color: #3498db;
    transform: translateY(-3px);
}

.history-item i {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Current Weather */
.current-weather .weather-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    transition: all 0.5s ease;
}

.weather-card.loading {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.weather-header h2 {
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-time {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.weather-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 40px;
    margin-bottom: 25px;
}

.temperature-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.temp-display {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
}

.temp-unit {
    font-size: 2rem;
    opacity: 0.8;
}

.weather-condition {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.5rem;
}

.weather-condition i {
    font-size: 2.5rem;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    flex: 1;
    max-width: 400px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.detail-item i {
    font-size: 1.8rem;
    opacity: 0.9;
}

.detail-item .label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.detail-item .value {
    font-size: 1.4rem;
    font-weight: 600;
}

.weather-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.sun-times {
    display: flex;
    gap: 30px;
}

.sun-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sun-item i {
    font-size: 1.3rem;
    color: #f39c12;
}

.update-time {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Forecast Section */
.forecast-section h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.forecast-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
    cursor: pointer;
}

.forecast-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
}

.forecast-date {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.forecast-icon {
    font-size: 2.5rem;
    margin: 15px 0;
    color: #3498db;
}

.forecast-temp {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.temp-high, .temp-low {
    font-weight: 600;
}

.temp-high {
    color: #e74c3c;
}

.temp-low {
    color: #3498db;
}

.forecast-desc {
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 10px;
}

.forecast-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 1.1rem;
}

.forecast-placeholder i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #bdc3c7;
}

/* Additional Info */
.additional-info .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.info-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
}

.info-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.info-card h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
}

/* Air Quality */
.aqi-display {
    text-align: center;
    margin-bottom: 20px;
}

.aqi-value {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.aqi-label {
    font-size: 1.1rem;
    font-weight: 500;
}

.aqi-scale {
    display: flex;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.scale-item {
    flex: 1;
    text-align: center;
    padding: 8px 5px;
    font-size: 0.8rem;
    font-weight: 500;
}

.good { background: #2ecc71; color: white; }
.moderate { background: #f1c40f; color: #2c3e50; }
.poor { background: #e74c3c; color: white; }

/* UV Index */
.uv-display {
    text-align: center;
    margin-bottom: 20px;
}

.uv-value {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.uv-label {
    font-size: 1.1rem;
    font-weight: 500;
}

.uv-scale {
    display: flex;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.uv-scale div {
    flex: 1;
    text-align: center;
    padding: 8px 5px;
    font-size: 0.8rem;
    font-weight: 500;
}

.scale-low { background: #2ecc71; color: white; }
.scale-moderate { background: #f1c40f; color: #2c3e50; }
.scale-high { background: #e74c3c; color: white; }

/* Visibility & Precipitation */
.vis-display, .precip-display {
    display: flex;
    align-items: center;
    gap: 20px;
}

.vis-display i, .precip-display i {
    font-size: 2.5rem;
    color: #3498db;
}

.vis-value, .precip-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.vis-label, .precip-label {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Popular Cities */
.popular-cities h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.city-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
}

.city-card:hover {
    border-color: #3498db;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.15);
}

.city-name {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.city-temp {
    font-size: 2.2rem;
    font-weight: 700;
    color: #3498db;
    margin-bottom: 8px;
}

.city-weather {
    color: #6c757d;
    font-size: 0.95rem;
}

/* Footer */
.app-footer {
    background: #2c3e50;
    color: white;
    padding: 40px;
    border-radius: 20px 20px 0 0;
    margin-top: 40px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h4 {
    color: #3498db;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.footer-section p {
    color: #bdc3c7;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #95a5a6;
    font-size: 0.9rem;
}

.api-note {
    font-size: 0.8rem;
    color: #f39c12;
    margin-top: 5px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    position: relative;
    animation: modalSlide 0.3s ease;
}

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

.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 2rem;
}

.modal-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-content ol {
    margin-left: 20px;
    margin-bottom: 25px;
}

.modal-content li {
    margin-bottom: 10px;
}

.api-input {
    display: flex;
    gap: 15px;
    margin: 25px 0;
}

.api-input input {
    flex: 1;
    padding: 15px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
}

.api-input input:focus {
    outline: none;
    border-color: #3498db;
}

#saveApiKey {
    background: #3498db;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

#saveApiKey:hover {
    background: #2980b9;
}

.demo-note {
    font-size: 0.9rem;
    color: #7f8c8d;
    font-style: italic;
    margin-top: 20px;
}

.demo-btn {
    background: #2ecc71;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 15px;
    width: 100%;
}

.demo-btn:hover {
    background: #27ae60;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    justify-content: center;
    align-items: center;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content i {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: spin 1s linear infinite;
}

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

.loading-content p {
    font-size: 1.3rem;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .app-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        padding: 20px;
    }
    
    .header-content h1 {
        font-size: 2rem;
        justify-content: center;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .weather-main {
        flex-direction: column;
        text-align: center;
    }
    
    .weather-details {
        grid-template-columns: 1fr;
    }
    
    .temp-display {
        font-size: 4rem;
    }
    
    .forecast-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .search-box {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .search-box input {
        width: 100%;
        text-align: center;
    }
    
    .search-btn {
        width: 100%;
        justify-content: center;
    }
    
    .api-input {
        flex-direction: column;
    }
}
