/* ===================================================
   Módulo de Asistencia / Chat IA - HikariApp
   =================================================== */

.chat-wrapper {
    height: calc(100vh - 100px); /* Restando el padding y el top-header */
    display: flex;
    flex-direction: column;
    padding: var(--page-padding);
}

.chat-container {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

/* ── Chat Header ── */
.chat-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: rgba(15, 23, 42, 0.4);
}

.bot-avatar-header {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--secondary-color), #0ea5e9);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.4));
}

.bot-info h2 {
    margin: 0;
    font-family: 'Outfit';
    font-size: 1.2rem;
    font-weight: 700;
}

.bot-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #22C55E;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: pulse-green 2s infinite;
}

/* ── Chat Messages Area ── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
}

/* Burbujas */
.message {
    display: flex;
    max-width: 80%;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    margin: 0 12px;
    font-size: 0.9rem;
}

.message.bot .msg-avatar {
    background: rgba(6, 182, 212, 0.15);
    color: var(--secondary-color);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.message.user .msg-avatar {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.msg-bubble {
    padding: 1rem 1.2rem;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    color: white;
}

.message.bot .msg-bubble {
    background: rgba(255, 255, 255, 0.05);
    border-top-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.message.user .msg-bubble {
    background: linear-gradient(135deg, var(--secondary-color), #0ea5e9);
    border-top-right-radius: 4px;
    box-shadow: 0 5px 15px rgba(6, 182, 212, 0.2);
}

.msg-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 5px;
    display: block;
    text-align: right;
}
.message.bot .msg-time { text-align: left; }

/* ── Typing Indicator ── */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 12px 15px;
    background: rgba(255,255,255,0.03);
    border-radius: 20px;
    width: fit-content;
    margin-left: 59px; /* Alineado con mensajes del bot */
    margin-bottom: 1rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ── Chat Input Area ── */
.chat-input-container {
    padding: 1.5rem 2rem;
    background: rgba(15, 23, 42, 0.6);
    border-top: 1px solid rgba(255,255,255,0.05);
}

.quick-replies {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none; /* Firefox */
}
.quick-replies::-webkit-scrollbar { display: none; }

.btn-quick {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: var(--secondary-color);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}
.btn-quick:hover {
    background: var(--secondary-color);
    color: white;
}

.input-row {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 12px 20px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.chat-input:focus {
    border-color: var(--secondary-color);
    background: rgba(6, 182, 212, 0.05);
}

.btn-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--secondary-color);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-send:hover {
    transform: scale(1.08) rotate(-10deg);
}

/* Animaciones */
@keyframes popIn {
    0% { opacity: 0; transform: translateY(20px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes typing {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-3px); opacity: 1; }
}

@media (max-width: 768px) {
    .chat-wrapper { padding: 1rem; height: calc(100vh - 70px); }
    .chat-container { border-radius: 15px; }
    .message { max-width: 90%; }
    .chat-header, .chat-input-container, .chat-messages { padding: 1rem; }
    .msg-avatar { display: none; }
    .typing-indicator { margin-left: 0; }
}
