/**
 * TuTV CMS - Estilos del Chat Público tipo YouTube
 */

/* =============================================
   WIDGET DE CHAT FLOTANTE
   ============================================= */
.chat-widget {
    position: fixed;
    bottom: 90px;
    right: 15px;
    z-index: 999;
}

.chat-toggle-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tutv-yellow), var(--tutv-lime));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5);
    transition: all 0.3s ease;
}

.chat-toggle-btn i {
    font-size: 22px;
    color: var(--tutv-dark);
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(143, 229, 31, 0.7);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--tutv-magenta);
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* =============================================
   VENTANA DE CHAT
   ============================================= */
.chat-window {
    position: absolute;
    bottom: 65px;
    right: 0;
    width: 340px;
    height: 400px;
    max-height: calc(100vh - 180px);
    background: linear-gradient(180deg, var(--tutv-dark), var(--tutv-darker));
    border-radius: 20px;
    border: 2px solid var(--tutv-yellow);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#chat-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chat-window.active {
    display: flex;
    animation: chatSlideUp 0.3s ease;
}

@keyframes chatSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header del chat */
.chat-header {
    background: linear-gradient(90deg, var(--tutv-magenta), var(--tutv-yellow));
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h4 {
    margin: 0;
    color: var(--tutv-dark);
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header .live-dot {
    width: 8px;
    height: 8px;
    background: #ff0000;
    border-radius: 50%;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.chat-close-btn {
    background: none;
    border: none;
    color: var(--tutv-dark);
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.chat-close-btn:hover {
    opacity: 1;
}

/* =============================================
   FORMULARIO DE NOMBRE
   ============================================= */
.chat-name-form {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
    flex: 1;
}

.chat-name-form h5 {
    color: var(--tutv-yellow);
    margin: 0;
    font-size: 16px;
}

.chat-name-form input {
    padding: 12px 15px;
    border: 2px solid var(--tutv-yellow);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    text-align: center;
    outline: none;
    transition: all 0.3s;
}

.chat-name-form input:focus {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.chat-name-form button {
    padding: 12px 25px;
    background: linear-gradient(135deg, var(--tutv-yellow), var(--tutv-lime));
    border: none;
    border-radius: 25px;
    color: var(--tutv-dark);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.chat-name-form button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5);
}

/* =============================================
   ÁREA DE MENSAJES
   ============================================= */
.chat-messages {
    flex: 1;
    min-height: 0;
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--tutv-yellow);
    border-radius: 5px;
}

/* Mensaje individual */
.chat-message {
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    transition: background 0.2s;
}

.chat-message:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-message.pinned {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(143, 229, 31, 0.1));
    border-left: 3px solid var(--tutv-yellow);
}

.chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.chat-user-name {
    font-weight: bold;
    font-size: 12px;
}

.chat-message-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

.chat-message-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
    word-break: break-word;
}

/* Reply preview */
.chat-reply-preview {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    padding: 5px 10px;
    margin-bottom: 5px;
    border-left: 2px solid var(--tutv-magenta);
    background: rgba(255, 20, 147, 0.1);
    border-radius: 0 8px 8px 0;
}

.chat-reply-preview strong {
    color: var(--tutv-magenta);
}

/* Acciones del mensaje */
.chat-message-actions {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.chat-message:hover .chat-message-actions {
    opacity: 1;
}

.chat-action-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 10px;
    transition: all 0.2s;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--tutv-yellow);
}

/* Reacciones */
.chat-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.chat-reaction {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-reaction:hover {
    background: rgba(255, 215, 0, 0.3);
}

.chat-reaction.active {
    background: rgba(255, 215, 0, 0.3);
    border: 1px solid var(--tutv-yellow);
}

.chat-reaction-count {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
}

/* Selector de reacciones */
.reaction-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--tutv-dark);
    border: 1px solid var(--tutv-yellow);
    border-radius: 20px;
    padding: 5px 10px;
    display: none;
    gap: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.reaction-picker.active {
    display: flex;
}

.reaction-option {
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
}

.reaction-option:hover {
    transform: scale(1.3);
}

/* =============================================
   INPUT DE MENSAJE
   ============================================= */
.chat-input-area {
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.chat-reply-indicator {
    display: none;
    background: rgba(255, 20, 147, 0.2);
    padding: 8px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.chat-reply-indicator.active {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-reply-indicator button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input-wrapper input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 13px;
    outline: none;
}

.chat-input-wrapper input:focus {
    background: rgba(255, 255, 255, 0.15);
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tutv-yellow), var(--tutv-lime));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    transform: scale(1.1);
}

.chat-send-btn i {
    color: var(--tutv-dark);
    font-size: 14px;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 400px) {
    .chat-window {
        width: calc(100vw - 30px);
        height: 400px;
        right: -50px;
    }
}

@media (max-height: 600px) {
    .chat-window {
        height: 350px;
    }
}