/**
 * Display Bot AI 3000 PRO Design - Exact Match
 */

/* ========================================
   NUCLEAR RESET - Kill all theme styles
   ======================================== */
#aisa-chat-window,
#aisa-chat-window *,
#aisa-chat-window *::before,
#aisa-chat-window *::after {
    box-sizing: border-box !important;
}

#aisa-chat-window button {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    font-size: 14px !important;
    line-height: 1 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    text-decoration: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    margin: 0 !important;
    vertical-align: middle !important;
}

/* ========================================
   END NUCLEAR RESET
   ======================================== */

/* Chat Bubble - Smaller Robot Avatar */
#aisa-chat-button {
    position: fixed;
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    right: calc(22px + env(safe-area-inset-right, 0px));
    width: 50px;
    height: 50px;
    border-radius: 16px; /* Rounded square to match brand */
    background: var(--aisa-bubble-color, #2d6bff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100001;
    transition: all 0.3s ease;
}

/* Position variations */
.aisa-position-bottom-left #aisa-chat-button {
    right: auto;
    left: calc(22px + env(safe-area-inset-left, 0px));
}

.aisa-position-top-right #aisa-chat-button {
    bottom: auto;
    top: calc(22px + env(safe-area-inset-top, 0px));
}

.aisa-position-top-left #aisa-chat-button {
    bottom: auto;
    right: auto;
    top: calc(22px + env(safe-area-inset-top, 0px));
    left: calc(22px + env(safe-area-inset-left, 0px));
}

#aisa-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#aisa-chat-button svg {
    width: 35px;
    height: 35px;
    flex-shrink: 0;
}

#aisa-chat-button .aisa-bubble-icon-minimized {
    fill: var(--aisa-bubble-icon, #fff);
}

/* Icon switching - show default by default */
#aisa-chat-button .aisa-bubble-icon-default {
    display: block !important;
}

#aisa-chat-button .aisa-bubble-icon-minimized {
    display: none !important;
}

/* When chat is open, switch to minimized icon but keep bubble color */
#aisa-chat-window.aisa-open ~ #aisa-chat-button {
    background: var(--aisa-bubble-color, #2d6bff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#aisa-chat-window.aisa-open ~ #aisa-chat-button .aisa-bubble-icon-default {
    display: none !important;
}

#aisa-chat-window.aisa-open ~ #aisa-chat-button .aisa-bubble-icon-minimized {
    display: block !important;
}

/* Chat Window */
#aisa-chat-window {
    position: fixed;
    right: calc(22px + env(safe-area-inset-right, 0px));
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    width: 650px;
    max-width: calc(100vw - 44px);
    height: 750px;
    max-height: calc(100vh - 140px);
    background: #fff;
    color: #0f172a;
    border: 1px solid rgba(16, 26, 46, 0.12);
    border-radius: 24px;
    overflow: hidden;
    z-index: 99999;

    transform: translateY(10px) scale(0.97);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat window position variations */
.aisa-position-bottom-left #aisa-chat-window {
    right: auto;
    left: calc(22px + env(safe-area-inset-left, 0px));
}

.aisa-position-top-right #aisa-chat-window {
    bottom: auto;
    top: calc(100px + env(safe-area-inset-top, 0px));
}

.aisa-position-top-left #aisa-chat-window {
    bottom: auto;
    right: auto;
    top: calc(100px + env(safe-area-inset-top, 0px));
    left: calc(22px + env(safe-area-inset-left, 0px));
}

#aisa-chat-window.aisa-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Dark Header - Horizontal Layout */
.aisa-header {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 14px 16px;
    color: #eaf1ff;
    background: linear-gradient(135deg, #0f1525 0%, #182038 60%, #111a33 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 -1px 0 rgba(16, 26, 46, 0.25);
}

.aisa-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aisa-header-right {
    position: absolute;
    right: 16px;
}

.aisa-robot {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--aisa-primary-color, #2d6bff);
    box-shadow: 0 0 12px rgba(45, 107, 255, 0.55), inset 0 0 10px rgba(255, 255, 255, 0.12);
}

.aisa-robot::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 14px;
    background: radial-gradient(60% 60% at 50% 50%, rgba(45, 107, 255, 0.28), rgba(122, 82, 255, 0.20) 50%, transparent 70%);
    filter: blur(9px);
    opacity: 0.45;
    animation: aicBotPulse 2.4s ease-in-out infinite;
}

