/**
 * Joicy Nails VIP Academy Online - Estilos del Chat en Vivo y Reacciones
 */

.live-chat-card {
    background: var(--bg-card, #111116);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    position: relative;
    transition: all 0.25s ease;
}

.live-chat-header {
    background: linear-gradient(90deg, rgba(20, 20, 26, 0.95), rgba(35, 30, 20, 0.95));
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.live-chat-header .chat-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.live-chat-header .chat-badge-live {
    background: rgba(230, 57, 70, 0.15);
    color: #e63946;
    border: 1px solid rgba(230, 57, 70, 0.4);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.live-chat-header .chat-badge-live .pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e63946;
    box-shadow: 0 0 8px #e63946;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.8; }
}

/* Filtros en cabecera */
.chat-filters-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-filter-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-filter-btn:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.06);
}

.chat-filter-btn.active {
    background: #D4AF37;
    color: #0A0A0A;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.3);
}

/* Área de Mensajes */
.live-chat-messages {
    height: 380px;
    max-height: 480px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: radial-gradient(circle at top right, rgba(212, 175, 55, 0.04), transparent 50%), var(--bg-card, #111116);
    position: relative;
    scroll-behavior: smooth;
}

.live-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.live-chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.live-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 3px;
}

.live-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.6);
}

/* ========================================================= */
/* MENSAJES ESTILO WHATSAPP: IZQUIERDA / DERECHA             */
/* ========================================================= */
.live-chat-messages {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
}

.chat-msg-item {
    display: flex !important;
    gap: 8px !important;
    align-items: flex-end !important;
    animation: fadeInMsg 0.22s ease-out !important;
    position: relative !important;
    margin-bottom: 10px !important;
    max-width: 82% !important;
    width: fit-content !important;
}

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

.chat-msg-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 1.5px solid rgba(212, 175, 55, 0.4) !important;
    flex-shrink: 0 !important;
    margin-bottom: 2px !important;
}

/* 1. MENSAJES A LA IZQUIERDA (Chicas para Joicy | Joicy y otras alumnas para cada alumna) */
.chat-msg-item.is-left {
    align-self: flex-start !important;
    margin-left: 0 !important;
    margin-right: auto !important;
    justify-content: flex-start !important;
    flex-direction: row !important;
}

.chat-msg-item.is-left .chat-msg-bubble {
    background: #191924 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 14px 14px 14px 3px !important;
    padding: 8px 12px !important;
    width: 100% !important;
    position: relative !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
    text-align: left !important;
}

.chat-msg-item.is-left .chat-msg-author {
    color: #93c5fd !important; /* Celeste amigable para las alumnas */
    font-size: 0.8rem !important;
    font-weight: 700 !important;
}

/* Mensaje a la izquierda si proviene de Joicy */
.chat-msg-item.is-left.is-instructor-msg .chat-msg-bubble {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.18) 0%, #1c1710 100%) !important;
    border: 1.5px solid rgba(212, 175, 55, 0.45) !important;
}

.chat-msg-item.is-left.is-instructor-msg .chat-msg-author {
    color: #D4AF37 !important;
}

/* 2. MENSAJES A LA DERECHA (Joicy en su panel | Cada alumna su propio mensaje) */
.chat-msg-item.is-right {
    align-self: flex-end !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    justify-content: flex-start !important; /* En row-reverse, flex-start es la DERECHA */
    flex-direction: row-reverse !important;
}

.chat-msg-item.is-right .chat-msg-bubble {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.24) 0%, rgba(184, 134, 11, 0.16) 100%), #1d1b14 !important;
    border: 1px solid rgba(212, 175, 55, 0.45) !important;
    border-radius: 14px 14px 3px 14px !important;
    padding: 8px 12px !important;
    width: 100% !important;
    position: relative !important;
    box-shadow: 0 3px 14px rgba(212, 175, 55, 0.18) !important;
    text-align: left !important;
}

.chat-msg-item.is-right .chat-msg-author {
    color: #D4AF37 !important;
    font-size: 0.8rem !important;
    font-weight: 800 !important;
}

.chat-msg-item.is-right .chat-msg-header {
    flex-direction: row-reverse !important;
}

.chat-msg-item.is-right .chat-msg-time {
    margin-left: 0 !important;
    margin-right: auto !important;
}

.chat-msg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.chat-msg-badge-instructor {
    background: linear-gradient(135deg, #D4AF37, #b8860b);
    color: #0A0A0A;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chat-msg-time {
    font-size: 0.68rem;
    color: #9ca3af;
    margin-left: auto;
}

.chat-msg-text {
    font-size: 0.86rem;
    color: #f9fafb;
    line-height: 1.42;
    word-break: break-word;
    margin: 0;
}

/* ========================================================= */
/* ESTILO ESPECIAL: PREGUNTAS PARA JOICY                    */
/* ========================================================= */
.chat-msg-item.is-question .chat-msg-bubble {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.22) 0%, rgba(30, 25, 15, 0.85) 100%) !important;
    border: 1.5px solid #D4AF37 !important;
    box-shadow: 0 4px 18px rgba(212, 175, 55, 0.25) !important;
}

