:root {
    --brightness: 1;
    --primary-color: #8ab4f8;
}

body, html {
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    font-family: 'Inter', sans-serif;
    color: #fff;
    background: #000;
    overflow: hidden;
    filter: brightness(var(--brightness));
    transition: filter 0.5s;
}

/* FONDO ANIMADO */
#bg-image {
    position: fixed; inset: 0;
    background-size: cover; background-position: center;
    transition: background-image 1s ease-in-out;
    opacity: 0.7; z-index: -2;
}

.overlay {
    position: fixed; inset: 0;
    background: radial-gradient(circle, transparent 0%, rgba(0, 0, 0, .8) 100%);
    z-index: -1;
}

/* CONTENEDOR PRINCIPAL FLEXIBLE */
.main-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    justify-content: space-around;
    align-items: center;
    box-sizing: border-box;
    padding: 20px;
}

/* RELOJ */
.clock-section {
    text-align: left;
}

#time {
    font-size: 10rem;
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: -4px;
}

#date {
    font-size: 1.8rem;
    opacity: .9;
    margin-left: 5px;
    text-transform: capitalize;
}

#alarm-info {
    margin-top: 15px;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 1.2rem;
    background: rgba(0,0,0,0.5);
    padding: 5px 15px;
    border-radius: 20px;
    display: inline-block;
}

/* TARJETA DE INFORMACIÓN */
.info-section {
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 30px;
    border-radius: 35px;
    text-align: center;
    min-width: 280px;
    border: 1px solid rgba(255,255,255,0.1);
}

.city {
    font-size: 0.9rem; letter-spacing: 2px;
    text-transform: uppercase; opacity: 0.7; margin-bottom: 5px;
}

.temp { font-size: 5rem; line-height: 1; }

.pill {
    margin-top: 15px;
    padding: 8px 16px;
    border-radius: 30px;
    background: rgba(255, 255, 255, .15);
    font-size: 1rem;
    display: inline-block;
}

/* BOTONES FLOTANTES */
.settings-btn, .night-btn {
    position: absolute; bottom: 30px;
    width: 50px; height: 50px;
    border-radius: 50%; border: none;
    background: rgba(255, 255, 255, .15);
    color: white; font-size: 22px; cursor: pointer;
    backdrop-filter: blur(5px);
    z-index: 10;
}
.settings-btn { right: 30px; }
.night-btn { left: 30px; }

/* MODAL DE CONFIGURACIÓN */
.modal {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    align-items: center; justify-content: center;
    z-index: 100; backdrop-filter: blur(5px);
}

.modal-content {
    background: #222; padding: 30px;
    border-radius: 25px; width: 85%; max-width: 320px;
    text-align: center; border: 1px solid #444;
}

.modal-content input[type="time"] {
    font-size: 2rem; padding: 10px; margin: 20px 0;
    background: #333; border: none; color: white;
    border-radius: 10px; width: 100%; box-sizing: border-box;
}

.modal-buttons button {
    padding: 12px; border-radius: 10px; border: none;
    width: 48%; font-weight: bold; cursor: pointer;
}

.btn-save { background: var(--primary-color); color: #000; }
.btn-cancel { background: #444; color: #fff; }

/* ANIMACIÓN DE ALARMA SONANDO */
.alarm-flashing { animation: flash 1s infinite alternate; }
@keyframes flash {
    from { box-shadow: inset 0 0 0 0 red; }
    to { box-shadow: inset 0 0 50px 20px rgba(255, 0, 0, 0.5); }
}

/* RESPONSIVIDAD */
@media (max-width: 900px) {
    /* En móviles verticales, ponemos uno abajo del otro */
    .main-container {
        flex-direction: column;
        justify-content: center;
        gap: 40px;
    }
    
    #time { font-size: 7.5rem; }
    .info-section { min-width: 60vw; }
}

/* Ajuste específico para apaisado en móviles (como Moto E5) */
@media (max-height: 500px) and (orientation: landscape) {
    .main-container {
        flex-direction: row; /* Volver a horizontal */
        padding: 10px;
    }
    #time { font-size: 6rem; }
    .temp { font-size: 3.5rem; }
    .info-section { padding: 15px; }
    .settings-btn, .night-btn { bottom: 15px; }
}