/* Site AI assistant — fixed left side */
.site-assistant-root {
    position: fixed;
    left: 20px;
    bottom: 24px;
    z-index: 9998;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    width: min(380px, calc(100% - 40px));
    max-width: 380px;
    overflow: visible;
    pointer-events: none;
}

.site-assistant-root > * {
    pointer-events: auto;
}

.site-assistant-root[hidden] {
    display: none !important;
}

.site-assistant-launcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem 0.65rem 0.85rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 8px 28px rgba(79, 70, 229, 0.45);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: visible;
    position: relative;
}

.site-assistant-launcher.has-avatar {
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.55rem 1.1rem 0.7rem;
    padding-top: 1.85rem;
    border-radius: 20px;
    margin-top: 1.25rem;
}

.site-assistant-launcher-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 50%;
}

.site-assistant-launcher.has-avatar .site-assistant-launcher-icon {
    position: absolute;
    top: -1.35rem;
    left: 50%;
    transform: translateX(-50%);
    width: 52px;
    height: 52px;
    border: 3px solid #fff;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28);
    z-index: 2;
}

.site-assistant-launcher-icon i {
    font-size: 1.15rem;
}

.site-assistant-launcher-icon img,
.site-assistant-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    display: block;
}

.site-assistant-launcher i {
    font-size: 1.15rem;
}

.site-assistant-avatar.has-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.site-assistant-launcher:hover {
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.55);
}

.site-assistant-launcher:not(.has-avatar):hover {
    transform: translateY(-2px);
}

.site-assistant-launcher.is-open {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

.site-assistant-panel {
    position: absolute;
    left: 0;
    bottom: 0;
    width: min(380px, calc(100% - 0px));
    max-width: 100%;
    height: min(520px, calc(100vh - 100px));
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.96);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.site-assistant-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.site-assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.35), rgba(124, 58, 237, 0.25));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-assistant-header-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.site-assistant-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c4b5fd;
    flex-shrink: 0;
}

.site-assistant-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-assistant-subtitle {
    font-size: 0.72rem;
    color: rgba(248, 250, 252, 0.65);
}

.site-assistant-header-actions {
    display: flex;
    gap: 0.25rem;
}

.site-assistant-icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    cursor: pointer;
}

.site-assistant-icon-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.site-assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scroll-behavior: smooth;
}

.site-assistant-msg {
    max-width: 92%;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    font-size: 0.86rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.site-assistant-msg--bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
}

.site-assistant-msg--user {
    align-self: flex-end;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.site-assistant-msg--typing {
    opacity: 0.7;
    font-style: italic;
}

.site-assistant-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0 1rem 0.5rem;
}

.site-assistant-chip {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.72rem;
    cursor: pointer;
    transition: background 0.15s;
}

.site-assistant-chip:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #fff;
}

.site-assistant-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.site-assistant-input {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #f8fafc;
    border-radius: 12px;
    padding: 0.55rem 0.75rem;
    font-size: 0.86rem;
}

.site-assistant-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.site-assistant-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

.site-assistant-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.site-assistant-launcher-icon.has-image {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
}

@media (max-width: 576px) {
    .site-assistant-root {
        left: 12px;
        bottom: 20px;
        width: min(380px, calc(100% - 24px));
        max-width: none;
    }

    .site-assistant-launcher:not(.has-avatar) .site-assistant-launcher-label {
        display: none;
    }

    .site-assistant-launcher:not(.has-avatar) {
        width: 52px;
        height: 52px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .site-assistant-launcher:not(.has-avatar) .site-assistant-launcher-icon {
        width: 100%;
        height: 100%;
        border-radius: 50%;
    }

    .site-assistant-launcher.has-avatar {
        width: auto;
        min-width: 88px;
        margin-top: 1.5rem;
        padding-top: 2rem;
        padding-bottom: 0.55rem;
        border-radius: 18px;
    }

    .site-assistant-launcher.has-avatar .site-assistant-launcher-icon {
        top: -1.5rem;
        width: 56px;
        height: 56px;
    }

    .site-assistant-launcher.has-avatar .site-assistant-launcher-label {
        display: block;
        font-size: 0.78rem;
        line-height: 1.1;
        text-align: center;
    }

    .site-assistant-panel {
        width: 100%;
        max-width: 100%;
        height: min(70vh, 480px);
    }
}