@keyframes aicBotPulse {
    0% { transform: scale(0.95); opacity: 0.45; }
    50% { transform: scale(1.05); opacity: 0.7; }
    100% { transform: scale(0.95); opacity: 0.45; }
}

.aisa-robot svg {
    width: 26px;
    height: 26px;
    position: relative;
    z-index: 1;
}

.aisa-titlewrap {
    display: flex;
    flex-direction: column;
}

.aisa-title {
    font-weight: 900;
    font-size: 17px;
    letter-spacing: 0.2px;
    color: #fff;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 6px;
}

.aisa-pro-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, rgba(45, 107, 255, 0.9) 0%, rgba(122, 82, 255, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 6px rgba(45, 107, 255, 0.3), inset 0 0 8px rgba(255, 255, 255, 0.15);
    line-height: 1;
    transform: translateY(-1.5px);
}

.aisa-subtitle {
    margin-top: 2px;
    font-size: 12.5px;
    color: #c9d4ec;
    line-height: 1.2;
}

/* 3-Dot Menu Button */
.aisa-menu-button {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: #eaf1ff;
    transition: all 0.2s;
    padding: 0;
}

.aisa-menu-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.aisa-menu-button svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Menu Dropdown */
.aisa-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 4px;
    min-width: 140px;
    display: none;
    z-index: 100;
}

.aisa-menu-dropdown.show {
    display: block;
}

.aisa-menu-item {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: all 0.2s;
}

.aisa-menu-item:hover {
    background: #f1f5f9;
    color: #2d6bff;
}

.aisa-menu-item svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

/* Mobile Close Button - Hidden on desktop */
.aisa-close-button {
    display: none;
    width: 36px;
    height: 36px;
    background: var(--aisa-bubble-color, #2d6bff);
    border: none;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ffffff;
    transition: all 0.2s;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.aisa-close-button:hover {
    background: var(--aisa-primary-dark, #2557d6);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.aisa-close-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Mobile Maximize/Minimize Button - Hidden on desktop */
.aisa-maximize-button {
    display: none;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #eaf1ff;
    transition: all 0.2s;
    padding: 0;
}

.aisa-maximize-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.aisa-maximize-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Show maximize icon by default, hide minimize */
.aisa-maximize-button .aisa-maximize-icon {
    display: block;
}

.aisa-maximize-button .aisa-minimize-icon {
    display: none;
}

/* When in fullscreen, show minimize icon */
#aisa-chat-window.aisa-user-fullscreen .aisa-maximize-button .aisa-maximize-icon {
    display: none;
}

#aisa-chat-window.aisa-user-fullscreen .aisa-maximize-button .aisa-minimize-icon {
    display: block;
}

/* Messages Container */
#aisa-messages {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    background: radial-gradient(900px 400px at 10% -10%, rgba(45, 107, 255, 0.08), transparent 60%),
                radial-gradient(900px 400px at 130% 0%, rgba(122, 82, 255, 0.08), transparent 60%);
    /* Mobile fix: Prevent overscroll propagation */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

#aisa-messages::-webkit-scrollbar {
    width: 4px;
}

#aisa-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.aisa-message {
    margin: 10px auto;
    max-width: 84%;
    position: relative;
}

.aisa-user-message {
    margin-left: auto;
    margin-right: 0;
}

