/* ═══════════════════════════════════════════════════════════════════════════
   LIQUID GLASS - Premium Chatbot Widget
   A distinctive, organic interface with fluid animations and depth
   ═══════════════════════════════════════════════════════════════════════════ */

/* Font imports - Satoshi for UI, Fraunces for elegant accents */
@import url('https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600&display=swap');

/* ─────────────────────────────────────────────────────────────────────────────
   CSS Custom Properties - The DNA of our design system
   ───────────────────────────────────────────────────────────────────────────── */
:root {
    /* Core brand colors with vibrant defaults */
    --primary-color: #10B981;
    --primary-light: #34D399;
    --primary-dark: #059669;
    --secondary-color: #06B6D4;
    --accent-color: #F59E0B;

    /* Sophisticated neutrals */
    --bg-deep: #0a0a0f;
    --bg-elevated: #12121a;
    --bg-surface: #1a1a24;
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);

    /* Text hierarchy */
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-inverse: #18181b;

    /* Glass morphism effects - tuned for readability */
    --glass-bg: rgba(20, 20, 28, 0.85);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glass-blur: 12px;

    /* Gradient background (dark theme default) */
    --bg-from: #0a0a0f;
    --bg-to: #0f172a;

    /* Dimensions */
    --window-width: 100%;
    --window-height: 100vh;
    --window-border-radius: 0px;
    --message-border-radius: 20px;
    --input-border-radius: 16px;
    --launcher-size: 64px;

    /* Mobile handling */
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --mobile-nav-height: 0px;

    /* Animation timing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --duration-fast: 0.2s;
    --duration-normal: 0.4s;
    --duration-slow: 0.8s;

    /* Message styling */
    --user-message-bg: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --assistant-message-bg: var(--bg-surface);
    --send-button-bg: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

/* Light theme overrides */
[data-theme="light"] {
    --bg-deep: #fafafa;
    --bg-elevated: #ffffff;
    --bg-surface: #f4f4f5;
    --bg-glass: rgba(255, 255, 255, 0.92);
    --bg-glass-hover: rgba(255, 255, 255, 0.96);
    --bg-from: #ffffff;
    --bg-to: #f0f4f8;

    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #71717a;

    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);

    --assistant-message-bg: #ffffff;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Base Reset & Typography
   ───────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(165deg, var(--bg-from) 0%, var(--bg-to) 100%);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Animated Background - Morphing Organic Blobs
   ───────────────────────────────────────────────────────────────────────────── */
.chatbot-bg-effects {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.25;
    animation: blob-morph 30s ease-in-out infinite;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--secondary-color) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
    animation-delay: -8s;
}

.blob-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -16s;
    opacity: 0.2;
}

@keyframes blob-morph {
    0%, 100% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        border-radius: 50%;
    }
    25% {
        transform: translate(30px, -50px) scale(1.1) rotate(90deg);
        border-radius: 60% 40% 70% 30%;
    }
    50% {
        transform: translate(-20px, 30px) scale(0.95) rotate(180deg);
        border-radius: 40% 60% 30% 70%;
    }
    75% {
        transform: translate(50px, 20px) scale(1.05) rotate(270deg);
        border-radius: 70% 30% 50% 50%;
    }
}

/* Noise texture overlay - very subtle */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ─────────────────────────────────────────────────────────────────────────────
   Main Container - The Glass Card
   ───────────────────────────────────────────────────────────────────────────── */
.chatbot-container {
    position: relative;
    z-index: 10;
    width: var(--window-width);
    height: var(--window-height);
    max-height: 100dvh;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: var(--window-border-radius);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    animation: container-enter var(--duration-slow) var(--ease-out-expo);
}

@keyframes container-enter {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Header - Elegant Glass Panel
   ───────────────────────────────────────────────────────────────────────────── */
.chatbot-header {
    position: relative;
    padding: 20px 24px;
    background: rgba(18, 18, 26, 0.95);
    border-bottom: 1px solid var(--glass-border);
}

[data-theme="light"] .chatbot-header {
    background: rgba(255, 255, 255, 0.98);
}

/* Animated gradient border effect */
.chatbot-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--primary-color) 20%,
        var(--secondary-color) 50%,
        var(--primary-color) 80%,
        transparent 100%
    );
    opacity: 0.5;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

.header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    animation: header-slide 0.6s var(--ease-out-expo) 0.2s backwards;
}

