/* ==========================================================================
   GLOBALUNIDO ELITE AI COPILOT - CUSTOM PREMIUM INTERFACE
   ========================================================================== */

/* 🚀 Root Colors aligned with Dark Tech Palette */
:root {
    --ai-bg-glass: rgba(15, 20, 28, 0.85);
    --ai-border-glass: rgba(255, 255, 255, 0.1);
    --ai-neon-primary: #00ffd5;
    --ai-neon-secondary: #007bff;
    --ai-text-muted: rgba(255, 255, 255, 0.6);
    --ai-card-bg: rgba(255, 255, 255, 0.03);
}

/* 🔘 The Pulsing Trigger Button */
#unido-ai-trigger {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--ai-neon-primary), var(--ai-neon-secondary));
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(0, 255, 213, 0.3);
    z-index: 20001;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#unido-ai-trigger:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 12px 40px rgba(0, 255, 213, 0.5);
}

/* Ring Pulse Animation around the trigger */
#unido-ai-trigger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--ai-neon-primary);
    border-radius: 50%;
    animation: ai-pulse-ring 2s infinite;
    pointer-events: none;
}

@keyframes ai-pulse-ring {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { opacity: 0.3; }
    100% { transform: scale(1.6); opacity: 0; }
}

#unido-ai-trigger svg {
    width: 30px;
    height: 30px;
    fill: white;
    animation: ai-spin-icon 8s linear infinite;
}

@keyframes ai-spin-icon {
    100% { transform: rotate(360deg); }
}

/* 📦 The Main Glassmorphic Chat Drawer */
#unido-ai-container {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 380px;
    height: 580px;
    max-height: calc(100vh - 140px);
    background: var(--ai-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--ai-border-glass);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
    z-index: 20000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-family: 'Inter', 'Outfit', system-ui, -apple-system, sans-serif;
    color: white;
}

#unido-ai-container.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* 🔝 Top Panel Header */
.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ai-border-glass);
    background: rgba(0, 0, 0, 0.2);
}

.ai-profile-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar-glow {
    width: 36px;
    height: 36px;
    background: linear-gradient(45deg, var(--ai-neon-secondary), var(--ai-neon-primary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 0 15px rgba(0, 255, 213, 0.4);
    position: relative;
}

.ai-avatar-glow::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #00ff00;
    border-radius: 50%;
    border: 2px solid #0f141c;
}

.ai-header-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: linear-gradient(90deg, #ffffff, var(--ai-neon-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-header-info span {
    font-size: 11px;
    color: var(--ai-text-muted);
    display: block;
    margin-top: 2px;
}

.ai-header-actions button {
    background: none;
    border: none;
    color: white;
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.2s;
    font-size: 20px;
    padding: 4px;
}

.ai-header-actions button:hover {
    opacity: 1;
}

/* 📜 Scrollable Conversation Hub */
.ai-messages-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

/* Hide Scrollbar */
.ai-messages-body::-webkit-scrollbar {
    width: 4px;
}
.ai-messages-body::-webkit-scrollbar-thumb {
    background: var(--ai-border-glass);
    border-radius: 4px;
}

/* Message Bubbles */
.ai-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: ai-msg-fade 0.3s ease forwards;
}

@keyframes ai-msg-fade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--ai-neon-secondary), #0056b3);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.95);
    border-bottom-left-radius: 4px;
}

/* Markdown Formatting inside bot bubbles */
.ai-msg.bot strong {
    color: var(--ai-neon-primary);
}
.ai-msg.bot ul {
    margin: 8px 0;
    padding-left: 18px;
}
.ai-msg.bot li {
    margin-bottom: 4px;
}

/* ✨ Quick Taps Utility Row */
.ai-quick-row {
    display: flex;
    gap: 8px;
    padding: 0 20px 12px 20px;
    overflow-x: auto;
}

.ai-quick-row::-webkit-scrollbar {
    display: none;
}

.ai-quick-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--ai-border-glass);
    color: rgba(255,255,255,0.8);
    padding: 8px 14px;
    border-radius: 30px;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-quick-btn:hover {
    background: rgba(0, 255, 213, 0.1);
    border-color: var(--ai-neon-primary);
    color: white;
    transform: translateY(-1px);
}

/* ⌨️ Input Section Footer */
.ai-footer-grid {
    padding: 15px 20px 20px 20px;
    border-top: 1px solid var(--ai-border-glass);
    background: rgba(0, 0, 0, 0.15);
}

.ai-input-wrapper {
    display: flex;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--ai-border-glass);
    border-radius: 30px;
    overflow: hidden;
    padding: 4px;
    transition: border-color 0.3s;
}

.ai-input-wrapper:focus-within {
    border-color: rgba(0, 255, 213, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 213, 0.1);
}

.ai-input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: white;
    padding: 10px 16px;
    font-size: 14px;
}

.ai-input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.ai-send-btn {
    background: var(--ai-neon-primary);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(0, 255, 213, 0.4);
}

.ai-send-btn svg {
    width: 18px;
    height: 18px;
    fill: #0f141c;
}

/* 💡 Typing Indicator animation */
.ai-typing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    margin-right: 3px;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}
.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* 📱 Mobile Responsive Scale down */
@media screen and (max-width: 480px) {
    #unido-ai-container {
        width: calc(100% - 30px);
        height: calc(100% - 120px);
        bottom: 90px;
        right: 15px;
    }
}
