/* --- Floating Assistant Widget --- */
.assist-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    font-family: 'Inter', sans-serif;
    transition: bottom 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.assist-widget.shifted {
    bottom: 90px;
}

/* Toggle Button */
.assist-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s, color 0.2s;
}

.assist-toggle:hover {
    transform: scale(1.1);
    background: #000;
}

.assist-toggle:active {
    transform: scale(0.95);
}

/* Light Mode Overrides for Toggle */
:root[data-theme="light"] .assist-toggle {
    background: #ffffff;
    color: #111;
    border-color: rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .assist-toggle:hover {
    background: #f0f0f0;
}

/* Panel Container */
.assist-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 360px;
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.hidden-panel {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

/* Panel Header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 12px;
    margin-bottom: 4px;
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.panel-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

/* Panel Body */
.panel-helper {
    font-size: 0.85rem;
    color: var(--muted);
    margin: 4px 0 8px 0;
    line-height: 1.4;
}

.ask-chips.compact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.chip.small {
    font-size: 0.75rem;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.chip.small:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Form */
.panel-form {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 6px 14px;
    transition: border-color 0.2s, background 0.2s;
}

.panel-form:focus-within {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.5);
}

.panel-form input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.95rem;
    padding: 8px 0;
    outline: none;
}

.ask-submit {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

.ask-submit:hover {
    color: var(--accent);
}

/* Response */
.panel-response {
    font-size: 0.9rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    padding: 16px;
    border-radius: 12px;
    border-left: 3px solid var(--accent);
    line-height: 1.6;
    animation: slideIn 0.3s ease;
    margin-top: 4px;
}

.ask-loading {
    color: var(--muted);
    font-size: 0.75rem;
    font-style: italic;
}

/* Light Mode Overrides (General) */
:root[data-theme="light"] .assist-panel {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .chip.small,
:root[data-theme="light"] .panel-form,
:root[data-theme="light"] .panel-response {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

/* Copy Button & Markdown support */
.answer-content {
    margin-bottom: 12px;
}

.answer-content b {
    font-weight: 700;
    color: var(--accent);
}

.answer-content li {
    margin-left: 10px;
}

.answer-copy {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.75rem;
    padding: 6px 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    float: right;
    margin-top: 0;
}

.answer-copy:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text);
}