@keyframes header-slide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
}

.header-icon {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 20px rgba(16, 185, 129, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform var(--duration-normal) var(--ease-spring);
    overflow: hidden;
}

/* Shine effect on icon */
.header-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.3) 0%,
        transparent 50%
    );
    border-radius: inherit;
}

.header-icon:hover {
    transform: scale(1.08) rotate(5deg);
}

.bot-icon {
    width: 26px;
    height: 26px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header-text {
    flex: 1;
    min-width: 0;
}

.header-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2px;
}

.header-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Header action buttons */
.header-actions {
    display: flex;
    gap: 8px;
}

.clear-btn,
.mobile-close-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) var(--ease-out-expo);
    color: var(--text-secondary);
}

.clear-btn:hover,
.mobile-close-btn:hover {
    background: var(--bg-glass-hover);
    transform: scale(1.05);
    color: var(--text-primary);
}

.clear-btn:active,
.mobile-close-btn:active {
    transform: scale(0.95);
}

.clear-icon {
    width: 18px;
    height: 18px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Messages Area - Conversation Flow
   ───────────────────────────────────────────────────────────────────────────── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    padding-bottom: 32px;
    scroll-behavior: smooth;
    position: relative;
    min-height: 0;
}

/* Custom scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 3px;
    transition: background var(--duration-fast);
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Message Bubbles - The Heart of Conversation
   ───────────────────────────────────────────────────────────────────────────── */
.message {
    display: flex;
    margin-bottom: 20px;
    animation: message-enter 0.5s var(--ease-out-back);
}

@keyframes message-enter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message-user {
    justify-content: flex-end;
}

.message-assistant {
    justify-content: flex-start;
}

.message-bubble {
    position: relative;
    max-width: 80%;
    padding: 14px 18px;
    border-radius: var(--message-border-radius);
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    transition: transform var(--duration-fast) var(--ease-out-expo);
}

.message-bubble:hover {
    transform: scale(1.01);
}

/* User message - Vibrant gradient */
.message-user .message-bubble {
    background: var(--user-message-bg);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow:
        0 4px 20px rgba(16, 185, 129, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Shine effect on user bubble */
.message-user .message-bubble::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.15) 0%,
        transparent 50%
    );
    pointer-events: none;
}

/* Assistant message - Solid card for readability */
.message-assistant .message-bubble {
    background: var(--assistant-message-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .message-assistant .message-bubble {
    background: rgba(30, 32, 44, 0.95);
}

/* Avatar styling */
.message-avatar {
    flex-shrink: 0;
    margin-right: 12px;
}

.message-user .message-avatar {
    order: 2;
    margin-right: 0;
    margin-left: 12px;
}

.avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--glass-border);
    background: var(--bg-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Streaming indicator */
.message-streaming::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        opacity: 0.5;
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Welcome Screen - First Impression
   ───────────────────────────────────────────────────────────────────────────── */
.welcome-screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.welcome-content {
    max-width: 420px;
    text-align: center;
}

.welcome-icon {
    position: relative;
    width: 88px;
    height: 88px;
    margin: 0 auto 28px;
    border-radius: 28px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 40px rgba(16, 185, 129, 0.35),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
    animation: welcome-icon-entrance 0.8s var(--ease-out-back) 0.3s backwards;
}

@keyframes welcome-icon-entrance {
    from {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
}

/* Orbiting ring around welcome icon */
.welcome-icon::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 32px;
    border: 2px dashed var(--primary-light);
    opacity: 0.4;
    animation: orbit 20s linear infinite;
}

@keyframes orbit {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sparkles-icon {
    width: 44px;
    height: 44px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.welcome-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 8px;
    animation: welcome-text-enter 0.6s var(--ease-out-expo) 0.5s backwards;
}

.welcome-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 36px;
    animation: welcome-text-enter 0.6s var(--ease-out-expo) 0.6s backwards;
}

@keyframes welcome-text-enter {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
}

/* Suggested Questions - Interactive Cards */
.suggested-questions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.question-btn {
    position: relative;
    background: rgba(30, 32, 44, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 20px;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all var(--duration-normal) var(--ease-out-expo);
    overflow: hidden;
    animation: question-enter 0.5s var(--ease-out-back) backwards;
}

[data-theme="light"] .question-btn {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.08);
}

.question-btn:nth-child(1) { animation-delay: 0.7s; }
.question-btn:nth-child(2) { animation-delay: 0.8s; }
.question-btn:nth-child(3) { animation-delay: 0.9s; }
.question-btn:nth-child(4) { animation-delay: 1.0s; }

@keyframes question-enter {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
}

/* Gradient hover effect */
.question-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity var(--duration-normal);
}

.question-btn:hover {
    transform: translateY(-3px) scale(1.02);
    border-color: var(--primary-color);
    box-shadow:
        0 8px 32px rgba(16, 185, 129, 0.15),
        0 0 0 1px var(--primary-color);
}

.question-btn:hover::before {
    opacity: 0.08;
}

.question-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.question-icon {
    position: relative;
    z-index: 1;
    width: 36px;
    height: 36px;
    padding: 8px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.15));
    color: var(--primary-color);
    flex-shrink: 0;
    transition: transform var(--duration-fast);
}

