/* ==========================================================================
   Cybasco Native AI Advisor - Premium Brand Integration
   Obsidian & Electric Cyan Theme (Light High-Contrast Glass UI)
   ========================================================================== */

:root {
    /* ── Palette Mapping ── */
    --ai-bg-color: #ffffff;
    --ai-panel-bg: #ffffff; /* Solid White BG as requested to prevent blending */
    --ai-border: rgba(0, 0, 0, 0.08);
    --ai-text-primary: #0D1117; /* Obsidian Dark */
    --ai-text-secondary: #4b5563; /* Charcoal */
    --ai-accent: #00C2FF; /* Electric Cyan */
    --ai-accent-hover: #0099cc;
    --ai-msg-user-bg: rgba(0, 194, 255, 0.06); /* Cyber Blue Tint */
    --ai-msg-system-bg: transparent;
    --ai-msg-assistant-bg: #f3f4f6; /* Standard contrasting light-grey bubble */
    --ai-shadow: 0 16px 48px rgba(0, 0, 0, 0.16); /* Intense drop-shadow to separate from content */
    --ai-radius: 20px;
    --ai-font: 'Inter', -apple-system, sans-serif;
}

/* --- Launcher Button --- */
.cybasco-ai-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00C2FF, #7B5EA7); /* Matches site's Electric Gradient */
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 24px rgba(0, 194, 255, 0.25);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.cybasco-ai-launcher:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 28px rgba(0, 194, 255, 0.35);
}

.ai-launcher-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ff3b30;
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
}

/* --- Chat Window --- */
.cybasco-ai-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-height: 70vh;
    height: 600px;
    background: var(--ai-panel-bg);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius);
    box-shadow: var(--ai-shadow);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    font-family: var(--ai-font);
    overflow: hidden;
    
    /* Hidden state */
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

/* --- Header --- */
.ai-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--ai-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0D1117; /* Obsidian Header for extreme contrasting split-view */
    color: #ffffff;
}

.ai-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(0, 194, 255, 0.1);
    color: var(--ai-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid rgba(0, 194, 255, 0.25);
}

.ai-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
}

.ai-status {
    font-size: 11px;
    color: #4cd964;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ai-status::before {
    content: '';
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #4cd964;
}

.ai-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}
.ai-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* --- Messages Area --- */
.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    background: #ffffff;
}

.ai-messages::-webkit-scrollbar {
    width: 5px;
}
.ai-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.ai-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: aiFadeIn 0.3s ease forwards;
}

.ai-message.user {
    align-self: flex-end;
}

.ai-message.assistant, .ai-message.system {
    align-self: flex-start;
}

.ai-message-content {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--ai-text-primary);
    word-break: break-word;
}

.ai-message.user .ai-message-content {
    background: var(--ai-msg-user-bg);
    border: 1px solid rgba(0, 194, 255, 0.15);
    border-bottom-right-radius: 4px;
    color: #0D1117;
}

.ai-message.assistant .ai-message-content {
    background: var(--ai-msg-assistant-bg);
    border: 1px solid var(--ai-border);
    border-bottom-left-radius: 4px;
}

.ai-message.system .ai-message-content {
    background: transparent;
    border: 1px dashed var(--ai-border);
    color: var(--ai-text-secondary);
    font-size: 12.5px;
    font-style: italic;
    border-radius: 8px;
}

.ai-text-content p {
    margin: 0 0 8px 0;
}
.ai-text-content p:last-child {
    margin: 0;
}
.ai-text-content a {
    color: var(--ai-accent);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}
.ai-text-content a:hover {
    border-color: var(--ai-accent);
}
.ai-text-content pre {
    background: #111;
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 12px;
    border: 1px solid var(--ai-border);
    margin: 8px 0;
}
.ai-text-content code {
    font-family: monospace;
    background: #f3f4f6;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 12px;
    color: #7B5EA7;
}

/* --- Typing Indicator --- */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--ai-msg-assistant-bg);
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    margin-left: 20px;
    margin-bottom: 20px;
    width: fit-content;
}

.ai-typing-indicator span {
    display: block;
    width: 6px;
    height: 6px;
    background: var(--ai-text-secondary);
    border-radius: 50%;
    animation: aiTyping 1.4s infinite ease-in-out both;
}

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

/* --- Input Area --- */
.ai-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--ai-border);
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: #f9fafb; /* Soft light-grey layout divider */
}

.ai-input-area textarea {
    flex: 1;
    background: #ffffff;
    border: 1px solid var(--ai-border);
    border-radius: 8px;
    padding: 12px;
    color: var(--ai-text-primary);
    font-family: var(--ai-font);
    font-size: 13.5px;
    resize: none;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-input-area textarea:focus {
    border-color: var(--ai-accent);
    box-shadow: 0 0 0 2px rgba(0, 194, 255, 0.15);
}

.ai-input-area textarea::placeholder {
    color: #9ca3af;
}

.ai-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--ai-accent);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.ai-send-btn:hover {
    background: var(--ai-accent-hover);
}
.ai-send-btn:active {
    transform: scale(0.95);
}

/* --- Rich Cards --- */
.ai-rich-cards-container {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-rich-card {
    background: #ffffff;
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.ai-card-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.ai-card-body {
    padding: 16px;
}
.ai-card-body h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    color: var(--ai-text-primary);
    font-weight: 600;
}
.ai-card-body p {
    margin: 0 0 16px 0;
    font-size: 12.5px;
    color: var(--ai-text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-card-price {
    font-weight: 700;
    color: #7B5EA7; /* Brand Purple for pricing highlights */
    font-size: 13.5px;
}

.ai-btn-small {
    background: rgba(0, 194, 255, 0.1);
    color: #0081ab;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}
.ai-btn-small:hover {
    background: var(--ai-accent);
    color: #ffffff;
}

/* Lead Capture Form */
.ai-lead-card {
    background: rgba(0, 194, 255, 0.03);
    border: 1px solid rgba(0, 194, 255, 0.15);
}
.ai-lead-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ai-lead-form input {
    background: #ffffff;
    border: 1px solid var(--ai-border);
    padding: 10px;
    border-radius: 6px;
    color: var(--ai-text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.ai-lead-form input:focus {
    border-color: var(--ai-accent);
}
.ai-btn-primary {
    background: var(--ai-accent);
    color: #ffffff;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}
.ai-btn-primary:hover {
    background: var(--ai-accent-hover);
}
.ai-lead-success {
    color: #4cd964;
    font-size: 13.5px;
    font-weight: 600;
    text-align: center;
    padding: 10px 0;
}

/* Animations */
@keyframes aiFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Responsive */
@media (max-width: 480px) {
    .cybasco-ai-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }
    .cybasco-ai-launcher {
        bottom: 20px;
        right: 20px;
    }
}
