/* Global resets - solo dentro de .scorex */
.scorex * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Botón flotante inicial */
.scorex .chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 71px;
    top: auto !important;
    left: auto !important;
    width: 50px;
    height: 50px;
    background: #fbbf24; /* amber-400 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 9999;
    font-weight: 700;
    font-size: 28px;
    color: #92400e; /* amber-700 */
    user-select: none;
}

    .scorex .chat-toggle:hover {
        background: #f59e0b; /* amber-500 */
        box-shadow: 0 6px 18px rgba(0,0,0,0.15);
        transform: scale(1.1);
    }

/* Contenedor principal del chat */
.scorex .chat-container {
    position: fixed;
    bottom: 60px;
    right: 20px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    transition: all 0.3s ease, transform 0.2s ease;
    user-select: none;
}

    /* Tamaño normal */
    .scorex .chat-container.normal {
        width: 350px;
        height: 500px;
        border-radius: 0.75rem;
        transform: translateY(0);
    }

    /* Tamaño medio */
    .scorex .chat-container.medium {
        width: 600px;
        max-width: 90%;
        height: 90vh;
        top: 50%;
        left: 50%;
        bottom: auto;
        right: auto;
        border-radius: 0.75rem;
        transform: translate(-50%, -50%);
    }

.scorex .medium #mediumBtn {
    font-size: 11px;
}

    /* Minimized: apariencia de botón flotante circular */
.scorex .chat-container.minimized {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0;
    bottom: 20px;
    right: 71px;
    top: auto !important;
    left: auto !important;
    transform: translateY(0);
    user-select: none;
}

    .scorex .chat-container.normal .minimized-avatar,
    .scorex .chat-container.medium .minimized-avatar {
        display: none;
    }

    .scorex .chat-container.minimized > *:not(.minimized-avatar) {
        display: none !important;
    }

/* Icono visible en minimizado */
.scorex .minimized-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #fbbf24;
    color: #92400e;
    font-weight: 700;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Header del chat */
.scorex .chat-header {
    background: #fbbf24; /* amber-400 */
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #000000; /* amber-700 */
    font-weight: 500;
    font-size: 1rem;
    user-select: text;
    border-bottom: 1px solid #fde68a; /* amber-300 */
}

.scorex .chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scorex .chat-logo {
    width: 32px;
    height: 32px;
    background: #f9fafb; /* amber-700 */
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fef3c7; /* amber-100 */
    font-weight: 900;
    font-size: 16px;
    user-select: none;
}

.scorex .chat-controls {
    display: flex;
    gap: 8px;
}

.scorex .control-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 0.5rem;
    background: #fde68a; /* amber-300 */
    color: #92400e; /* amber-700 */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    font-size: 18px;
    user-select: none;
}

    .scorex .control-btn:hover {
        border: 1px solid #fde68a;
        background: #fbbf24; /* amber-400 */
        transform: scale(1.1);
    }

/* Status indicator */
.scorex .status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-left: 10px;
    color: #1e9148; /* green-400 */
    user-select: none;
}

    .scorex .status-indicator.offline {
        color: #dd4447; /* red-500 */
    }

.scorex .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1e9148; /* green-400 */
    animation: blink 1.5s infinite;
}

    .scorex .status-dot.offline {
        background: #ef4444; /* red-500 */
        animation: none;
    }

.scorex span.offline {
    color: #ef4444; /* red-500 */
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }

    51%, 100% {
        opacity: 0.3;
    }
}

/* Área de mensajes */
.scorex .chat-messages {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    background: #f9fafb; /* gray-50 */
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 14px;
    color: #374151; /* gray-700 */
}

/* Mensajes usuario y bot */
.scorex .message {
    display: flex;
    gap: 10px;
    animation: fadeInUp 0.3s ease;
}

    .scorex .message.user {
        flex-direction: row-reverse;
    }

.scorex .message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    background: #fbbf24; /* amber-400 */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #92400e; /* amber-700 */
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    user-select: none;
}

.scorex .message.user .message-avatar {
    background: #4f46e5; /* indigo-600 */
    color: white;
}

.scorex .message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 1.25rem;
    background: #ffffff;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
    position: relative;
    user-select: text;
    color: #374151;
}

.scorex .message.user .message-content {
    background: #D6D6D6; /*#4f46e5; /* indigo-600 */
    color: #000000;
}

.scorex .message-time {
    font-size: 11px;
    color: #6b7280; /* gray-500 */
    margin-top: 4px;
    text-align: right;
    user-select: none;
}

.scorex .message.user .message-time {
    color: #6b7280; /*rgba(255,255,255,0.75);*/
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loader de escritura */
.scorex .typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    color: #6b7280;
    font-size: 14px;
    user-select: none;
}

    .scorex .typing-indicator.active {
        display: flex;
    }

.scorex .typing-dots {
    display: flex;
    gap: 5px;
}

.scorex .typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24; /* amber-400 */
    animation: typing 1.4s infinite ease-in-out;
}

    .scorex .typing-dot:nth-child(1) {
        animation-delay: -0.32s;
    }

    .scorex .typing-dot:nth-child(2) {
        animation-delay: -0.16s;
    }

    .scorex .typing-dot:nth-child(3) {
        animation-delay: 0s;
    }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Área de input */
.scorex .chat-input-area {
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb; /* gray-200 */
    user-select: none;
}

.scorex .input-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.scorex .chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb; /* gray-200 */
    border-radius: 1.25rem;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s ease;
    user-select: text;
    color: #111827; /* gray-900 */
    max-width: 100%;
}

    .scorex .chat-input:focus {
        border-color: #fbbf24; /* amber-400 */
        box-shadow: 0 0 0 3px #fde68a; /* amber-300 */
    }

.scorex .send-btn {
    width: 40px;
    height: 40px;
    background: #fbbf24; /* amber-400 */
    border: none;
    border-radius: 50%;
    color: #92400e; /* amber-700 */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    user-select: none;
}

    .scorex .send-btn:hover {
        background: #f59e0b; /* amber-500 */
        box-shadow: 0 2px 10px rgba(0,0,0,0.12);
        transform: scale(1.1);
    }

    .scorex .send-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
    }

/* Notificaciones */
.scorex .notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #1e9148; /* green-400 */
    color: white;
    padding: 12px 16px;
    border-radius: 0.75rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    user-select: none;
    font-weight: 700;
    font-size: 14px;
}

    .scorex .notification.show {
        transform: translateX(0);
    }

    .scorex .notification.error {
        background: #ef4444; /* red-500 */
    }

/* Botón de verificación manual */
.scorex .manual-check {
    text-align: center;
    padding: 16px 20px;
    background: #f9fafb; /* gray-50 */
    user-select: none;
}

.scorex .check-btn {
    background: #fbbf24; /* amber-400 */
    color: #92400e; /* amber-700 */
    border: none;
    padding: 10px 20px;
    border-radius: 1.25rem;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    user-select: none;
}

    .scorex .check-btn:hover {
        background: #f59e0b; /* amber-500 */
        box-shadow: 0 2px 10px rgba(0,0,0,0.12);
        transform: translateY(-2px);
    }

/* Responsive */
@media (max-width: 768px) {
    .scorex .chat-container.normal,
    .scorex .chat-container.medium,
    .scorex .chat-container.minimized {
        right: 11px;
        bottom: 74px;
        width: 50px;
        height: 50px;
    }

    .scorex .chat-container.medium,
    .scorex .chat-container.normal {
        width: calc(100vw - 40px);
        height: 80vh;
        border-radius: 1rem;
    }
}