.question-btn:hover .question-icon {
    transform: rotate(-5deg) scale(1.1);
}

.question-btn span {
    position: relative;
    z-index: 1;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Scroll to Bottom Button
   ───────────────────────────────────────────────────────────────────────────── */
.scroll-to-bottom {
    position: absolute;
    bottom: 100px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 20px rgba(16, 185, 129, 0.2),
        var(--glass-shadow);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all var(--duration-fast) var(--ease-spring);
    animation: bounce-in 0.4s var(--ease-out-back);
    z-index: 10;
}

@keyframes bounce-in {
    from {
        opacity: 0;
        transform: scale(0) translateY(20px);
    }
}

.scroll-to-bottom:hover {
    transform: scale(1.1);
    box-shadow:
        0 6px 24px rgba(16, 185, 129, 0.3),
        0 0 0 4px rgba(16, 185, 129, 0.1);
}

.scroll-to-bottom:active {
    transform: scale(0.95);
}

.scroll-icon {
    width: 20px;
    height: 20px;
    animation: bounce-arrow 2s ease-in-out infinite;
}

@keyframes bounce-arrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Input Area - Where the Magic Begins
   ───────────────────────────────────────────────────────────────────────────── */
.chatbot-input {
    position: relative;
    padding: 20px 24px;
    padding-bottom: calc(20px + var(--safe-area-bottom));
    background: rgba(18, 18, 26, 0.95);
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
    z-index: 10;
    animation: input-enter 0.6s var(--ease-out-expo) 0.4s backwards;
}

[data-theme="light"] .chatbot-input {
    background: rgba(255, 255, 255, 0.98);
}

@keyframes input-enter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* Animated gradient border on top */
.chatbot-input::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--primary-color),
        var(--secondary-color),
        var(--primary-color),
        transparent
    );
    opacity: 0.4;
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.message-input {
    flex: 1;
    border: 2px solid var(--glass-border);
    border-radius: var(--input-border-radius);
    padding: 14px 18px;
    font-family: 'Satoshi', sans-serif;
    font-size: 15px;
    font-weight: 500;
    background: rgba(10, 10, 15, 0.6);
    color: var(--text-primary);
    resize: none;
    min-height: 52px;
    max-height: 140px;
    line-height: 1.5;
    transition: all var(--duration-fast) var(--ease-out-expo);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

[data-theme="light"] .message-input {
    background: rgba(0, 0, 0, 0.04);
}

.message-input::-webkit-scrollbar {
    display: none;
}

.message-input::placeholder {
    color: var(--text-muted);
}

.message-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(10, 10, 15, 0.8);
    box-shadow:
        0 0 0 4px rgba(16, 185, 129, 0.15),
        0 4px 20px rgba(16, 185, 129, 0.1);
}

[data-theme="light"] .message-input:focus {
    background: rgba(255, 255, 255, 1);
}

