:root {
    --bg-color: #0a0a0a;
    --text-color: #ffffff;
    --accent-color: #3b82f6;
    --alert-color: #ff0000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

/* Utils */
.hidden { display: none !important; }
.visible { display: flex !important; }

/* Capa de Alerta (Fondo oscuro borroso) */
#alert-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.alert-card {
    background: white;
    color: #111;
    border-radius: 15px;
    padding: 20px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(255, 0, 0, 0.3);
    border: 4px solid var(--alert-color);
    text-align: center;
    animation: pulse-red 1s infinite alternate;
}

@keyframes pulse-red {
    0% { border-color: #ff0000; box-shadow: 0 0 20px rgba(255,0,0,0.5); }
    100% { border-color: #880000; box-shadow: 0 0 40px rgba(255,0,0,0.8); }
}

.alert-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.alert-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.alert-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--alert-color);
    margin: 0;
}

#map {
    height: 250px;
    width: 100%;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    z-index: 1; /* Para que no tape la alerta si se rompe */
}

#alert-details {
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-weight: 600;
}

#dismiss-btn {
    background: white;
    color: var(--alert-color);
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.alert-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

#share-btn {
    background: #1877F2; /* Facebook Blue */
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

#watermark {
    margin-top: 15px;
    font-size: 0.9rem;
    color: rgba(0,0,0,0.5);
    font-weight: 600;
}

/* Interfaz Principal */
.app-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    text-align: center;
    overflow-y: auto; /* Permite ver el contenido si lo aplastan mucho */
}

/* Pantalla de Setup */
#setup-screen {
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: auto; /* Centrado seguro que no recorta por arriba */
}

.primary-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.primary-btn:hover {
    background-color: #2563eb;
}

/* Dashboard Reloj */
#dashboard-screen {
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: auto; /* Centrado seguro */
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
    background: rgba(255,255,255,0.1);
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
}

.dot {
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border-radius: 50%;
}

.pulse {
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.clock-container h1 {
    font-size: 5rem;
    font-weight: 300;
    letter-spacing: -2px;
    margin: 0;
}

.clock-container p {
    font-size: 1.2rem;
    color: #9ca3af;
    margin-top: 5px;
}

.disclaimer {
    margin-top: auto;
    padding-top: 50px;
    font-size: 0.7rem;
    color: #6b7280;
    max-width: 300px;
}

/* Footer */
footer {
    text-align: center;
    padding: 15px;
    font-size: 0.8rem;
    color: #9ca3af;
    background: rgba(255,255,255,0.05);
}

footer strong {
    color: white;
}

/* Robot RADAR */
.robot-container {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 30px;
    max-width: 350px;
    background: rgba(255,255,255,0.05);
    padding: 15px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.1);
}

.robot-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.robot-avatar-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    object-fit: cover;
    border: 2px solid var(--accent-color);
}

.robot-name {
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--accent-color);
    letter-spacing: 1px;
}

.robot-bubble {
    background: var(--accent-color);
    color: white;
    padding: 12px 18px;
    border-radius: 15px;
    border-top-left-radius: 0;
    font-size: 0.95rem;
    text-align: left;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* =========================================
   GADGET MODE (Responsividad para Widgets)
   ========================================= */
@media (max-width: 450px), (max-height: 600px) {
    .app-container { padding: 10px; }
    .robot-container { 
        flex-direction: row; 
        align-items: center; 
        margin-bottom: 15px; 
        padding: 10px; 
        gap: 10px; 
    }
    .robot-bubble { font-size: 0.8rem; padding: 8px 12px; }
    .robot-avatar-img { width: 45px; height: 45px; }
    .status-indicator { margin-bottom: 15px; padding: 6px 15px; font-size: 0.8rem; }
    .clock-container h1 { font-size: 3.5rem; }
    .clock-container p { font-size: 0.9rem; }
    .disclaimer { padding-top: 15px; font-size: 0.65rem; }
    
    /* Achicar la alerta */
    .alert-card { padding: 15px; width: 95%; border-width: 2px; }
    .alert-title { font-size: 1.3rem; }
    #map { height: 180px; margin-bottom: 10px; }
    #alert-details { font-size: 0.9rem; margin-bottom: 15px; }
    .alert-actions button { padding: 10px 15px; font-size: 0.9rem; }
}

@media (max-width: 300px), (max-height: 400px) {
    /* ULTRA GADGET MODE (Para esquinas muy pequeñas) */
    .clock-container h1 { font-size: 2.2rem; }
    .clock-container p { font-size: 0.75rem; }
    .robot-container { flex-direction: row; text-align: center; gap: 10px; padding: 5px; }
    .robot-bubble { border-top-left-radius: 15px; text-align: left; padding: 5px 10px; font-size: 0.7rem; }
    .robot-avatar-img { width: 35px; height: 35px; }
    .status-indicator { margin-bottom: 5px; font-size: 0.7rem; padding: 4px 10px; }
    footer { display: none; }
    .disclaimer { display: none; }
}

@media (max-height: 250px) {
    /* MODO BARRA HORIZONTAL (Si el usuario aplasta verticalmente pero Chrome no deja achicar el ancho) */
    #dashboard-screen {
        flex-direction: row;
        justify-content: center;
        gap: 30px;
    }
    .robot-container { 
        margin-bottom: 0; 
        flex-direction: row; 
    }
    .robot-avatar-img { width: 40px; height: 40px; }
    .robot-bubble { display: none; } /* Ocultar chat, solo dejar avatar */
    .clock-container h1 { font-size: 2.5rem; }
    .clock-container p { display: none; }
    .status-indicator { position: absolute; bottom: 5px; right: 10px; margin: 0; padding: 2px 10px; font-size: 0.6rem; }
    footer { display: none; }
    .disclaimer { display: none; }
}
