#ai-bot-widget-container {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    max-width: calc(100vw - 24px);
    pointer-events: none;
}

#ai-bot-widget-container > * {
    pointer-events: auto;
}

.ai-bot-widget-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 52px;
    max-width: min(100%, 320px);
    padding: 14px 20px;
    border-radius: 999px;
    background: linear-gradient(135deg, #48b5ff, #8b5cf6);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    font-family: Inter, Arial, sans-serif;
    font-size: 0.97rem;
    line-height: 1.2;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: 0 18px 45px rgba(72, 181, 255, 0.22);
    letter-spacing: 0.01em;
    white-space: normal;
    text-align: center;
    overflow-wrap: anywhere;
    flex-wrap: wrap;
}

.ai-bot-widget-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 60px rgba(72, 181, 255, 0.28);
}

.ai-bot-widget-button::before {
    content: '✦';
    font-size: 0.9rem;
}

.ai-bot-widget-panel {
    position: fixed;
    right: 16px;
    bottom: 82px;
    width: min(420px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    height: min(620px, calc(100vh - 100px));
    max-height: calc(100vh - 100px);
    background: #07111f;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.ai-bot-widget-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ai-bot-widget-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #0f172a;
    color: #ffffff;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-bot-widget-close {
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.ai-bot-widget-iframe {
    width: 100%;
    height: calc(100% - 56px);
    border: 0;
    background: #07111f;
}

.ai-bot-widget-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: #0f172a;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
}

.ai-bot-widget-footer a {
    color: #8ab7ff;
    text-decoration: none;
}

.ai-bot-widget-footer a:hover {
    text-decoration: underline;
}

.ai-bot-widget-dark .ai-bot-widget-button {
    background: #111827;
}

.voice-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    color: rgba(255, 255, 255, 0.72);
    background: #0f172a;
    font-size: 0.78rem;
}

.voice-button,
.voice-stop {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 10px;
    background: #1f2937;
    color: #fff;
    cursor: pointer;
}

.voice-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-controls #voice-status {
    min-width: 82px;
}

.voice-button.is-listening::before,
.voice-button.is-thinking::before,
.voice-button.is-speaking::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: #6ee7b7;
    animation: voice-pulse 1.2s ease-in-out infinite;
}

.voice-button.is-thinking::before { background: #fcd34d; }
.voice-button.is-speaking::before { background: #f87171; }

@keyframes voice-pulse {
    0%, 100% { transform: scale(0.75); opacity: 0.55; }
    50% { transform: scale(1.15); opacity: 1; }
}

@media (max-width: 640px) {
    #ai-bot-widget-container {
        right: 12px;
        bottom: 12px;
        max-width: calc(100vw - 24px);
        align-items: stretch;
    }

    .ai-bot-widget-button {
        width: auto;
        max-width: calc(100vw - 24px);
        min-height: 48px;
        padding: 12px 16px;
        font-size: 0.95rem;
    }

    .ai-bot-widget-panel {
        right: 12px;
        bottom: 74px;
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        height: min(72vh, 560px);
        max-height: calc(100vh - 88px);
        border-radius: 20px;
    }

    .ai-bot-widget-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
