/* ========================================
   IDeaz Chatbot - Widget Styles
   ======================================== */

:root {
    --ideaz-primary: #4F46E5;
    --ideaz-primary-dark: #4338CA;
    --ideaz-success: #10B981;
    --ideaz-text: #1F2937;
    --ideaz-text-light: #6B7280;
    --ideaz-bg-light: #F9FAFB;
    --ideaz-border: #E5E7EB;
    --ideaz-shadow: 0 10px 25px rgba(0,0,0,0.1);
    --ideaz-shadow-lg: 0 20px 60px rgba(0,0,0,0.15);
}

/* Widget Container */
#ideaz-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ========================================
   Trigger Button (Globito flotante)
   ======================================== */
.ideaz-trigger {
    position: relative;
    width: 80px;
    height: 100px;
    border-radius: 10%;
    background: var(--ideaz-primary);
    cursor: pointer;
    box-shadow: var(--ideaz-shadow);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ideaz-trigger:hover {
    transform: scale(1.05);
    box-shadow: var(--ideaz-shadow-lg);
}

/* Ocultar trigger cuando el chat está abierto */
.ideaz-trigger.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

/* Video Loop */
.ideaz-video-loop {
   width: 80px;
    height: 100px;
    object-fit: cover;
    border-radius: 10%;
}

/* Avatar Fallback (si no hay video) */
.ideaz-avatar {
    font-size: 36px;
    color: white;
}

/* Pulse Ring Animation */
.ideaz-pulse {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 3px solid var(--ideaz-primary);
    border-radius: 50%;
    animation: pulse 2s infinite;
    pointer-events: none;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   Chat Window
   ======================================== */
.ideaz-chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--ideaz-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    transform-origin: bottom right;
}

/* Animación de entrada */
.ideaz-chat-window.opening {
    animation: slideUp 0.3s ease;
}

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

/* Animación de salida */
.ideaz-chat-window.closing {
    animation: slideDown 0.3s ease;
}

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

/* ========================================
   Header
   ======================================== */
.ideaz-header {
    background: linear-gradient(135deg, var(--ideaz-primary), var(--ideaz-primary-dark));
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ideaz-agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ideaz-agent-avatar {
    position: relative;
}

.ideaz-agent-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
}

.ideaz-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: var(--ideaz-success);
    border: 2px solid white;
    border-radius: 50%;
}

.ideaz-agent-details {
    display: flex;
    flex-direction: column;
}

.ideaz-agent-details strong {
    font-size: 16px;
    font-weight: 600;
}

.ideaz-status-text {
    font-size: 12px;
    opacity: 0.9;
}

/* Botón X para minimizar */
.ideaz-minimize-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
}

.ideaz-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   Messages Container
   ======================================== */
.ideaz-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--ideaz-bg-light);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ideaz-messages::-webkit-scrollbar {
    width: 6px;
}

.ideaz-messages::-webkit-scrollbar-thumb {
    background: var(--ideaz-border);
    border-radius: 3px;
}

/* ========================================
   Messages
   ======================================== */
.ideaz-message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

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

.ideaz-message.bot {
    align-self: flex-start;
}

.ideaz-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ideaz-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ideaz-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.ideaz-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.ideaz-message.bot .ideaz-message-content {
    background: white;
    color: var(--ideaz-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ideaz-message.user .ideaz-message-content {
    background: var(--ideaz-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* ========================================
   Typing Indicator (Escribiendo...)
   ======================================== */
.ideaz-typing-indicator {
    display: flex;
    gap: 10px;
    padding: 0 20px 10px 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ideaz-typing-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ideaz-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.ideaz-typing-content {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ideaz-typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.ideaz-typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--ideaz-primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* ========================================
   Input Area
   ======================================== */
.ideaz-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid var(--ideaz-border);
    display: flex;
    gap: 12px;
}

.ideaz-user-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--ideaz-border);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.ideaz-user-input:focus {
    border-color: var(--ideaz-primary);
}

.ideaz-send-btn {
    width: 44px;
    height: 44px;
    background: var(--ideaz-primary);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.ideaz-send-btn:hover {
    background: var(--ideaz-primary-dark);
}

.ideaz-send-btn:active {
    transform: scale(0.95);
}

/* ========================================
   Powered By
   ======================================== */
.ideaz-powered {
    padding: 8px 16px;
    text-align: center;
    font-size: 11px;
    color: var(--ideaz-text-light);
    background: var(--ideaz-bg-light);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 480px) {
    .ideaz-chat-window {
        width: 100%;
        height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .ideaz-trigger {
        width: 60px;
        height: 60px;
    }
}