.aisa-message-content {
    padding: 16px 18px;  /* IMPROVED: Increased from 12px 14px */
    border-radius: 14px;
    line-height: 1.6;  /* IMPROVED: Increased from 1.5 */
    background: #ffffff;
    border: 1px solid rgba(16, 26, 46, 0.1);
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: var(--aisa-font-size, 14.5px);
    color: #1e293b;
    -webkit-font-smoothing: antialiased;  /* IMPROVED: Better font rendering */
    -moz-osx-font-smoothing: grayscale;  /* IMPROVED: Better font rendering */
    text-rendering: optimizeLegibility;  /* IMPROVED: Better font rendering */
}

/* Add extra padding on right for bot messages with read aloud button */
.aisa-bot-message .aisa-message-content {
    padding: 16px 48px 16px 18px; /* IMPROVED: Adjusted for new padding + button space */
}

.aisa-user-message .aisa-message-content {
    background: #eaf1ff !important;
    border-color: rgba(45, 107, 255, 0.18) !important;
    color: #0d1730 !important;
}

.aisa-user-message .aisa-message-content strong {
    color: #0d1730 !important;
    font-weight: 700;
    /* User messages get plain styling, no blue highlight */
}

.aisa-user-message .aisa-message-content li {
    color: #0d1730 !important;
}

.aisa-user-message .aisa-message-content p {
    color: #0d1730 !important;
}

/* Bot messages and general message content - Bold text */
.aisa-message-content strong,
.aisa-bot-message .aisa-message-content strong {
    font-weight: 700;
    color: #0f172a;  /* IMPROVED: Darker for better contrast (was #1e293b) */
}

.aisa-message-content p {
    margin: 8px 0;  /* IMPROVED: Increased from 3px for better readability */
    line-height: 1.6;  /* IMPROVED: Increased from 1.5 */
    letter-spacing: 0.01em;  /* IMPROVED: Better readability */
}

.aisa-message-content ul {
    margin: 12px 0;  /* IMPROVED: Increased from 4px */
    padding-left: 28px;
    list-style-type: disc;
}

.aisa-message-content li {
    margin: 8px 0;  /* IMPROVED: Increased from 2px for breathing room */
    padding-left: 6px;  /* IMPROVED: Increased from 4px */
    line-height: 1.6;  /* IMPROVED: Increased from 1.5 */
    color: #334155;
    letter-spacing: 0.01em;  /* IMPROVED: Better readability */
}

/* IMPROVED: Better spacing when paragraph is followed by list */
.aisa-message-content p + ul {
    margin-top: 8px;
}

/* IMPROVED: Better spacing when list is followed by paragraph */
.aisa-message-content ul + p {
    margin-top: 8px;
}

/* IMPROVED: Add spacing between consecutive lists */
.aisa-message-content ul + ul {
    margin-top: 16px;
}

/* Headings - actually noticeable in chat bubble */
.aisa-message-content h2 {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin: 10px 0 4px 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.aisa-message-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 8px 0 3px 0;
    line-height: 1.3;
}

.aisa-message-content h2:first-child,
.aisa-message-content h3:first-child {
    margin-top: 0;
}

/* Reduce spacing after headings when followed by lists */
.aisa-message-content h2 + ul,
.aisa-message-content h3 + ul {
    margin-top: 3px;
}

/* Reduce spacing after headings when followed by paragraphs */
.aisa-message-content h2 + p,
.aisa-message-content h3 + p {
    margin-top: 3px;
}

/* Starter Prompts */
.aisa-starter-prompts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}

