/* ========================================
   VARIÁVEIS E CONFIGURAÇÕES GLOBAIS
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #5068d6 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    position: relative;
    overflow: hidden;
    transition: background 0.8s ease;
    margin: 0;
    width: 100%;
}

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

/* =======================================
   CONTAINER PRINCIPAL - GLASSMORPHISM
======================================== */
.weather-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    max-height: 95vh;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    overflow-y: auto;
    animation: slideIn 0.6s ease-out;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE e Edge */
}

/* Esconde scrollbar para Chrome, Safari e Opera */
.weather-container::-webkit-scrollbar {
    display: none;
}

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

/* ========================================
   HEADER - BARRA DE PESQUISA
======================================== */
.search-header {
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

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

.search-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    min-width: 0;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.search-btn {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.search-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

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

/* ========================================
   ÁREA DE RESULTADOS
======================================== */
.weather-content {
    padding: 25px 20px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Estado inicial - loading */
.loading-state {
    text-align: center;
    opacity: 0.7;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* ========================================
   DISPLAY DE TEMPERATURA PRINCIPAL
======================================== */
.main-weather {
    text-align: center;
    animation: fadeIn 0.5s ease-out;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.city-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    word-wrap: break-word;
}

.date-time {
    font-size: 12px;
    opacity: 0.85;
    margin-bottom: 25px;
    word-wrap: break-word;
}

/* Container para temperatura e ícone lado a lado */
.temp-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.weather-icon-main {
    font-size: 80px;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.2));
    animation: bounce 2s ease-in-out infinite;
}

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

.temperature-main {
    font-size: 54px;
    font-weight: 300;
    line-height: 1;
    text-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
}

.weather-description {
    font-size: 18px;
    text-transform: capitalize;
    opacity: 0.9;
    margin-bottom: 8px;
    margin-top: 15px;
}

.feels-like {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 20px;
}

/* ========================================
   MÉTRICAS SECUNDÁRIAS (Umidade, Vento, etc)
======================================== */
.weather-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.detail-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 8px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.detail-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
}

.detail-icon {
    font-size: 20px;
    margin-bottom: 6px;
    opacity: 0.8;
}

.detail-label {
    font-size: 10px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 15px;
    font-weight: 600;
}

/* ========================================
   PREVISÃO DOS PRÓXIMOS DIAS
======================================== */
.forecast-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
}

.forecast-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
    opacity: 0.9;
    text-align: center;
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.forecast-day {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 6px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.forecast-day:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-5px);
}

.forecast-day-name {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
    opacity: 0.9;
    text-transform: capitalize;
}

.forecast-icon {
    font-size: 28px;
    margin: 8px 0;
}

.forecast-temp {
    font-size: 14px;
    font-weight: 600;
}

/* ========================================
   ESTADOS DE ERRO
======================================== */
.error-state {
    text-align: center;
    animation: shake 0.5s ease-out;
}

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

.error-icon {
    font-size: 50px;
    margin-bottom: 15px;
    opacity: 0.8;
}

.error-message {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}

.error-hint {
    font-size: 13px;
    opacity: 0.7;
}

/* ========================================
   RESPONSIVIDADE
======================================== */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .weather-container {
        max-width: 100%;
        border-radius: 20px;
    }

    .search-header {
        padding: 15px;
    }

    .search-form {
        gap: 8px;
    }

    .search-input {
        padding: 10px 14px;
        font-size: 13px;
    }

    .search-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .search-btn span {
        display: none;
    }

    .weather-content {
        padding: 25px 15px;
        min-height: 300px;
    }

    .city-name {
        font-size: 20px;
    }

    .date-time {
        font-size: 11px;
    }

    .temperature-main {
        font-size: 50px;
    }

    .weather-icon-main {
        font-size: 75px;
    }

    .weather-description {
        font-size: 16px;
    }

    .weather-details {
        gap: 8px;
    }

    .detail-item {
        padding: 10px 6px;
    }

    .detail-icon {
        font-size: 18px;
    }

    .detail-label {
        font-size: 9px;
    }

    .detail-value {
        font-size: 13px;
    }

    .forecast-grid {
        gap: 6px;
    }

    .forecast-day {
        padding: 10px 4px;
    }

    .forecast-day-name {
        font-size: 10px;
    }

    .forecast-icon {
        font-size: 24px;
    }

    .forecast-temp {
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .city-name {
        font-size: 18px;
    }

    .temperature-main {
        font-size: 45px;
    }

    .weather-icon-main {
        font-size: 65px;
    }
}