/* ============================================================================
   Stemp Chat Widget - Widget de chat conversacional para ventas
   ============================================================================ */

/* Modo widget flotante */
.stemp-chat-widget {
    position: fixed;
    bottom: 96px;
    left: 24px;
    z-index: 9998;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Modo integrado desplegado */
.stemp-chat-integrated {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.stemp-chat-integrated .stemp-chat-panel {
    position: static !important;
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
    pointer-events: auto !important;
    width: 100% !important;
    height: 100% !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background: white;
}

.stemp-chat-integrated .stemp-chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 20px !important;
    background: #f9f9f9 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

.stemp-chat-integrated .stemp-chat-input-area {
    flex-shrink: 0 !important;
    padding: 16px !important;
    background: white !important;
    border-top: 1px solid #E0E0E0 !important;
}

/* Botón flotante chat */
.stemp-chat-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B35 0%, #FF4500 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stemp-chat-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.6);
}

.stemp-chat-trigger:active {
    transform: scale(0.95);
}

.stemp-chat-trigger::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 107, 53, 0.3);
    animation: pulse-chat 2s infinite;
}

@keyframes pulse-chat {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 0;
    }
}

.stemp-chat-trigger svg {
    width: 28px;
    height: 28px;
    fill: white;
    position: relative;
    z-index: 1;
}

/* Panel de chat */
.stemp-chat-panel {
    position: absolute;
    bottom: 88px;
    left: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stemp-chat-panel.active,
.stemp-chat-integrated .stemp-chat-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    pointer-events: auto;
}

.stemp-chat-header {
    background: linear-gradient(135deg, #FF6B35 0%, #FF4500 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.stemp-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat messages area */
.stemp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9f9f9;
}

.stemp-chat-message {
    display: flex;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

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

.stemp-chat-message.user {
    justify-content: flex-end;
}

.stemp-chat-message-content {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.stemp-chat-message.user .stemp-chat-message-content {
    background: linear-gradient(135deg, #FF6B35 0%, #FF4500 100%);
    color: white;
}

.stemp-chat-message.assistant .stemp-chat-message-content {
    background: #E0E0E0;
    color: #333;
}

.stemp-chat-message.typing .stemp-chat-message-content {
    background: #E0E0E0;
    display: flex;
    gap: 4px;
    padding: 10px 14px;
}

.stemp-chat-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: bounce-chat 1.4s infinite;
}

.stemp-chat-dot:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes bounce-chat {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-8px);
    }
}

/* Input area */
.stemp-chat-input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid #E0E0E0;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.stemp-chat-input {
    flex: 1;
    border: 1px solid #E0E0E0;
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.stemp-chat-input:focus {
    border-color: #FF6B35;
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.1);
}

.stemp-chat-send {
    background: linear-gradient(135deg, #FF6B35 0%, #FF4500 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
}

.stemp-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

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

/* Responsive */
@media (max-width: 480px) {
    .stemp-chat-widget {
        bottom: 88px;
        left: 16px;
    }

    .stemp-chat-trigger {
        width: 56px;
        height: 56px;
    }

    .stemp-chat-trigger svg {
        width: 26px;
        height: 26px;
    }

    .stemp-chat-panel {
        width: calc(100vw - 40px);
        max-width: 320px;
        height: 400px;
        bottom: 80px;
    }
}