.aisa-starter-prompt {
    background: var(--aisa-primary-color, #2d6bff);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--aisa-button-text, #ffffff);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.aisa-starter-prompt:hover {
    background: var(--aisa-primary-dark, #2557cc);
    border-color: var(--aisa-primary-dark, #2557cc);
    color: var(--aisa-button-text, #fff);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.20);
}



/* Products - Compact Card Layout */
.aisa-products-grid {
    display: grid;
    gap: 10px;
    margin: 10px 0;
}

.aisa-product-card {
    display: flex;
    align-items: center;
    margin-top: 6px;
    border: 1px solid rgba(45, 107, 255, 0.2);
    border-left: 3px solid var(--aisa-primary-color, #2d6bff);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(45, 107, 255, 0.04) 0%, rgba(122, 82, 255, 0.04) 100%);
    box-shadow: 0 2px 8px rgba(45, 107, 255, 0.08);
    overflow: hidden;
    transition: all 0.2s;
    text-decoration: none;
    cursor: pointer;
    gap: 12px;
}

.aisa-product-card:hover {
    box-shadow: 0 6px 16px rgba(45, 107, 255, 0.15);
    transform: translateY(-2px);
    border-color: rgba(45, 107, 255, 0.35);
}

.aisa-product-card:hover .aisa-product-arrow {
    transform: translateX(3px);
}

.aisa-product-image {
    width: 70px;
    height: 70px;
    min-width: 70px;
    object-fit: cover;
    border-right: 1px solid rgba(16, 26, 46, 0.08);
    display: block;
}

.aisa-product-details {
    padding: 10px 12px;
    color: #334155;
    flex: 1;
}

.aisa-product-name {
    display: block;
    font-weight: 700;
    color: #1e293b;
    text-decoration: none;
    margin: 0 0 3px 0;
    font-size: calc(var(--aisa-font-size, 14.5px) - 1px);
    line-height: 1.25;
}

.aisa-product-price {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.aisa-product-desc {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.4;
}

.aisa-product-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 12px;
    color: #94a3b8;
    transition: all 0.2s;
    flex-shrink: 0;
}

.aisa-btn {
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    text-align: center;
    text-decoration: none;
    border: none;
    transition: all 0.2s;
    line-height: 1;
}

.aisa-btn-primary {
    background: var(--aisa-primary-color, #2d6bff);
    color: var(--aisa-button-text, white);
}

.aisa-btn-primary:hover {
    background: var(--aisa-primary-dark, #2d6bff);
    color: var(--aisa-button-text, white);
    transform: translateY(-1px);
}

.aisa-btn-secondary {
    background: white;
    color: var(--aisa-primary-color, #2d6bff);
    border: 1px solid var(--aisa-primary-color, #2d6bff);
}

.aisa-btn-secondary:hover {
    background: #eef2ff;
}

/* Input Area */
#aisa-input-area {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    align-items: center;
    padding: 12px;
    border-top: 1px solid rgba(16, 26, 46, 0.10);
    background: #fff;
    overflow: visible;
    min-width: 0;
    flex: 0 0 auto;
    position: relative;
}

#aisa-user-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 48px;
    border-radius: 14px;
    padding: 0 16px 0 42px;
    border: 2px solid rgba(45, 107, 255, 0.5);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364758b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 14px 50%;
    color: #111;
    font-size: 14.5px;
    line-height: normal;
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 107, 255, 0.15), 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
    font-family: inherit;
}

#aisa-user-input::placeholder {
    color: #6b7280;
}

#aisa-user-input:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

#aisa-user-input:focus {
    border-color: var(--aisa-primary-color, #2d6bff);
    box-shadow: 0 0 0 2px rgba(45, 107, 255, 0.20), 0 10px 24px rgba(0, 0, 0, 0.10);
}

/* Voice Button - MAX SPECIFICITY */
#aisa-chat-window #aisa-voice-btn,
html body #aisa-chat-window #aisa-voice-btn,
html body #aisa-chat-window button#aisa-voice-btn,
#aisa-chat-window button[id="aisa-voice-btn"] {
    flex: 0 0 auto !important;
    width: 48px !important;
    height: 48px !important;
    border: 1px solid rgba(16, 26, 46, 0.12) !important;
    border-radius: 14px !important;
    cursor: pointer !important;
    display: grid !important;
    place-items: center !important;
    background: rgba(71, 85, 105, 0.1) !important;
    background-color: rgba(71, 85, 105, 0.1) !important;
    background-image: none !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    color: #475569 !important;
}

#aisa-chat-window #aisa-voice-btn:hover,
html body #aisa-chat-window #aisa-voice-btn:hover {
    background: rgba(71, 85, 105, 0.18) !important;
    background-color: rgba(71, 85, 105, 0.18) !important;
}

#aisa-chat-window #aisa-voice-btn.recording,
html body #aisa-chat-window #aisa-voice-btn.recording {
    background: radial-gradient(120% 120% at 15% 15%, #ef4444 0%, #dc2626 70%, #991b1b 100%) !important;
    border-color: #ef4444 !important;
    animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

#aisa-chat-window #aisa-voice-btn svg,
html body #aisa-chat-window #aisa-voice-btn svg {
    width: 20px !important;
    height: 20px !important;
    fill: #475569 !important;
    color: #475569 !important;
}

#aisa-chat-window #aisa-voice-btn.recording svg {
    fill: #fff !important;
    color: #fff !important;
}

/* Image Upload Button - MAX SPECIFICITY */
#aisa-chat-window #aisa-image-btn,
html body #aisa-chat-window #aisa-image-btn,
html body #aisa-chat-window button#aisa-image-btn,
#aisa-chat-window button[id="aisa-image-btn"] {
    flex: 0 0 auto !important;
    width: 48px !important;
    height: 48px !important;
    border: 1px solid rgba(16, 26, 46, 0.12) !important;
    border-radius: 14px !important;
    cursor: pointer !important;
    display: grid !important;
    place-items: center !important;
    background: rgba(71, 85, 105, 0.1) !important;
    background-color: rgba(71, 85, 105, 0.1) !important;
    background-image: none !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    color: #475569 !important;
}

#aisa-chat-window #aisa-image-btn:hover,
html body #aisa-chat-window #aisa-image-btn:hover {
    background: rgba(71, 85, 105, 0.18) !important;
    background-color: rgba(71, 85, 105, 0.18) !important;
}

