/* =============================================
   SISTEMA DE CHAT DE SOPORTE - BINGO TOVAR
   Estilos para el chat flotante
   ============================================= */

/* Botón flotante del chat - OCULTO (solo se abre desde el botón de Ayuda) */
.chat-bubble-button {
    display: none !important; /* Ocultar el botón flotante */
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 99999;
    border: none;
}

.chat-bubble-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chat-bubble-button i {
    font-size: 28px;
    color: white;
}

/* Badge de notificaciones */
.chat-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* Contenedor del chat */
.chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 40px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    z-index: 99998;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.chat-window.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header del chat */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.chat-close-btn:active {
    transform: scale(0.95);
}

/* Área de mensajes */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

/* Mensaje individual */
.chat-message {
    display: flex;
    margin-bottom: 10px;
    animation: messageIn 0.2s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.usuario {
    justify-content: flex-end;
}

.chat-message.soporte {
    justify-content: flex-start;
}

.chat-message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-message.usuario .chat-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.chat-message.soporte .chat-message-bubble {
    background: white;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.chat-message-text {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    word-break: break-word;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Contenedor de imagen en mensaje */
.chat-message-image-container {
    margin-bottom: 8px;
    border-radius: 12px;
    overflow: hidden;
    max-width: 100%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.chat-message-image-container:hover {
    transform: scale(1.02);
}

.chat-message-image {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    max-height: 300px;
    object-fit: contain;
    background: #f0f0f0;
}

.chat-message.usuario .chat-message-image {
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-message.soporte .chat-message-image {
    border: 2px solid #e9ecef;
}

/* Estilos para enlaces en mensajes */
.chat-message-text a {
    color: inherit;
    text-decoration: underline;
    word-break: break-all;
}

.chat-message-text a:hover {
    opacity: 0.8;
}

.chat-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 6px;
    display: block;
    font-weight: 500;
}

.chat-message.usuario .chat-message-time {
    text-align: right;
}

/* Mensajes del sistema */
.chat-message.sistema {
    justify-content: center;
    opacity: 0.75;
}

.chat-message.sistema.system-notice {
    margin: 8px 0;
}

.chat-message.sistema .chat-message-bubble {
    background: #f0f0f0;
    color: #666;
    border: 1px dashed #ccc;
    border-radius: 12px;
    padding: 10px 14px;
    max-width: 90%;
    box-shadow: none;
    font-style: italic;
}

.chat-message.sistema .chat-message-text {
    font-size: 13px;
    color: #666;
    font-style: italic;
    text-align: center;
}

.chat-message.sistema .chat-message-time {
    font-size: 10px;
    opacity: 0.6;
    text-align: center;
    margin-top: 4px;
}

/* Indicador de escritura */
.chat-typing-indicator {
    display: none;
    padding: 10px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.chat-typing-indicator.active {
    display: block;
}

.chat-typing-indicator .typing-dots {
    display: inline-block;
}

.chat-typing-indicator .typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    margin: 0 2px;
    animation: typingDot 1.4s infinite;
}

.chat-typing-indicator .typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing-indicator .typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Área de entrada */
.chat-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

/* Botón de imagen */
.chat-image-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    color: #667eea;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-image-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.chat-image-btn:active {
    transform: scale(0.95);
}

.chat-image-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    font-family: inherit;
    line-height: 1.4;
}

.chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Estado de carga */
.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
}

.chat-loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mensaje de bienvenida */
.chat-welcome-message {
    text-align: center;
    padding: 30px 20px;
    color: #666;
}

.chat-welcome-message i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 15px;
}

.chat-welcome-message h4 {
    font-size: 18px;
    margin: 0 0 10px 0;
    color: #333;
}

.chat-welcome-message p {
    font-size: 14px;
    margin: 0;
}

/* Scrollbar personalizada */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        right: 10px;
        bottom: 10px;
        left: 10px;
        border-radius: 15px;
    }
    
    .chat-header {
        padding: 16px;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .chat-input-area {
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .chat-bubble-button {
        right: 10px;
        bottom: 150px;
    }
}

/* Estado online del soporte */
.chat-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4caf50;
    display: inline-block;
    margin-right: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chat-status-indicator.offline {
    background: #999;
    animation: none;
}

/* Formulario de registro inicial */
.chat-registration-form {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 20px;
}

.chat-registration-content {
    width: 100%;
    max-width: 400px;
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
}

.chat-registration-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-registration-close:hover {
    background: #e0e0e0;
    color: #333;
    transform: rotate(90deg);
}

.chat-registration-close i {
    font-size: 18px;
}

.chat-registration-content h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-registration-content h4 i {
    color: #667eea;
}

.chat-registration-content p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

.chat-form-group {
    margin-bottom: 20px;
}

.chat-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.chat-input-field {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.chat-input-field:focus {
    outline: none;
    border-color: #667eea;
}

.chat-submit-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-submit-btn:active {
    transform: translateY(0);
}

.chat-submit-btn i {
    font-size: 14px;
}

