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

/* Chat Bubble - Radial Gradient */
#aisa-chat-button {
    position: fixed;
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    right: calc(22px + env(safe-area-inset-right, 0px));
    width: 62px;
    height: 62px;
    border-radius: 20px;
    background: radial-gradient(120% 120% at 15% 15%, #2d6bff 0%, #7a52ff 70%, #1f2540 100%);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35), inset 0 0 18px rgba(255, 255, 255, 0.18);
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 100001;
    transition: all 0.3s ease;
}

#aisa-chat-button:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.45);
}

#aisa-chat-button svg {
    width: 30px;
    height: 30px;
    fill: #fff;
}

/* 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: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
}

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

/* Dark Header */
.aisa-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 12px;
    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-robot {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: radial-gradient(100% 100% at 25% 20%, #2d6bff 0%, #7a52ff 70%, #1f2540 100%);
    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;
    text-align: center;
}

.aisa-title {
    font-weight: 900;
    font-size: 19px;
    letter-spacing: 0.2px;
    color: #fff;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: 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;
}

.aisa-header-ctas {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.aisa-pill {
    background: rgba(255, 255, 255, 0.08);
    color: #eaf1ff;
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 5px 8px;
    font-size: 11.5px;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, box-shadow 0.15s;
    opacity: 0.9;
}

.aisa-pill:hover {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 10px rgba(148, 163, 184, 0.4);
}

/* 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%);
}

#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: 12px 14px;
    border-radius: 14px;
    line-height: 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;
}

/* Add extra padding on right for bot messages with read aloud button */
.aisa-bot-message .aisa-message-content {
    padding-right: 45px; /* Space for the read aloud button */
}

.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: #1e293b;
}

.aisa-message-content p {
    margin: 8px 0;
    line-height: 1.6;
}

.aisa-message-content ul {
    margin: 10px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.aisa-message-content li {
    margin: 6px 0;
    line-height: 1.6;
    color: #334155;
}

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

.aisa-starter-prompt {
    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);
    color: #2d6bff;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 2px 8px rgba(45, 107, 255, 0.08);
}

.aisa-starter-prompt:hover {
    background: linear-gradient(135deg, #2d6bff 0%, #7a52ff 100%);
    border-color: #2d6bff;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(45, 107, 255, 0.30);
}

/* Typing Indicator - Old bouncing dots (keeping for reference) */
.aisa-typing-indicator {
    display: flex;
    gap: 4px;
}

.aisa-typing-indicator span {
    width: 6px;
    height: 6px;
    background: #2d6bff;
    border-radius: 50%;
    animation: bounceDot 1.4s infinite ease-in-out;
}

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

@keyframes bounceDot {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.7; }
    40% { transform: translateY(-8px); opacity: 1; }
}

/* Thinking Indicator - Terminal style like boot sequence */
.aisa-thinking-indicator {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 600;
    padding: 10px 14px;
    background: #0a0e14;
    border: 1px solid #1e3a5f;
    border-radius: 8px;
    color: #00ff88;
    margin: 8px 20px;
    min-height: 22px;
    text-align: center;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.aisa-thinking-cursor {
    display: inline-block;
    width: 8px;
    height: 13px;
    background: #00ff88;
    margin-left: 2px;
    animation: thinkingCursorBlink 0.6s infinite;
    vertical-align: middle;
}

@keyframes thinkingCursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 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(16, 26, 46, 0.12);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.2s;
    text-decoration: none;
    cursor: pointer;
    gap: 12px;
}

.aisa-product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
    transform: translateY(-1px);
}

.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: #2d6bff;
    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: #2d6bff;
    color: white;
}

.aisa-btn-primary:hover {
    background: #1e40af;
    color: white;
    transform: translateY(-1px);
}

.aisa-btn-secondary {
    background: white;
    color: #2d6bff;
    border: 1px solid #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: 1px solid rgba(16, 26, 46, 0.16);
    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 4px 12px rgba(0, 0, 0, 0.06);
    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: #2d6bff;
    box-shadow: 0 0 0 2px rgba(45, 107, 255, 0.20), 0 10px 24px rgba(0, 0, 0, 0.10);
}

#aisa-voice-btn {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: grid;
    place-items: center;
    background: rgba(71, 85, 105, 0.1);
    border: 1px solid rgba(16, 26, 46, 0.12);
    padding: 0;
    transition: all 0.2s ease;
}

#aisa-voice-btn:hover {
    background: rgba(71, 85, 105, 0.18);
}

#aisa-voice-btn.recording {
    background: radial-gradient(120% 120% at 15% 15%, #ef4444 0%, #dc2626 70%, #991b1b 100%);
    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-voice-btn svg {
    width: 20px;
    height: 20px;
    fill: #475569;
}

#aisa-voice-btn.recording svg {
    fill: #fff;
}