.chat-question-badge {
    background: #D4AF37;
    color: #0A0A0A;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.4px;
}

.chat-question-badge.is-answered {
    background: #10b981;
    color: #FFFFFF;
}

.chat-admin-actions {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(212, 175, 55, 0.3);
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-answer-toggle {
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid #D4AF37;
    color: #D4AF37;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-answer-toggle:hover {
    background: #D4AF37;
    color: #0A0A0A;
}

.btn-answer-toggle.answered {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #10b981;
}

.btn-answer-toggle.answered:hover {
    background: #10b981;
    color: #FFFFFF;
}

/* Mensaje Destacado de Joicy */
.chat-msg-item.is-highlight .chat-msg-bubble {
    background: linear-gradient(135deg, rgba(230, 57, 70, 0.15) 0%, rgba(212, 175, 55, 0.15) 100%);
    border: 1.5px solid #e63946;
}

/* Botón flotante para scroll al fondo */
.chat-scroll-bottom-btn {
    position: absolute;
    bottom: 70px;
    right: 20px;
    background: #D4AF37;
    color: #0A0A0A;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
    animation: bounceIn 0.3s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0.6); opacity: 0; }
    80% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* ========================================================= */
/* BARRA DE REACCIONES RÁPIDAS EN VIVO                       */
/* ========================================================= */
.live-chat-reactions-bar {
    background: rgba(15, 15, 20, 0.85);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.reactions-list {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-reaction {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 4px 9px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #d1d5db;
}

.btn-reaction:hover {
    transform: scale(1.2) translateY(-2px);
    background: rgba(212, 175, 55, 0.2);
    border-color: #D4AF37;
}

.btn-reaction:active {
    transform: scale(0.95);
}

.btn-reaction .reaction-count {
    font-size: 0.68rem;
    font-weight: 700;
    color: #D4AF37;
}

/* ========================================================= */
/* ANIMACIÓN FLOTANTE DE REACCIONES (Tipo TikTok/Instagram) */
/* ========================================================= */
.floating-reactions-stage {
    position: absolute;
    bottom: 75px;
    right: 25px;
    width: 90px;
    height: 280px;
    pointer-events: none;
    overflow: hidden;
    z-index: 20;
}

.floating-particle {
    position: absolute;
    bottom: 0;
    font-size: 1.8rem;
    user-select: none;
    animation: floatUpAndFade 2.4s ease-out forwards;
}

@keyframes floatUpAndFade {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.6) rotate(0deg);
    }
    15% {
        opacity: 1;
        transform: translateY(-30px) scale(1.2) rotate(-8deg);
    }
    50% {
        opacity: 0.9;
        transform: translateY(-130px) scale(1) rotate(12deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-260px) scale(0.75) rotate(-15deg);
    }
}

/* ========================================================= */
/* BARRA DE ENTRADA Y ENVÍO DEL MENSAJE                     */
/* ========================================================= */
.live-chat-footer {
    background: rgba(20, 20, 26, 0.98);
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    padding: 12px 14px;
}

.chat-input-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.btn-toggle-question {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-toggle-question:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
}

.btn-toggle-question.active {
    background: rgba(212, 175, 55, 0.2);
    border-color: #D4AF37;
    color: #D4AF37;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
}

.chat-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-text-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 14px;
    color: #FFFFFF;
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}

.chat-text-input:focus {
    outline: none;
    border-color: #D4AF37;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
    background: rgba(0, 0, 0, 0.7);
}

.chat-text-input::placeholder {
    color: #6b7280;
    font-size: 0.84rem;
}

.btn-send-chat {
    background: #D4AF37;
    color: #0A0A0A;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-send-chat:hover {
    background: #f3d068;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.4);
    transform: translateY(-1px);
}

.btn-send-chat:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================================= */
/* VISTA POPOUT PARA JOICY (SEGUNDO MONITOR)                */
/* ========================================================= */
.popout-window-body {
    background-color: #0c0c10;
    color: #f3f4f6;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.popout-topbar {
    background: #14141c;
    border-bottom: 2px solid #D4AF37;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.popout-topbar .brand {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    color: #D4AF37;
    display: flex;
    align-items: center;
    gap: 10px;
}

.popout-topbar .stream-title {
    font-size: 0.9rem;
    color: #d1d5db;
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popout-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-popout-tool {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #d1d5db;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-popout-tool:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: #D4AF37;
    color: #FFFFFF;
}

.btn-popout-tool.active {
    background: #D4AF37;
    color: #0A0A0A;
    border-color: #D4AF37;
    font-weight: 700;
}

.popout-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.popout-chat-container .live-chat-messages {
    flex: 1;
    height: auto;
    max-height: none;
    padding: 20px;
    gap: 16px;
}

/* Modo Texto Grande para Monitor a Distancia */
.large-font .chat-msg-text {
    font-size: 1.15rem;
    line-height: 1.55;
}

.large-font .chat-msg-author {
    font-size: 1rem;
}

.large-font .chat-question-badge {
    font-size: 0.85rem;
    padding: 4px 10px;
}

.large-font .btn-answer-toggle {
    font-size: 0.85rem;
    padding: 6px 14px;
}
