/* ===== SWIFTSYNC AI ASSISTANT STYLES ===== */

/* Import theme variables */
:root {
    --bg-dark: #050505;
    --bg-card: #121212;
    --primary: #00f3ff;
    --secondary: #bc13fe;
    --accent: #1e90ff;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --glass: rgba(255, 255, 255, 0.05);
    --border-glow: 0 0 10px rgba(0, 243, 255, 0.5);
}

/* =========================================
   1. AI TRIGGER BUTTON (KEPT EXACTLY AS IS)
   ========================================= */
.swiftsync-ai-trigger {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    
    /* Glassmorphism Tab Style */
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    
    /* Neon Borders */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-right: none; /* Docked to edge */
    border-left: 3px solid var(--primary); /* Accent line */
    
    padding: 25px 12px;
    border-radius: 20px 0 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    
    cursor: pointer;
    z-index: 9998;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    
    /* Typography */
    font-family: 'Space Grotesk', sans-serif; /* Matching site font */
    color: var(--text-main);
    overflow: visible;
}

/* Hover Effects */
.swiftsync-ai-trigger:hover {
    padding-right: 20px; /* Slide out interaction */
    background: rgba(10, 10, 15, 0.9);
    box-shadow: -15px 0 50px rgba(0, 243, 255, 0.2);
    border-left-color: var(--secondary); /* Gradient shift effect */
}

/* Icon Container */
.ai-icon-wrapper {
    position: relative;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 243, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.swiftsync-ai-trigger:hover .ai-icon-wrapper {
    background: var(--gradient);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
}

.ai-icon {
    font-size: 24px;
    color: var(--primary);
    transition: color 0.3s;
    z-index: 2;
}

.swiftsync-ai-trigger:hover .ai-icon {
    color: #fff;
}

/* Pulse Animation Ring */
.ai-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid var(--primary);
    opacity: 0;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* Vertical Text styling */
.ai-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* Mobile Responsive Design for Trigger */
@media (max-width: 768px) {
    .swiftsync-ai-trigger {
        top: auto;
        bottom: 30px;
        right: 20px;
        transform: none;
        flex-direction: row;
        border-radius: 50px;
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-left: none;
        border-bottom: 2px solid var(--primary);
        padding: 12px 24px;
        background: rgba(15, 15, 20, 0.85);
        backdrop-filter: blur(20px);
    }
    
    .swiftsync-ai-trigger:hover {
        transform: translateY(-5px);
        padding-right: 24px; 
    }
    
    .ai-text {
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 14px;
        margin-left: 10px;
        letter-spacing: 1px;
    }
    
    .ai-icon-wrapper { width: 32px; height: 32px; }
    .ai-icon { font-size: 18px; }
}


/* =========================================
   2. AI MODAL (REDESIGNED)
   ========================================= */

.swiftsync-ai-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.swiftsync-ai-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Content Wrapper */
.ai-modal-content {
    width: 100%;
    max-width: 480px;
    height: 85vh;
    max-height: 700px;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.swiftsync-ai-modal.active .ai-modal-content {
    transform: scale(1) translateY(0);
}

/* Main Container - The "Card" */
.ai-container {
    width: 100%;
    height: 100%;
    background: rgba(18, 18, 24, 0.95);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 0 40px rgba(0, 243, 255, 0.15); /* Neon glow */
}

/* Top Border Gradient Accent */
.ai-container::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient);
    z-index: 10;
    box-shadow: 0 0 15px var(--primary);
}

/* ===== HEADER ===== */
.ai-header {
    padding: 18px 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ai-avatar {
    width: 42px;
    height: 42px;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 12px; /* Slight squircle */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ai-avatar i {
    font-size: 24px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #00ff88;
    border-radius: 50%;
    border: 2px solid #121218;
    box-shadow: 0 0 8px #00ff88;
    animation: blink 3s infinite;
}

.ai-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.ai-status {
    font-size: 0.8rem;
    color: var(--primary);
    opacity: 0.8;
    display: block;
    margin-top: 2px;
}

.ai-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    transform: rotate(90deg);
}

/* ===== QUICK ACTIONS ===== */
.ai-quick-actions {
    padding: 15px 20px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    scrollbar-width: none; /* Hide scrollbar Firefox */
}

.ai-quick-actions::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome */

.quick-btn {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-body);
}

.quick-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--primary);
    color: var(--text-main);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
    transform: translateY(-2px);
}

.quick-btn i {
    font-size: 18px;
    color: var(--secondary);
}

.quick-btn:hover i {
    color: var(--primary);
}

/* ===== CHAT AREA ===== */
.ai-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(0, 243, 255, 0.03) 0%, transparent 50%);
}

/* Custom Scrollbar */
.ai-chat-area::-webkit-scrollbar { width: 5px; }
.ai-chat-area::-webkit-scrollbar-track { background: transparent; }
.ai-chat-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

/* Welcome Screen inside Chat */
.ai-welcome {
    text-align: center;
    margin: auto 0;
    padding: 20px;
    animation: fadeIn 0.8s ease;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.1), rgba(188, 19, 254, 0.1));
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.1);
}

.welcome-icon i {
    font-size: 40px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ai-welcome h4 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-main);
}

.ai-welcome p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 320px;
    margin: 0 auto;
}

/* Chat Messages */
.chat-message {
    display: flex;
    gap: 15px;
    animation: slideUp 0.3s ease;
    max-width: 100%;
}

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

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

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

.message-avatar.ai {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--primary);
}

.message-avatar.user {
    background: var(--gradient);
    color: white;
    box-shadow: 0 0 10px rgba(188, 19, 254, 0.4);
}

.message-bubble {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.6;
    position: relative;
}

/* AI Bubble Style */
.message-bubble.ai {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border-top-left-radius: 4px;
    border-left: 2px solid var(--primary); /* Neon accent */
}

/* User Bubble Style */
.message-bubble.user {
    background: var(--gradient);
    color: white;
    border-top-right-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 243, 255, 0.15);
}

.message-time {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
    margin-top: 6px;
    display: block;
    text-align: right;
}

.chat-message.ai .message-time { text-align: left; }

/* Typing Animation */
.typing-indicator {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    padding-left: 10px;
}

.typing-dots {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 12px 16px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

@keyframes typingBounce {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(-4px); opacity: 1; background: var(--primary); }
}

/* ===== INPUT AREA ===== */
.ai-input-area {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 6px 6px 6px 16px;
    transition: all 0.3s;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.15), inset 0 2px 10px rgba(0,0,0,0.5);
    background: rgba(0, 0, 0, 0.6);
}

#userInput {
    flex: 1;
    background: none;
    border: none;
    color: white;
    font-size: 0.95rem;
    font-family: var(--font-body);
    resize: none;
    outline: none;
    max-height: 100px;
    padding: 10px 0;
    line-height: 1.5;
}

#userInput::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.send-btn {
    width: 42px;
    height: 42px;
    background: var(--gradient);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 243, 255, 0.2);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.5);
}

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

.send-btn i {
    color: white;
    font-size: 20px;
    margin-left: 2px; /* Visual centering */
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 0.7rem;
    padding: 0 5px;
}

.char-count { color: var(--text-muted); opacity: 0.7; }

.ai-badge {
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.8;
    font-weight: 500;
}

.ai-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary);
}

/* Mobile responsive */
@media (max-width: 576px) {
    .ai-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        transform: none;
    }
    
    .ai-container {
        border-radius: 0;
        border: none;
    }
    
    .ai-header { padding: 15px; }
    .ai-chat-area { padding: 15px; }
    .ai-input-area { padding: 15px; }
}