/* ============================================
   JOTA JOTA – ESTILOS PRINCIPALES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    color: #ffffff;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app-container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: linear-gradient(180deg, #2c3e50 0%, #1a1a2e 100%);
}

/* Zona de la oficina */
#oficina {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}

#fondo-oficina {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Panel de botones flotantes */
#floating-buttons {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(20, 20, 30, 0.6);
    backdrop-filter: blur(10px);
    padding: 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#floating-buttons button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

#floating-buttons button:active {
    transform: scale(0.9);
}

#btn-hablar {
    background: linear-gradient(135deg, #00D4FF, #E63946) !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

#btn-maestro {
    border: 1px solid rgba(255, 215, 0, 0.5) !important;
}

#btn-ayuda {
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

#personaje-container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#personaje {
    width: min(40vw, 180px);
    height: auto;
    filter: drop-shadow(0 0 25px rgba(0, 212, 255, 0.6));
    transition: transform 0.3s ease, filter 0.3s ease;
}

#bocadillo {
    position: absolute;
    bottom: 65%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 280px;
    width: max-content;
    font-size: 0.85rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: opacity 0.4s ease;
    z-index: 3;
}

#bocadillo::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: 10px solid rgba(255, 255, 255, 0.95);
}

.oculto {
    opacity: 0;
    pointer-events: none;
}

/* Panel de control inferior */
#panel-control {
    background: rgba(20, 20, 30, 0.97);
    backdrop-filter: blur(20px);
    border-top: 2px solid rgba(0, 212, 255, 0.3);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 45vh;
    z-index: 10;
}

#estado-escucha {
    text-align: center;
    color: #00D4FF;
    font-size: 0.8rem;
    font-weight: bold;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

#chat-container {
    flex: 1;
    overflow-y: auto;
    max-height: 20vh;
    min-height: 80px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 5px;
}

#chat-messages {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
}

.mensaje {
    padding: 8px 12px;
    border-radius: 14px;
    max-width: 85%;
    font-size: 0.8rem;
    animation: fadeIn 0.3s ease;
    word-wrap: break-word;
}

.mensaje.usuario {
    align-self: flex-end;
    background: linear-gradient(135deg, #00D4FF, #0077b6);
    color: white;
    border-bottom-right-radius: 4px;
}

.mensaje.jota {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom-left-radius: 4px;
}

.mensaje.sistema {
    align-self: center;
    background: rgba(255, 215, 0, 0.2);
    font-size: 0.7rem;
    color: #FFD700;
    max-width: 90%;
}

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

#input-area {
    display: flex;
    gap: 8px;
}

#chat-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 25px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 0.85rem;
    outline: none;
    transition: border 0.3s;
}

#chat-input:focus {
    border-color: #00D4FF;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

#btn-enviar {
    padding: 10px 18px;
    border-radius: 25px;
    border: none;
    background: linear-gradient(135deg, #00D4FF, #0077b6);
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.85rem;
    transition: transform 0.15s;
}

#btn-enviar:active {
    transform: scale(0.9);
}

/* Modal de ayuda */
#modal-ayuda {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

#modal-contenido {
    background: #1a1a2e;
    border: 1px solid rgba(0,212,255,0.3);
    border-radius: 16px;
    padding: 20px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    color: white;
    font-size: 0.85rem;
    white-space: pre-line;
    line-height: 1.5;
}

#btn-cerrar-modal {
    margin-top: 10px;
    padding: 10px 20px;
    border-radius: 20px;
    border: none;
    background: #E63946;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

@keyframes pensar {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

/* Ajustes responsive */
@media (max-width: 380px) {
    #personaje {
        width: 35vw;
    }
    #bocadillo {
        max-width: 220px;
        font-size: 0.75rem;
    }
    .mensaje {
        font-size: 0.75rem;
    }
    #floating-buttons {
        top: 10px;
        right: 10px;
        gap: 6px;
        padding: 8px;
    }
    #floating-buttons button {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
}

@media (min-width: 768px) {
    #app-container {
        max-width: 600px;
        border-radius: 20px;
        overflow: hidden;
        box-shadow: 0 0 60px rgba(0, 212, 255, 0.2);
        height: 90vh;
        margin: 20px;
    }
}