#aisa-chat-window #aisa-image-btn.has-image {
    background: rgba(16, 185, 129, 0.2) !important;
    background-color: rgba(16, 185, 129, 0.2) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

#aisa-chat-window #aisa-image-btn svg,
html body #aisa-chat-window #aisa-image-btn svg {
    width: 22px !important;
    height: 22px !important;
    fill: #475569 !important;
    color: #475569 !important;
}

#aisa-chat-window #aisa-image-btn.has-image svg {
    fill: #10b981 !important;
}

/* Image Preview */
.aisa-image-preview {
    position: relative;
    padding: 10px 15px;
    background: #f8fafc;
    border-bottom: 1px solid rgba(16, 26, 46, 0.1);
    display: inline-block;
}

.aisa-image-preview-wrapper {
    position: relative;
    display: inline-block;
}

.aisa-image-preview img {
    max-width: 80px;
    max-height: 60px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #e2e8f0;
    display: block;
}

#aisa-remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#aisa-remove-image:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* User message with image */
.aisa-user-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: block;
}

#aisa-chat-window #aisa-send-btn {
    flex: 0 0 auto !important;
    width: 48px !important;
    height: 48px !important;
    border: none !important;
    border-radius: 14px !important;
    cursor: pointer !important;
    display: grid !important;
    place-items: center !important;
    background: var(--aisa-primary-color, #2d6bff) !important;
    box-shadow: 0 8px 20px rgba(45, 107, 255, 0.30), inset 0 0 14px rgba(255, 255, 255, 0.20) !important;
    padding: 0 !important;
    transition: transform 0.12s ease, box-shadow 0.18s ease !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    outline: none !important;
}

#aisa-chat-window #aisa-send-btn:hover {
    transform: translateY(-1px) !important;
}

#aisa-chat-window #aisa-send-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

#aisa-chat-window #aisa-send-btn svg {
    fill: var(--aisa-button-text, #fff) !important;
    width: 20px !important;
    height: 20px !important;
    transform: translateX(1px) !important;
}

/* Send button loading state - gray + pulsing circle */
#aisa-chat-window #aisa-send-btn.aisa-loading {
    cursor: wait !important;
    pointer-events: none !important;
    background: #94a3b8 !important;
    box-shadow: 0 4px 12px rgba(148, 163, 184, 0.3) !important;
}