/* Send button - Prominent CTA */
.send-btn {
    position: relative;
    border: none;
    border-radius: var(--input-border-radius);
    padding: 14px 24px;
    background: var(--send-button-bg);
    color: white;
    font-family: 'Satoshi', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    transition: all var(--duration-fast) var(--ease-spring);
    box-shadow:
        0 4px 20px rgba(16, 185, 129, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

/* Shine animation on send button */
.send-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s;
}

.send-btn:hover:not(:disabled)::before {
    left: 100%;
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow:
        0 6px 28px rgba(16, 185, 129, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.send-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.send-icon {
    width: 18px;
    height: 18px;
    transition: transform var(--duration-fast);
}

.send-btn:hover:not(:disabled) .send-icon {
    transform: translateX(2px) rotate(-5deg);
}

.send-text {
    font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Loading Overlay
   ───────────────────────────────────────────────────────────────────────────── */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 1000;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 3px solid var(--glass-border);
    border-left: 3px solid var(--primary-color);
    border-top: 3px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Processing Tools Indicator
   ───────────────────────────────────────────────────────────────────────────── */
.processing-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-top: 10px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(6, 182, 212, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    font-size: 13px;
    color: var(--primary-color);
    animation: processing-enter 0.3s var(--ease-out-expo);
}

@keyframes processing-enter {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
}

.processing-dots {
    display: flex;
    gap: 5px;
}

.processing-dots span {
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: processing-dot 1.4s ease-in-out infinite;
}

.processing-dots span:nth-child(2) { animation-delay: 0.2s; }
.processing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes processing-dot {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.4;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Markdown Content Styling
   ───────────────────────────────────────────────────────────────────────────── */
.markdown-h1, .markdown-h2, .markdown-h3,
.markdown-h4, .markdown-h5, .markdown-h6 {
    font-family: 'Fraunces', Georgia, serif;
    color: var(--text-primary);
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    line-height: 1.3;
}

.markdown-h1 { font-size: 1.75em; font-weight: 600; }
.markdown-h2 { font-size: 1.5em; font-weight: 600; }
.markdown-h3 { font-size: 1.25em; font-weight: 600; }
.markdown-h4, .markdown-h5, .markdown-h6 { font-size: 1.1em; font-weight: 600; }

.markdown-p {
    margin: 0.8em 0;
}

.markdown-hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
    margin: 1.5em 0;
}

.markdown-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color var(--duration-fast);
}

.markdown-link:hover {
    border-color: var(--primary-color);
}

.markdown-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    margin: 1em 0;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-out-expo);
}

.markdown-image:hover {
    transform: scale(1.02);
}

.markdown-list {
    margin: 0.8em 0;
    padding-left: 1.5em;
}

.markdown-list li {
    margin: 0.4em 0;
}

/* Inline code */
.inline-code {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
}

/* Code blocks */
.code-block {
    background: var(--bg-deep);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    margin: 1em 0;
    overflow-x: auto;
}

.code-block code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85em;
    line-height: 1.6;
    color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Products Display
   ───────────────────────────────────────────────────────────────────────────── */
.products-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.products-container h4 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.product-card {
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 14px;
    transition: all var(--duration-fast) var(--ease-out-expo);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow);
    border-color: var(--primary-color);
}

.product-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 12px;
}

.product-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Error Messages
   ───────────────────────────────────────────────────────────────────────────── */
.error-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.3);
    z-index: 10000;
    animation: error-enter 0.4s var(--ease-out-back);
}

@keyframes error-enter {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px) scale(0.9);
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Launcher Button - The Gateway
   ───────────────────────────────────────────────────────────────────────────── */
.chatbot-launcher {
    position: fixed;
    width: var(--launcher-size);
    height: var(--launcher-size);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    box-shadow:
        0 6px 28px rgba(16, 185, 129, 0.35),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-normal) var(--ease-spring);
    z-index: 9999;
    animation: launcher-entrance 0.6s var(--ease-out-back);
    border: none;
}

@keyframes launcher-entrance {
    from {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
}

/* Glowing ring effect */
.chatbot-launcher::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    filter: blur(12px);
    transition: opacity var(--duration-normal);
    z-index: -1;
}

.chatbot-launcher:hover::before {
    opacity: 0.5;
}

.chatbot-launcher:hover {
    transform: scale(1.12);
    box-shadow:
        0 8px 36px rgba(16, 185, 129, 0.45),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
}

.chatbot-launcher:active {
    transform: scale(0.95);
}

.chatbot-launcher.icon-only {
    border-radius: 50%;
}

.chatbot-launcher.icon-with-text {
    border-radius: 28px;
    width: auto;
    padding: 0 24px;
    height: 56px;
}

.launcher-icon {
    width: 60%;
    height: 60%;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.launcher-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: badge-bounce 0.5s var(--ease-out-back);
}