/* Image Upload Button */
#aisa-image-btn {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: grid;
    place-items: center;
    background: rgba(71, 85, 105, 0.1);
    border: 1px solid rgba(16, 26, 46, 0.12);
    padding: 0;
    transition: all 0.2s ease;
}

#aisa-image-btn:hover {
    background: rgba(71, 85, 105, 0.18);
}

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

#aisa-image-btn svg {
    width: 22px;
    height: 22px;
    fill: #475569;
}

#aisa-image-btn.has-image svg {
    fill: #10b981;
}

/* 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-send-btn {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: grid;
    place-items: center;
    background: radial-gradient(120% 120% at 15% 15%, #2d6bff 0%, #7a52ff 70%, #1f2540 100%);
    box-shadow: 0 8px 20px rgba(45, 107, 255, 0.30), inset 0 0 14px rgba(255, 255, 255, 0.20);
    padding: 0;
    transition: transform 0.12s ease, box-shadow 0.18s ease;
}

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

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

#aisa-send-btn svg {
    fill: #fff;
    width: 20px;
    height: 20px;
    transform: translateX(1px);
}

/* Mobile */
@media (max-width: 640px) {
    #aisa-chat-window {
        width: calc(100vw - 24px - env(safe-area-inset-right, 0px) - env(safe-area-inset-left, 0px));
        right: calc(12px + env(safe-area-inset-right, 0px));
        bottom: auto;
        top: calc(20px + env(safe-area-inset-top, 0px));
        height: calc(100vh - 120px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        max-height: calc(100vh - 120px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }

    .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: 18px;
    }

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

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

    .aisa-pill {
        font-size: 11px;
        padding: 4px 7px;
    }
    
    /* Compact boot terminal on mobile */
    .aisa-boot-msg {
        font-size: 11px;
        padding: 10px 14px;
        margin: 8px 16px;
        min-height: 20px;
        border-radius: 6px;
    }
    
    .aisa-boot-msg .cursor {
        width: 7px;
        height: 12px;
    }
    
    /* Compact thinking indicator on mobile */
    .aisa-thinking-indicator {
        font-size: 11px;
        padding: 8px 12px;
        margin: 6px 16px;
        min-height: 18px;
        border-radius: 6px;
    }
    
    .aisa-thinking-cursor {
        width: 7px;
        height: 12px;
    }
    
    /* Move chat bubble to top when open on mobile */
    #aisa-chat-window.aisa-open ~ #aisa-chat-button {
        bottom: auto;
        top: calc(40px + env(safe-area-inset-top, 0px));
        width: 42px;
        height: 42px;
        right: 12px;
    }
    
    #aisa-chat-window.aisa-open ~ #aisa-chat-button svg {
        width: 20px;
        height: 20px;
    }
    
    /* 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;
    }
    
    #aisa-send-btn {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }
    
    #aisa-voice-btn {
        width: 36px;
        height: 36px;
    }
    
    #aisa-voice-btn svg {
        width: 16px;
        height: 16px;
    }
    
    #aisa-image-btn {
        width: 36px;
        height: 36px;
    }
    
    #aisa-image-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .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;
        top: 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-right: 40px; /* Slightly less on mobile for smaller button */
    }
    
    .aisa-starter-prompt {
        font-size: 12.5px;
        padding: 7px 12px;
    }
}

/* Terminal Boot Sequence */
.aisa-boot-msg {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 600;
    padding: 12px 16px;
    background: #0a0e14;
    border: 1px solid #1e3a5f;
    border-radius: 8px;
    color: #00ff88;
    margin: 10px 20px;
    min-height: 24px;
    text-align: center;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.aisa-boot-msg .boot-line {
    display: inline;
}

.aisa-boot-msg .cursor {
    display: inline-block;
    width: 8px;
    height: 13px;
    background: #00ff88;
    margin-left: 2px;
    animation: bootCursorBlink 0.6s infinite;
    vertical-align: middle;
}

@keyframes bootCursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.aisa-boot-msg .success {
    color: #00ff88;
}

.aisa-boot-msg .white {
    color: #ffffff;
}

/* Recording Indicator Banner */
.aisa-recording-indicator {
    display: none;
    padding: 14px 24px;
    text-align: center;
    color: white;
    background: rgba(239, 68, 68, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    position: absolute;
    bottom: 70px;
    left: 12px;
    right: 12px;
    z-index: 10;
}

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

.aisa-recording-indicator.uploading {
    background: rgba(59, 130, 246, 0.8);
}

.aisa-indicator-main {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.aisa-indicator-sub {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.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;
    top: 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 */
}