#aisa-chat-window #aisa-send-btn.aisa-loading svg {
    display: none !important;
}

#aisa-chat-window #aisa-send-btn.aisa-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    animation: sendBtnPulse 1.5s ease-in-out infinite;
}

@keyframes sendBtnPulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 0.6; 
    }
    50% { 
        transform: scale(1.4); 
        opacity: 1; 
    }
}

/* Typing Indicator */
.aisa-typing-indicator {
    display: flex;
    gap: 6px;
    padding: 2px 0;
}

.aisa-typing-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: aisaBlink 1s ease-in-out infinite;
}

.aisa-typing-dot:nth-child(1) {
    background: #2dd4bf; /* Cyan orb */
    animation-delay: 0s;
}

.aisa-typing-dot:nth-child(2) {
    background: #22c55e; /* Green orb */
    animation-delay: 0.15s;
}

.aisa-typing-dot:nth-child(3) {
    background: #a855f7; /* Purple orb */
    animation-delay: 0.3s;
}

.aisa-typing-dot:nth-child(4) {
    background: #f59e0b; /* Orange orb */
    animation-delay: 0.45s;
}

@keyframes aisaBlink {
    0%, 50%, 100% {
        opacity: 1;
    }
    25%, 75% {
        opacity: 0;
    }
}

/* Mobile */
@media (max-width: 768px) {
    #aisa-chat-window {
        width: calc(100vw - 24px - env(safe-area-inset-right, 0px) - env(safe-area-inset-left, 0px));
        left: 50%;
        top: 50%;
        right: auto;
        bottom: auto;
        /* Fallback for older browsers */
        height: calc(100vh - 85px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        max-height: calc(100vh - 85px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        /* Mobile: Use standard vh for more stable behavior during scroll */
        
        /* Mobile: Center the window */
        transform: translate(-50%, -50%);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.18s ease, visibility 0.18s, transform 0.18s ease;
    }
    
    #aisa-chat-window.aisa-open {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, -50%);
    }

    .aisa-header {
        padding: 12px 14px;
        gap: 8px;
    }

    .aisa-robot {
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }

    .aisa-robot svg {
        width: 22px;
        height: 22px;
    }

    .aisa-title {
        font-size: 16px;
    }

    .aisa-pro-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    .aisa-subtitle {
        font-size: 12px;
    }
    
    /* Show mobile close and maximize buttons */
    .aisa-close-button {
        display: flex !important;
    }
    
    .aisa-maximize-button {
        display: flex !important;
    }
    
    /* Mobile layout: [Menu] [Robot+Title] ... [Maximize] [Close] */
    .aisa-header {
        justify-content: flex-start;
        gap: 12px;
    }
    
    .aisa-header-left {
        gap: 8px;
        order: 1; /* Middle - after menu */
    }
    
    .aisa-header-right {
        position: relative;
        right: auto;
        order: -1; /* First (leftmost) - contains menu */
    }
    
    /* Position maximize button on the right */
    .aisa-maximize-button {
        position: absolute;
        right: 60px; /* Leave room for close button */
        top: 50%;
        transform: translateY(-50%);
    }
    
    /* Position close button on far right */
    .aisa-close-button {
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .aisa-menu-dropdown {
        right: auto;
        left: 0; /* Dropdown opens from left since menu is on left */
    }
    
    /* Hide the repositioned bubble button on mobile when chat is open */
    #aisa-chat-window.aisa-open ~ #aisa-chat-button {
        display: none !important;
    }
    
    /* Smaller input on mobile */
    #aisa-input-area {
        padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px)) 6px;
        gap: 3px;
    }
    
    #aisa-user-input {
        font-size: 15px;
        padding: 0 10px 0 38px;
        height: 36px;
        border-radius: 10px;
    }
    
    /* Make ALL buttons match input box height on mobile - 36px */
    #aisa-chat-window #aisa-send-btn,
    html body #aisa-chat-window #aisa-send-btn,
    #aisa-chat-window button#aisa-send-btn {
        width: 36px !important;
        height: 36px !important;
        border-radius: 10px !important;
    }
    
    #aisa-chat-window #aisa-voice-btn,
    html body #aisa-chat-window #aisa-voice-btn,
    html body #aisa-chat-window button#aisa-voice-btn,
    #aisa-chat-window button[id="aisa-voice-btn"] {
        width: 36px !important;
        height: 36px !important;
        border-radius: 10px !important;
    }
    
    #aisa-chat-window #aisa-voice-btn svg,
    html body #aisa-chat-window #aisa-voice-btn svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    #aisa-chat-window #aisa-image-btn,
    html body #aisa-chat-window #aisa-image-btn,
    html body #aisa-chat-window button#aisa-image-btn,
    #aisa-chat-window button[id="aisa-image-btn"] {
        width: 36px !important;
        height: 36px !important;
        border-radius: 10px !important;
    }
    
    #aisa-chat-window #aisa-image-btn svg,
    html body #aisa-chat-window #aisa-image-btn svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    #aisa-chat-window #aisa-send-btn svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    .aisa-image-preview img {
        max-width: 60px;
        max-height: 45px;
    }
    
    /* Read aloud button on mobile - ensure no overlap */
    .aisa-read-aloud-btn {
        width: 26px;
        height: 26px;
        bottom: 6px;
        right: 6px;
    }
    
    .aisa-read-aloud-btn svg {
        width: 13px;
        height: 13px;
    }
    
    /* Hide tooltip on mobile - not needed on touch devices */
    .aisa-read-aloud-btn::after {
        display: none;
    }
    
    /* Ensure bot messages have enough padding on mobile */
    .aisa-bot-message .aisa-message-content {
        padding: 14px 42px 14px 16px; /* IMPROVED: Adjusted for mobile with button */
    }
    
    /* IMPROVED: Adjust list and paragraph spacing on mobile */
    .aisa-message-content p {
        margin: 6px 0;
    }
    
    .aisa-message-content ul {
        margin: 10px 0;
        padding-left: 24px;
    }
    
    .aisa-message-content li {
        margin: 6px 0;
        line-height: 1.55;
    }
    
    .aisa-starter-prompt {
        font-size: 12.5px;
        padding: 7px 12px;
    }
}