@keyframes badge-bounce {
    from { transform: scale(0); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Popup Chat Window
   ───────────────────────────────────────────────────────────────────────────── */
.chatbot-popup {
    position: fixed;
    width: min(420px, calc(100vw - 40px));
    height: min(680px, calc(100vh - 40px));
    background: var(--bg-elevated);
    border-radius: 24px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px var(--glass-border);
    overflow: hidden;
    opacity: 0;
    transform: scale(0.9) translateY(30px);
    transition: all var(--duration-normal) var(--ease-out-expo);
    pointer-events: none;
}

.chatbot-popup.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Mobile Responsive Adjustments
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --window-border-radius: 0;
    }

    .chatbot-container {
        border-radius: 0;
        height: 100vh;
        height: 100dvh;
        width: 100vw;
        max-width: none;
        position: fixed;
        inset: 0;
    }

    .chatbot-header {
        padding: 16px 20px;
    }

    .header-icon {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }

    .header-title {
        font-size: 18px;
    }

    .header-subtitle {
        font-size: 12px;
    }

    .chatbot-messages {
        padding: 16px;
    }

    .message-bubble {
        max-width: 88%;
        font-size: 15px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .welcome-subtitle {
        font-size: 14px;
    }

    .welcome-icon {
        width: 72px;
        height: 72px;
        border-radius: 22px;
    }

    .sparkles-icon {
        width: 36px;
        height: 36px;
    }

    .question-btn {
        padding: 14px 16px;
    }

    .chatbot-input {
        padding: 16px 20px;
        padding-bottom: calc(20px + var(--safe-area-bottom));
    }

    .message-input {
        font-size: 16px; /* Prevent zoom on iOS */
        max-height: 100px;
    }

    .send-text {
        display: none;
    }

    .send-btn {
        padding: 14px 18px;
    }

    .chatbot-launcher {
        bottom: 20px;
        right: 20px;
    }

    /* Blob effects smaller on mobile */
    .blob-1, .blob-2, .blob-3 {
        transform: scale(0.6);
        filter: blur(60px);
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 16px;
    }

    .message-bubble {
        max-width: 90%;
        padding: 12px 16px;
        font-size: 14px;
    }

    .question-btn {
        padding: 12px 14px;
        font-size: 13px;
        border-radius: 14px;
    }

    .question-icon {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    .welcome-title {
        font-size: 20px;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* Chrome Android specific */
.chrome-android .chatbot-input {
    padding-bottom: calc(24px + var(--mobile-nav-height, 56px) + var(--safe-area-bottom));
}

.chrome-android .scroll-to-bottom {
    bottom: calc(100px + var(--mobile-nav-height, 56px) + var(--safe-area-bottom));
}

/* iOS specific */
.ios-device .chatbot-input {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 20px));
}

/* Keyboard open state */
.keyboard-open .chatbot-messages {
    padding-bottom: 12px;
}

.keyboard-open .chatbot-input {
    position: sticky;
    bottom: 0;
}

/* Landscape on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .chatbot-input {
        padding: 12px 16px;
    }

    .message-input {
        max-height: 60px;
    }

    .welcome-icon {
        width: 56px;
        height: 56px;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Utility Animations
   ───────────────────────────────────────────────────────────────────────────── */
.fade-in {
    animation: fadeIn var(--duration-normal) var(--ease-out-expo);
}

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

.slide-up {
    animation: slideUp var(--duration-normal) var(--ease-out-expo);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Reduced Motion Support
   ───────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .blob { display: none; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Mobile Performance Optimizations
   Disable expensive CSS effects on mobile for better performance
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Disable backdrop-filter on mobile - too expensive for GPU */
    .chatbot-container,
    .loading-overlay,
    .scroll-to-bottom,
    .product-card,
    .clear-btn,
    .mobile-close-btn {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Hide animated blobs on mobile - continuous repaints */
    .blob {
        display: none !important;
    }

    /* Hide noise overlay on mobile - GPU intensive SVG filter */
    .noise-overlay {
        display: none !important;
    }

    /* Disable infinite animations on mobile */
    .launcher-button::after {
        animation: none !important;
    }

    .chatbot-header::after {
        animation: none !important;
    }

    .welcome-icon-ring {
        animation: none !important;
    }

    .scroll-to-bottom svg {
        animation: none !important;
    }
}
