:root {
    --azul-cielo-principal: #0c5a7d;
    --azul-cielo-claro: #38bdf8;
    --azul-cielo-oscuro: #0284c7;
    --fondo-app: #e0f2fe;
    --fondo-panel: #bae6fd;
    --fondo-input: #e0f2fe;
    --burbuja-bot: #ffffff;
    --burbuja-user: var(--azul-cielo-oscuro);
    --texto-oscuro: #0f172a;
    --texto-claro: #ffffff;
    --caida-panel: 0 20px 40px rgba(14, 165, 233, 0.15), 0 5px 15px rgba(0,0,0,0.05);
    --caida-boton: 0 4px 10px rgba(14, 165, 233, 0.2);
}
body.dark-mode {
    --azul-cielo-principal: #0284c7;
    --azul-cielo-claro: #0ea5e9;
    --azul-cielo-oscuro: #0f172a;
    --fondo-app: #020617;
    --fondo-panel: #0f172a;
    --fondo-input: #020617;
    --burbuja-bot: #1e293b;
    --burbuja-user: #0ea5e9;
    --texto-oscuro: #f8fafc;
    --texto-claro: #ffffff;
    --caida-panel: 0 20px 40px rgba(0, 0, 0, 0.6), 0 5px 15px rgba(0,0,0,0.3);
    --caida-boton: 0 4px 10px rgba(0, 0, 0, 0.4);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--fondo-app); font-family: 'Segoe UI', sans-serif;
    color: var(--texto-oscuro); padding: 20px; display: flex;
    justify-content: center; align-items: center; min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
}
#intro-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--fondo-app); display: flex; flex-direction: column;
    justify-content: center; align-items: center; z-index: 1000;
    transition: opacity 0.5s ease, transform 0.5s ease; padding: 20px; text-align: center;
}
#splash-texto-1 { font-size: 36px; font-weight: 800; color: var(--azul-cielo-claro); animation: fadeIn 1s ease-in-out; }
#splash-texto-2 { display: flex; flex-direction: column; gap: 15px; max-width: 600px; }
#splash-texto-2 p {
    font-size: 18px; font-weight: 600; background: var(--burbuja-bot); color: var(--texto-oscuro);
    padding: 18px 25px; border-radius: 15px; box-shadow: 0 4px 15px rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.2); opacity: 0; animation: popIn 0.5s ease-out forwards;
}
#splash-texto-2 p:nth-child(1) { animation-delay: 0.1s; }
#splash-texto-2 p:nth-child(2) { animation-delay: 0.4s; }
#splash-texto-2 p:nth-child(3) { animation-delay: 0.7s; }
@keyframes popIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.kiosco-container {
    width: 100%; max-width: 900px; background: var(--fondo-panel); border-radius: 20px;
    box-shadow: var(--caida-panel); overflow: hidden; border: 1px solid rgba(14, 165, 233, 0.1);
    flex-direction: column; display: none; opacity: 0; transform: scale(0.9) translateY(30px);
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.kiosco-container.visible { opacity: 1; transform: scale(1) translateY(0); }
.chat-header {
    background: var(--azul-cielo-oscuro); color: white; padding: 12px 20px;
    display: flex; align-items: center; gap: 15px; z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); transition: background-color 0.4s ease;
}
.header-avatar {
    width: 45px; height: 45px; background: white; color: var(--azul-cielo-oscuro);
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 16px;
}
.header-info { display: flex; flex-direction: column; flex: 1; }
.header-info h2 { font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.header-info .status { font-size: 13px; color: #bae6fd; display: flex; align-items: center; gap: 6px; }
.header-info .status::before { content: ''; display: block; width: 8px; height: 8px; background-color: #4ade80; border-radius: 50%; }
.theme-btn { background: transparent; border: none; font-size: 22px; cursor: pointer; transition: transform 0.3s ease; outline: none; }
.theme-btn:hover { transform: scale(1.15); }
#panelConversacion {
    height: 60vh; min-height: 400px; max-height: 600px; padding: 20px 30px; overflow-y: auto;
    background-color: var(--fondo-panel); display: flex; flex-direction: column; gap: 15px;
}
.respuesta-bot { display: flex; align-items: flex-end; gap: 10px; max-width: 85%; animation: fadeIn 0.3s ease-in-out; }
.respuesta-texto {
    background: var(--burbuja-bot); color: var(--texto-oscuro); padding: 12px 18px; border-radius: 0px 15px 15px 15px;
    font-size: 15px; line-height: 1.5; font-weight: 400; box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.mensaje-usuario { display: flex; justify-content: flex-end; width: 100%; animation: fadeIn 0.3s ease-in-out; }
.burbuja-usuario {
    background: var(--burbuja-user); color: var(--texto-claro); padding: 12px 18px;
    border-radius: 15px 0px 15px 15px; font-size: 15px; max-width: 85%; box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.header-sugerencias { text-align: center; padding: 10px 0; font-size: 13px; color: var(--azul-cielo-principal); background: var(--fondo-input); }
.preguntas { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 10px 20px 15px 20px; background: var(--fondo-input); }
.btn-sugerencia {
    background: var(--burbuja-bot); color: var(--azul-cielo-principal); border: 1px solid var(--azul-cielo-claro);
    padding: 8px 18px; border-radius: 20px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s ease;
}
.btn-sugerencia:hover { background: var(--azul-cielo-principal); color: white; }
.input-container { display: flex; padding: 15px 20px; background: var(--fondo-input); gap: 10px; align-items: center; border-top: 1px solid transparent; }
#mensaje {
    flex: 1; padding: 14px 20px; border: 1px solid rgba(14, 165, 233, 0.2); border-radius: 25px;
    font-size: 15px; outline: none; background: var(--burbuja-bot); color: var(--texto-oscuro);
}
#mensaje:focus { box-shadow: 0 0 0 2px var(--azul-cielo-claro); }
#btnEnviar {
    background: var(--azul-cielo-principal); color: white; border: none; padding: 14px 25px;
    border-radius: 25px; font-weight: bold; font-size: 15px; cursor: pointer; box-shadow: var(--caida-boton);
}
#btnEnviar:hover:not(:disabled) { background: var(--azul-cielo-oscuro); }
.d-none { display: none !important; }
#escribiendo { padding: 0 30px 10px 30px; display: flex; align-items: center; gap: 5px; color: var(--azul-cielo-principal); font-size: 14px; font-style: italic; }
.typing-dots span { display: inline-block; width: 5px; height: 5px; background-color: var(--azul-cielo-principal); border-radius: 50%; animation: bounce 1.4s infinite ease-in-out both; }
.typing-dots span:nth-child(1) { animation-delay: -0.32s; } .typing-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
    html, body { height: 100%; width: 100%; margin: 0; padding: 0; overflow: hidden; }
    body { display: block; background: var(--fondo-panel); }
    .kiosco-container { width: 100%; max-width: 100%; height: 100%; height: 100dvh; margin: 0; border-radius: 0; border: none; display: flex; flex-direction: column; transform: none !important; box-sizing: border-box; }
    #panelConversacion { flex: 1 1 auto; padding: 15px; height: auto; min-height: 0; max-height: none; overflow-y: auto; overflow-x: hidden; width: 100%; box-sizing: border-box; }
    .header-sugerencias, .preguntas { flex: 0 0 auto; width: 100%; box-sizing: border-box; }
    .input-container { flex: 0 0 auto; width: 100%; padding: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); gap: 8px; border-top: 1px solid rgba(14, 165, 233, 0.2); box-sizing: border-box; display: flex; align-items: center; }
    #mensaje { flex: 1; min-width: 0; padding: 12px 15px; font-size: 16px; box-sizing: border-box; }
    #btnEnviar { flex-shrink: 0; padding: 12px 15px; font-size: 14px; white-space: nowrap; }
    .mic-btn { flex-shrink: 0; width: 45px; height: 45px; }
}

.mic-btn { background: transparent; border: none; color: var(--azul-cielo-principal); width: 45px; height: 45px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; outline: none; border-radius: 50%; transition: all 0.3s ease; }
.mic-btn svg { width: 24px; height: 24px; fill: currentColor; }
.mic-btn:hover { background: rgba(14, 165, 233, 0.1); }
.input-container.grabando-activa { background: rgba(239, 68, 68, 0.05); border-top: 1px solid #ef4444; }
.mic-btn.grabando { background: #ef4444; color: white; box-shadow: 0 0 15px rgba(239, 68, 68, 0.6), 0 0 30px rgba(239, 68, 68, 0.4); animation: latido-mic 1s infinite alternate; }
.mic-btn.grabando svg { fill: #ffffff; }
#mensaje.input-bloqueado { border-color: #ef4444; background-color: #fee2e2; color: #991b1b; font-weight: 500; }
@keyframes latido-mic { 0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.5)); } 100% { transform: scale(1.15); filter: drop-shadow(0 0 12px rgba(239, 68, 68, 1)); } }
