/* Chat Widget Styles - v2.2.0 */

/* Botón flotante del chat */
#chatFloatingBtn.chat-floating-btn {
    position: fixed !important;
    width: 60px !important;
    height: 60px !important;
    background: #3498db !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.4) !important;
    transition: all 0.3s ease !important;
    z-index: 9999 !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Posiciones del botón flotante */
.chat-floating-btn.chat-position-bottom-right {
    bottom: 30px !important;
    right: 30px !important;
}

.chat-floating-btn.chat-position-bottom-left {
    bottom: 30px !important;
    left: 30px !important;
}

.chat-floating-btn.chat-position-top-right {
    top: 30px !important;
    right: 30px !important;
}

.chat-floating-btn.chat-position-top-left {
    top: 30px !important;
    left: 30px !important;
}

.chat-floating-btn.chat-position-center-bottom {
    bottom: 30px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

.chat-floating-btn.chat-position-center-bottom:hover {
    transform: translateX(-50%) scale(1.15) !important;
}

.chat-floating-btn:hover {
    background: #2980b9 !important;
    transform: scale(1.15) !important;
    box-shadow: 0 8px 30px rgba(52, 152, 219, 0.6) !important;
}

.chat-floating-btn svg {
    width: 28px !important;
    height: 28px !important;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Widget de chat */
.chat-widget {
    position: fixed;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 999;
    animation: slideUp 0.3s ease;
}

/* Posiciones del widget - SEGUIR AL BOTÓN */
.chat-widget.chat-widget-position-follow-button.chat-button-bottom-right {
    bottom: 30px;
    right: 30px;
}

.chat-widget.chat-widget-position-follow-button.chat-button-bottom-left {
    bottom: 30px;
    left: 30px;
}

.chat-widget.chat-widget-position-follow-button.chat-button-top-right {
    top: 30px;
    right: 30px;
}

.chat-widget.chat-widget-position-follow-button.chat-button-top-left {
    top: 30px;
    left: 30px;
}

.chat-widget.chat-widget-position-follow-button.chat-button-center-bottom {
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
}

/* Posición del widget - CENTRO */
.chat-widget.chat-widget-position-center {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    bottom: auto !important;
    right: auto !important;
}

/* Posición del widget - PANTALLA COMPLETA */
.chat-widget.chat-widget-position-full-screen {
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    transform: none !important;
}

/* Ajustes para iconos SVG/PNG */
.chat-avatar img, .message-avatar img {
    object-fit: contain;
}

.chat-floating-btn img {
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

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

/* Header del chat */
#chatWidget .chat-widget-header {
    background: #398bde !important;
    color: white !important;
    padding: 20px !important;
    border-radius: 20px 20px 0 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-widget-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #27ae60;
    border-radius: 50%;
    display: inline-block;
}

#chatWidget .chat-widget-header .chat-widget-close,
.chat-widget .chat-widget-header .chat-widget-close,
button.chat-widget-close {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    color: #ffffff !important;
    font-size: 24px !important;
    font-weight: 300 !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

#chatWidget .chat-widget-header .chat-widget-close:hover,
.chat-widget .chat-widget-header .chat-widget-close:hover,
button.chat-widget-close:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    transform: rotate(90deg) scale(1.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

/* Cuerpo del chat */
.chat-widget-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-widget-body::-webkit-scrollbar {
    width: 6px;
}

.chat-widget-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-widget-body::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 3px;
}

/* Mensajes */
.chat-message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: #3498db !important;
}

.user-message .message-avatar {
    background: #becbd9;
}

.message-content {
    max-width: 70%;
    background: white;
    padding: 12px 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.user-message .message-content {
    background: #3498db !important;
    color: white !important;
}

.message-content p {
    margin: 0 0 5px 0;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    display: block;
}

/* Multimedia en mensajes */
.message-media {
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
}

.message-media img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}

.message-media video {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.message-media iframe {
    width: 100%;
    height: 200px;
    border: none;
    border-radius: 8px;
}

/* Indicador de escritura */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 15px;
}

.typing-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    animation: typingAnimation 1.4s infinite !important;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Footer del chat */
.chat-widget-footer {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e6ed;
    position: relative;
}

.chat-widget-footer form {
    display: flex;
    gap: 10px;
}

.chat-widget-footer input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e6ed;
    border-radius: 30px !important;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.chat-widget-footer input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-widget-footer input::placeholder {
    color: inherit;
    opacity: 0.6;
}

.chat-widget-footer input::-webkit-input-placeholder {
    color: inherit;
    opacity: 0.6;
}

.chat-widget-footer input::-moz-placeholder {
    color: inherit;
    opacity: 0.6;
}

.chat-widget-footer input:-ms-input-placeholder {
    color: inherit;
    opacity: 0.6;
}

.chat-widget-footer input:disabled {
    opacity: 0.7 !important;
    cursor: not-allowed !important;
    background-color: rgba(0, 0, 0, 0.05) !important;
    pointer-events: none !important;
}

/* Barra de acciones debajo del input */
.chat-actions-bar {
    display: flex !important;
    gap: 15px !important;
    padding: 8px 0 0 0 !important;
    justify-content: flex-start !important;
    align-items: center !important;
}

.chat-action-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border: none !important;
    cursor: pointer !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    padding: 0 !important;
}

.chat-action-btn:hover {
    opacity: 0.8 !important;
    transform: scale(1.15) !important;
}

.chat-action-btn svg {
    transition: all 0.3s ease !important;
}

.chat-action-btn svg * {
    transition: all 0.3s ease !important;
}

/* Animación de pulso para el botón de voz cuando está grabando */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
}