/* Recording Indicator Banner - Option 2: Dark Two-Line */
.aisa-recording-indicator {
    display: none;
    padding: 14px 24px;
    text-align: center;
    color: white;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    border-left: 4px solid #ef4444;
    position: absolute;
    bottom: 70px;
    left: 12px;
    right: 12px;
    z-index: 10;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.aisa-recording-indicator:hover {
    background: rgba(17, 24, 39, 1);
    transform: translateY(-1px);
}

.aisa-recording-indicator.show {
    display: flex;
}

.aisa-recording-indicator.uploading {
    border-left-color: #3b82f6;
}

.aisa-indicator-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aisa-pulse-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulseDotIndicator 1.5s ease-out infinite;
}

.aisa-recording-indicator.uploading .aisa-pulse-dot {
    background: #3b82f6;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    animation: pulseDotIndicatorBlue 1.5s ease-out infinite;
}

@keyframes pulseDotIndicator {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes pulseDotIndicatorBlue {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.aisa-indicator-main {
    font-size: 15px;
    font-weight: 600;
}

.aisa-indicator-sub {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.95;
}

.aisa-indicator-icon {
    margin-right: 8px;
    font-size: 16px;
}

.aisa-indicator-text {
    display: inline;
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.85;
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    }
    50% {
        opacity: 1;
        box-shadow: 0 4px 16px rgba(239, 68, 68, 0.5);
    }
}

/* Voice button states */
#aisa-voice-btn.recording {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

#aisa-voice-btn.uploading {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    pointer-events: none;
}

/* Read Aloud Button */
.aisa-read-aloud-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(100, 116, 139, 0.08);
    color: #94a3b8;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all .2s ease;
    opacity: 0.6;
}

