/* ===== CSS VARIABLES FOR THEMES ===== */
:root {
  /* Default dark theme */
  --bodyGradientStart: #0a0e27;
  --bodyGradientEnd: #1a1d3a;
  --cardBackground: rgba(255, 255, 255, 0.05);
  --cardBorder: rgba(255, 255, 255, 0.1);
  --textPrimary: #ffffff;
  --textSecondary: #94a3b8;
  --accentPrimary: #00f0ff;
  --accentSecondary: #8b5cf6;
  --glowColor: rgba(0, 240, 255, 0.2);
  --shadowColor: rgba(0, 0, 0, 0.4);
  --errorColor: #ef4444;
  --inputBackground: rgba(255, 255, 255, 0.08);
  --inputBorder: rgba(255, 255, 255, 0.15);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bodyGradientStart) 0%, var(--bodyGradientEnd) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--textPrimary);
    overflow: hidden;
    transition: background 0.5s ease;
}

/* ===== BACKGROUND EFFECTS ===== */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--glowColor) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* ===== WEATHER CARD ===== */
.weather-card {
    position: relative;
    width: 400px;
    padding: 40px 30px;
    background: var(--cardBackground);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    border: 1px solid var(--cardBorder);
    box-shadow: 
        0 8px 32px var(--shadowColor),
        0 0 80px var(--glowColor);
    animation: fadeInUp 0.8s ease-out;
    transition: all 0.5s ease;
    z-index: 1;
}

.weather-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 30px;
    padding: 2px;
    background: linear-gradient(135deg, var(--accentPrimary), var(--accentSecondary));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    animation: neonPulse 3s ease-in-out infinite;
    pointer-events: none;
}

/* ===== HEADER ===== */
.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.city-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--textPrimary);
    text-shadow: 0 0 20px var(--glowColor);
    transition: color 0.3s ease;
}

/* ===== CITY INPUT ===== */
.city-input-container {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
}

.city-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.city-input {
    width: 100%;
    background: var(--inputBackground);
    border: 1px solid var(--inputBorder);
    border-radius: 12px;
    padding: 10px 45px 10px 15px;
    color: var(--textPrimary);
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.city-input:focus {
    border-color: var(--accentPrimary);
    box-shadow: 0 0 15px var(--glowColor);
}

.city-input::placeholder {
    color: var(--textSecondary);
    opacity: 0.6;
}

.help-button {
    position: absolute;
    right: 10px;
    background: var(--cardBackground);
    border: 1px solid var(--cardBorder);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    font-size: 14px;
    font-weight: bold;
    color: var(--accentPrimary);
    transition: all 0.3s ease;
    z-index: 2;
}

.help-button:hover {
    background: var(--glowColor);
    border-color: var(--accentPrimary);
    transform: scale(1.1);
}

.help-tooltip {
    position: absolute;
    bottom: 45px;
    left: 0;
    right: 0;
    background: var(--cardBackground);
    backdrop-filter: blur(20px);
    border: 1px solid var(--cardBorder);
    border-radius: 12px;
    padding: 12px 15px;
    font-size: 14px;
    color: var(--textPrimary);
    box-shadow: 0 4px 20px var(--shadowColor);
    animation: tooltipFadeIn 0.3s ease-out;
    z-index: 100;
    text-align: center;
}

.help-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--cardBorder);
}

.search-button {
    background: linear-gradient(135deg, var(--accentPrimary), var(--accentSecondary));
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    color: var(--textPrimary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--glowColor);
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--glowColor);
}

.search-button:active {
    transform: translateY(0);
}

.search-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== CONTROLS (THEME + LANGUAGE) ===== */
.controls {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
    z-index: 10;
}

.theme-button {
    background: var(--cardBackground);
    border: 1px solid var(--cardBorder);
    border-radius: 12px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 11;
}

.theme-button:hover {
    background: var(--glowColor);
    box-shadow: 0 0 20px var(--glowColor);
    transform: scale(1.05);
}

.theme-button:active {
    transform: scale(0.95);
}

/* ===== LANGUAGE SELECTOR ===== */
.language-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.lang-button {
    background: var(--cardBackground);
    border: 1px solid var(--cardBorder);
    border-radius: 12px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
}

.lang-button:hover {
    background: var(--glowColor);
    box-shadow: 0 0 20px var(--glowColor);
    transform: scale(1.05);
}

.lang-button:active {
    transform: scale(0.95);
}

.lang-button.active {
    background: var(--glowColor);
    border-color: var(--accentPrimary);
    box-shadow: 0 0 15px var(--glowColor);
}

/* ===== MAIN CONTENT ===== */
.weather-main {
    text-align: center;
    margin-bottom: 30px;
}

.weather-icon {
    font-size: 120px;
    margin-bottom: 20px;
    animation: iconFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 0 30px var(--glowColor));
}

.temperature {
    font-size: 72px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accentPrimary) 0%, var(--accentSecondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    animation: fadeIn 0.5s ease-out;
}

.weather-description {
    font-size: 20px;
    color: var(--textSecondary);
    text-transform: capitalize;
    font-weight: 300;
    transition: color 0.3s ease;
}

/* ===== FOOTER ===== */
.weather-footer {
    display: flex;
    justify-content: space-around;
    padding-top: 20px;
    border-top: 1px solid var(--cardBorder);
}

.weather-detail {
    text-align: center;
}

.detail-icon {
    font-size: 24px;
    margin-bottom: 5px;
    opacity: 0.7;
}

.detail-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--accentPrimary);
    transition: color 0.3s ease;
}

.detail-label {
    font-size: 12px;
    color: var(--textSecondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

/* ===== LOADING STATE ===== */
.loading {
    text-align: center;
    color: var(--textSecondary);
    font-size: 18px;
}

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

/* ===== ERROR STATE ===== */
.error {
    text-align: center;
    color: var(--errorColor);
    font-size: 16px;
    padding: 20px;
    line-height: 1.6;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.error-message {
    margin-bottom: 15px;
}

.retry-button {
    background: linear-gradient(135deg, var(--accentPrimary), var(--accentSecondary));
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    color: var(--textPrimary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.retry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--glowColor);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.1) rotate(180deg);
        opacity: 0.5;
    }
}

@keyframes neonPulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.8;
    }
}

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

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

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

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .weather-card {
        width: 90%;
        padding: 30px 20px;
    }
    
    .city-name {
        font-size: 20px;
    }
    
    .weather-icon {
        font-size: 80px;
    }
    
    .temperature {
        font-size: 56px;
    }
    
    .weather-description {
        font-size: 16px;
    }
    
    .theme-button,
    .lang-button {
        font-size: 20px;
        padding: 6px 10px;
        min-width: 42px;
    }
    
    .language-selector {
        gap: 6px;
    }
    
    .city-input-container {
        flex-direction: column;
    }
    
    .city-input-wrapper {
        width: 100%;
    }
    
    .search-button {
        width: 100%;
    }
    
    .help-tooltip {
        font-size: 13px;
        padding: 10px 12px;
    }
}