/* Selector de Emojis */
.emoji-picker {
    position: absolute !important;
    bottom: 100% !important;
    left: 0 !important;
    width: 350px !important;
    max-height: 350px !important;
    background: white !important;
    border: 1px solid #e0e6ed !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    margin-bottom: 10px !important;
    z-index: 1000 !important;
    overflow: hidden !important;
}

.emoji-picker-header {
    padding: 12px 15px !important;
    border-bottom: 1px solid #e0e6ed !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: #f8f9fa !important;
}

.emoji-picker-header span {
    font-size: 14px !important;
    color: #2c3e50 !important;
}

.emoji-picker-body {
    padding: 12px !important;
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 6px !important;
    max-height: 300px !important;
    overflow-y: auto !important;
}

.emoji-text-item {
    min-width: 48px !important;
    height: 36px !important;
    border: 1px solid #e0e6ed !important;
    background: white !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #2c3e50 !important;
    cursor: pointer !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px 8px !important;
    font-family: 'Courier New', monospace !important;
}

.emoji-text-item:hover {
    background: #3498db !important;
    color: white !important;
    border-color: #3498db !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3) !important;
}

.emoji-text-item:active {
    transform: translateY(0) !important;
}

#chatWidget .chat-widget-footer .chat-send-btn,
.chat-widget .chat-widget-footer .chat-send-btn,
.chat-widget-footer button.chat-send-btn,
button[type="submit"].chat-send-btn {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    min-height: 46px !important;
    background: #3498db !important;
    background-image: none !important;
    border: none !important;
    border-radius: 50% !important;
    color: #ffffff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3) !important;
}

#chatWidget .chat-widget-footer .chat-send-btn:hover,
.chat-widget .chat-widget-footer .chat-send-btn:hover,
button[type="submit"].chat-send-btn:hover {
    background: #2980b9 !important;
    background-image: none !important;
    transform: scale(1.15) rotate(15deg) !important;
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6) !important;
}

#chatWidget .chat-widget-footer .chat-send-btn:active,
button[type="submit"].chat-send-btn:active {
    transform: scale(0.95) !important;
}

#chatWidget .chat-widget-footer .chat-send-btn:disabled,
button[type="submit"].chat-send-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

#chatWidget .chat-widget-footer .chat-send-btn svg,
.chat-send-btn svg {
    width: 24px !important;
    height: 24px !important;
    fill: currentColor !important;
}

/* Info de sesión */
.chat-session-info {
    padding: 8px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e6ed;
    text-align: center;
    border-radius: 0 0 20px 20px;
}

.chat-session-info small {
    color: #7f8c8d;
    font-size: 11px;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-widget {
        width: calc(100% - 20px);
        height: calc(100% - 20px);
        bottom: 10px;
        right: 10px;
        border-radius: 12px;
    }
    
    .chat-floating-btn {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
    
    .chat-widget-header {
        border-radius: 12px 12px 0 0;
    }
    
    .chat-session-info {
        border-radius: 0 0 12px 12px;
    }
}

@media (max-width: 480px) {
    .message-content {
        max-width: 80%;
    }
}

