/* Estilos para el Widget de Asistente IA (Gemini) */

#ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

#ai-chat-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0.9;
}

.ai-btn-text {
    background: var(--primary, #ff6b00);
    color: white;
    padding: 8px 25px 8px 16px;
    border-radius: 20px 0 0 20px;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: -2px 4px 10px rgba(0,0,0,0.15);
    animation: aiPulse 2s infinite;
    margin-right: -15px;
    position: relative;
    z-index: 1;
}

.ai-btn-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary, #ff6b00);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: aiPulse 2s infinite;
    position: relative;
    z-index: 2;
}

@keyframes aiPulse {
    0% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb, 255,107,0), 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(var(--primary-rgb, 255,107,0), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb, 255,107,0), 0); }
}

#ai-chat-btn:hover {
    transform: scale(1.05);
    opacity: 1;
}

#ai-chat-btn:hover .ai-btn-text,
#ai-chat-btn:hover .ai-btn-icon {
    background: var(--primary-hover, #e05e00);
    animation: none;
}

#ai-chat-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    border: 1px solid #e2e8f0;
}

#ai-chat-panel.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

#ai-chat-header {
    background: var(--primary, #ff6b00);
    color: #ffffff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

#ai-chat-header:active {
    cursor: grabbing;
}

#ai-chat-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    line-height: 1;
}

#ai-chat-close:hover {
    opacity: 1;
}

#ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.ai-msg, .user-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

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

.ai-msg {
    align-self: flex-start;
    background: #ffffff;
    color: var(--secondary, #0f172a);
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.user-msg {
    align-self: flex-end;
    background: var(--primary, #ff6b00);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 4px rgba(var(--primary-rgb, 255,107,0), 0.2);
}

#ai-chat-input-area {
    padding: 15px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

#ai-chat-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

#ai-chat-input:focus {
    border-color: var(--primary, #ff6b00);
}

#ai-chat-send {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary, #ff6b00);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s, transform 0.1s;
}

#ai-chat-send:hover {
    background: var(--primary-hover, #e05e00);
}

#ai-chat-send:active {
    transform: scale(0.95);
}

.ai-typing {
    display: flex;
    gap: 5px;
    padding: 15px 20px;
    align-self: flex-start;
    background: transparent;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.ai-typing span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Scrollbar styling for webkit */
#ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}
#ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
#ai-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
#ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

@media (max-width: 480px) {
    #ai-chat-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0;
        transform: translateY(100%);
    }
    #ai-chat-panel.active {
        transform: translateY(0);
    }
}