.aisa-read-aloud-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
    opacity: 1;
    transform: scale(1.1);
}

/* Tooltip */
.aisa-read-aloud-btn::after {
    content: 'Read Aloud';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 8px;
    padding: 5px 10px;
    background: #1e293b;
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.aisa-read-aloud-btn:hover::after {
    opacity: 1;
}

.aisa-read-aloud-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

.aisa-read-aloud-btn:hover svg {
    transform: none;
}

.aisa-read-aloud-btn.playing {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #ffffff;
    opacity: 1;
    animation: pulse-glow 1.5s ease-in-out infinite;
}

.aisa-read-aloud-btn.playing::after {
    content: 'Stop';
}

.aisa-read-aloud-btn.loading {
    cursor: wait;
    pointer-events: none;
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
    opacity: 1;
}

.aisa-read-aloud-btn.loading::after {
    content: 'Loading...';
}

.aisa-read-aloud-btn.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
}

.aisa-btn-text {
    display: none; /* Hide text, icon only */
}

/* ========================================
   PRODUCT PAGE - ASK AI BOX
   ======================================== */

.aisa-product-question-box {
    background: linear-gradient(135deg, rgba(45, 107, 255, 0.08) 0%, rgba(122, 82, 255, 0.08) 100%);
    border: 1px solid rgba(45, 107, 255, 0.15);
    border-radius: 10px;
    padding: 14px 16px;
    display: inline-flex !important;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 16px;
    margin-bottom: 16px;
    /* Size to content, don't stretch */
    width: auto !important;
    max-width: 600px !important;
    clear: both;
    float: none !important;
    box-sizing: border-box !important;
}

.aisa-product-question-box:hover {
    background: linear-gradient(135deg, rgba(45, 107, 255, 0.12) 0%, rgba(122, 82, 255, 0.12) 100%);
    border-color: rgba(45, 107, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 107, 255, 0.15);
}

.aisa-pq-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2d6bff 0%, #5b8cff 100%);
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.aisa-pq-icon svg {
    width: 26px;
    height: 26px;
}

.aisa-pq-text {
    flex: 0 1 auto;
}

.aisa-pq-main {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
    line-height: 1.3;
}

.aisa-pq-sub {
    font-size: 12px;
    color: #64748b;
    line-height: 1.3;
}

/* Mobile optimization for Ask AI box */
@media (max-width: 768px) {
    .aisa-product-question-box {
        padding: 12px 14px;
        margin-top: 12px;
    }
    
    .aisa-pq-icon {
        width: 32px;
        height: 32px;
    }
    
    .aisa-pq-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .aisa-pq-main {
        font-size: 13px;
    }
    
    .aisa-pq-sub {
        font-size: 11px;
    }
}

/* ========================================
   MOBILE FULLSCREEN MODE (User Toggle or Admin Default)
   ======================================== */
@media (max-width: 768px) {
    /* Apply fullscreen when user has toggled it on (user preference overrides admin default) */
    #aisa-chat-window.aisa-open.aisa-user-fullscreen {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important; /* Fallback */
        height: 100dvh !important; /* Dynamic viewport height for mobile browsers */
        max-width: 100vw !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        transform: none !important; /* Reset the translate(-50%, -50%) from mobile */
        transition: all 0.3s ease;
        display: flex;
        flex-direction: column;
    }
    
    /* Ensure messages container takes available space */
    #aisa-chat-window.aisa-open.aisa-user-fullscreen #aisa-messages {
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
    }
    
    /* Adjust header padding for fullscreen */
    #aisa-chat-window.aisa-open.aisa-user-fullscreen .aisa-header {
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
        flex-shrink: 0;
        flex-grow: 0;
    }
    
    /* Adjust input area for fullscreen */
    #aisa-chat-window.aisa-open.aisa-user-fullscreen #aisa-input-area {
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        flex-shrink: 0;
        flex-grow: 0;
    }
}
