/* ========================================
   DeepSearch - frontend chat component
   ======================================== */

:root {
    --ais-accent-blue: #8fb7ff;
    --ais-accent-mint: #98f0d8;
    --ais-accent-amber: #ffd07a;
    --ais-glass: rgba(16, 22, 35, 0.66);
    --ais-glass-strong: rgba(16, 22, 35, 0.82);
    --ais-glass-soft: rgba(255, 255, 255, 0.1);
    --ais-border: rgba(255, 255, 255, 0.18);
    --ais-border-strong: rgba(255, 255, 255, 0.28);
    --ais-text: #eef4ff;
    --ais-text-muted: rgba(238, 244, 255, 0.72);
    --ais-text-dim: rgba(238, 244, 255, 0.54);
    --ais-danger: #ff8a93;
    --ais-shadow: 0 28px 90px rgba(0, 0, 0, 0.52);
    --ais-shadow-soft: 0 14px 42px rgba(0, 0, 0, 0.28);
    --ais-radius: 20px;
    --ais-radius-sm: 8px;
    --ais-trans: 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

.aisearch-overlay,
.aisearch-floating-btn,
.aisearch-chat-panel,
.aisearch-chat-panel * {
    box-sizing: border-box;
}

.aisearch-overlay {
    position: fixed;
    inset: 0;
    z-index: 99991;
    background:
        radial-gradient(circle at 50% 38%, rgba(143, 183, 255, 0.13), transparent 38%),
        rgba(3, 6, 12, 0.72);
    -webkit-backdrop-filter: blur(9px) saturate(80%);
    backdrop-filter: blur(9px) saturate(80%);
    animation: ais-overlay-in 0.22s ease-out;
}

@keyframes ais-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.aisearch-floating-btn {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99990;
    width: 58px;
    height: 58px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: var(--ais-text);
    background:
        linear-gradient(145deg, rgba(143, 183, 255, 0.3), rgba(152, 240, 216, 0.18)),
        rgba(12, 18, 29, 0.74);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    backdrop-filter: blur(20px) saturate(140%);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
    user-select: none;
    transition: transform var(--ais-trans), border-color var(--ais-trans), box-shadow var(--ais-trans);
    -webkit-tap-highlight-color: transparent;
}

.aisearch-floating-btn:hover {
    transform: translateY(-2px) scale(1.03);
    border-color: rgba(255, 255, 255, 0.34);
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.4), 0 0 34px rgba(143, 183, 255, 0.2);
}

.aisearch-floating-btn:active {
    transform: translateY(0) scale(0.96);
}

.aisearch-floating-btn::after {
    content: "";
    position: absolute;
    inset: -5px;
    border: 1px solid rgba(152, 240, 216, 0.34);
    border-radius: 50%;
    pointer-events: none;
    animation: ais-pulse 2.2s infinite;
}

@keyframes ais-pulse {
    0% { transform: scale(0.9); opacity: 0.72; }
    70% { transform: scale(1.28); opacity: 0; }
    100% { transform: scale(1.28); opacity: 0; }
}

.aisearch-chat-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 99999;
    width: min(760px, calc(100vw - 32px));
    height: min(720px, calc(100vh - 64px));
    max-height: 760px;
    transform: translate(-50%, -50%);
    color: var(--ais-text);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05)),
        var(--ais-glass);
    border: 1px solid var(--ais-border);
    border-radius: var(--ais-radius);
    box-shadow: var(--ais-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(28px) saturate(140%);
    backdrop-filter: blur(28px) saturate(140%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    animation: ais-panel-in 0.26s ease-out;
}

@keyframes ais-panel-in {
    from { opacity: 0; transform: translate(-50%, -46%) scale(0.98); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.aisearch-chat-header {
    min-height: 62px;
    padding: 12px 16px 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    background:
        linear-gradient(135deg, rgba(143, 183, 255, 0.16), rgba(152, 240, 216, 0.08)),
        rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    user-select: none;
}

.aisearch-chat-title {
    min-width: 0;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--ais-text);
    font-size: 15px;
    font-weight: 650;
    letter-spacing: 0;
}

.aisearch-chat-title svg {
    flex: 0 0 auto;
    color: var(--ais-accent-mint);
}

.aisearch-chat-title span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aisearch-chat-clear,
.aisearch-chat-close {
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--ais-text);
    background: rgba(255, 255, 255, 0.09);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--ais-trans), border-color var(--ais-trans), transform var(--ais-trans);
    -webkit-tap-highlight-color: transparent;
}

.aisearch-chat-clear {
    min-width: 48px;
    height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.aisearch-chat-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
}

.aisearch-chat-clear:hover,
.aisearch-chat-close:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
}

.aisearch-chat-clear:active,
.aisearch-chat-close:active {
    transform: scale(0.96);
}

.aisearch-theme-toggle {
    width: 58px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    color: var(--ais-text);
    background: rgba(255, 255, 255, 0.09);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: background var(--ais-trans), border-color var(--ais-trans), transform var(--ais-trans);
    -webkit-tap-highlight-color: transparent;
}

.aisearch-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
}

.aisearch-theme-toggle:active {
    transform: scale(0.96);
}

.aisearch-theme-track {
    position: relative;
    width: 46px;
    height: 22px;
    border-radius: 999px;
    display: block;
}

.aisearch-theme-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.26);
    transition: transform var(--ais-trans), background var(--ais-trans);
}

.aisearch-theme-sun,
.aisearch-theme-moon {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    transform: translateY(-50%);
    opacity: 0.82;
}

.aisearch-theme-sun {
    left: 5px;
    border-radius: 50%;
    background: #ffd07a;
    box-shadow: 0 0 0 2px rgba(255, 208, 122, 0.22);
}

.aisearch-theme-moon {
    right: 5px;
    border-radius: 50%;
    background: #8fb7ff;
}

.aisearch-theme-moon::after {
    content: "";
    position: absolute;
    top: -1px;
    left: -3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(16, 22, 35, 0.88);
}

.aisearch-chat-panel.aisearch-theme-dark .aisearch-theme-thumb {
    transform: translateX(24px);
    background: #dfe8ff;
}

.aisearch-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(0, 0, 0, 0.08));
    scroll-behavior: smooth;
}

.aisearch-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.aisearch-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.aisearch-chat-messages::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(238, 244, 255, 0.26);
    background-clip: content-box;
}

.aisearch-message {
    max-width: 100%;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: ais-message-in 0.22s ease-out;
}

@keyframes ais-message-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.aisearch-message-user {
    flex-direction: row-reverse;
}

.aisearch-message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: rgba(7, 12, 20, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 750;
    user-select: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 10px 24px rgba(0, 0, 0, 0.22);
}

.aisearch-message-bot .aisearch-message-avatar {
    background: linear-gradient(145deg, var(--ais-accent-mint), var(--ais-accent-blue));
}

.aisearch-message-user .aisearch-message-avatar {
    background: linear-gradient(145deg, var(--ais-accent-amber), #ff9a72);
}

.aisearch-message-content {
    max-width: min(620px, calc(100% - 46px));
    padding: 11px 14px;
    border-radius: var(--ais-radius-sm);
    font-size: 14px;
    line-height: 1.68;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-shadow: var(--ais-shadow-soft);
}

.aisearch-message-bot .aisearch-message-content {
    color: var(--ais-text);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top-left-radius: 3px;
}

.aisearch-message-user .aisearch-message-content {
    color: #07111c;
    background: linear-gradient(135deg, rgba(152, 240, 216, 0.96), rgba(143, 183, 255, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-top-right-radius: 3px;
}

.aisearch-message-content p {
    margin: 0 0 8px;
}

.aisearch-message-content p:last-child {
    margin-bottom: 0;
}

.aisearch-message-content ul,
.aisearch-message-content ol {
    margin: 6px 0;
    padding-left: 20px;
}

.aisearch-message-content li {
    margin: 3px 0;
}

.aisearch-message-content a {
    color: var(--ais-accent-mint);
    text-decoration: none;
    word-break: break-all;
}

.aisearch-message-user .aisearch-message-content a {
    color: #06264d;
    font-weight: 650;
}

.aisearch-message-content a:hover {
    text-decoration: underline;
}

.aisearch-message-content code {
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 13px;
    font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
}

.aisearch-message-user .aisearch-message-content code {
    background: rgba(7, 17, 28, 0.12);
    color: #07111c;
}

.aisearch-message-content pre {
    margin: 8px 0;
    padding: 12px;
    border-radius: var(--ais-radius-sm);
    overflow-x: auto;
    color: #dfe8ff;
    background: rgba(2, 6, 12, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.11);
    font-size: 12px;
}

.aisearch-message-content pre code {
    padding: 0;
    color: inherit;
    background: none;
}

.aisearch-articles-list {
    width: min(620px, calc(100% - 46px));
    margin-left: 44px;
    padding-top: 2px;
    display: grid;
    gap: 8px;
    animation: ais-message-in 0.22s ease-out;
}

.aisearch-articles-label {
    color: var(--ais-text-dim);
    font-size: 12px;
    line-height: 1.4;
}

.aisearch-article-card {
    display: block;
    padding: 10px 12px;
    color: inherit;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-left: 3px solid var(--ais-accent-mint);
    border-radius: var(--ais-radius-sm);
    transition: background var(--ais-trans), border-color var(--ais-trans), transform var(--ais-trans);
}

.aisearch-article-card:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.24);
    transform: translateY(-1px);
}

.aisearch-article-title {
    margin-bottom: 4px;
    color: var(--ais-text);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.45;
}

.aisearch-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--ais-text-dim);
    font-size: 11px;
    line-height: 1.45;
}

.aisearch-article-snippet {
    margin-top: 5px;
    color: var(--ais-text-muted);
    font-size: 12px;
    line-height: 1.55;
}

.aisearch-loading {
    min-width: 46px;
    min-height: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.aisearch-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ais-accent-mint);
    opacity: 0.45;
    animation: ais-bounce 1.4s infinite ease-in-out both;
}

.aisearch-loading-dot:nth-child(1) { animation-delay: -0.32s; }
.aisearch-loading-dot:nth-child(2) { animation-delay: -0.16s; }
.aisearch-loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes ais-bounce {
    0%, 80%, 100% { transform: scale(0.45); opacity: 0.35; }
    40% { transform: scale(1); opacity: 1; }
}

.aisearch-error {
    padding: 9px 11px;
    color: #fff5f6;
    background: rgba(255, 82, 96, 0.14);
    border: 1px solid rgba(255, 138, 147, 0.34);
    border-left: 3px solid var(--ais-danger);
    border-radius: var(--ais-radius-sm);
    font-size: 13px;
    line-height: 1.55;
}

.aisearch-notice {
    align-self: center;
    max-width: 86%;
    padding: 6px 11px;
    border-radius: 999px;
    color: #211402;
    background: rgba(255, 208, 122, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: 12px;
    line-height: 1.45;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.aisearch-highlight {
    padding: 1px 3px;
    border-radius: 4px;
    color: #08111c;
    background: rgba(255, 208, 122, 0.9);
}

.aisearch-chat-footer {
    padding: 14px 16px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.12)),
        rgba(10, 15, 24, 0.36);
    flex-shrink: 0;
}

.aisearch-chat-input-wrap {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.aisearch-chat-input {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 15px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    outline: none;
    color: var(--ais-text);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
    font-size: 14px;
    transition: border-color var(--ais-trans), box-shadow var(--ais-trans), background var(--ais-trans);
}

.aisearch-chat-input:focus {
    border-color: rgba(152, 240, 216, 0.68);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 0 0 4px rgba(152, 240, 216, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.aisearch-chat-input::placeholder {
    color: rgba(238, 244, 255, 0.44);
}

.aisearch-chat-send {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 50%;
    color: #07111c;
    background: linear-gradient(135deg, var(--ais-accent-mint), var(--ais-accent-blue));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: transform var(--ais-trans), filter var(--ais-trans), opacity var(--ais-trans);
    -webkit-tap-highlight-color: transparent;
}

.aisearch-chat-send:hover {
    transform: translateY(-1px) scale(1.03);
    filter: brightness(1.04);
}

.aisearch-chat-send:active {
    transform: scale(0.96);
}

.aisearch-chat-send:disabled {
    cursor: not-allowed;
    transform: none;
    filter: grayscale(0.25);
}

.aisearch-chat-hint {
    margin-top: 7px;
    text-align: center;
    color: var(--ais-text-dim);
    font-size: 11px;
    line-height: 1.4;
}

.aisearch-overlay.aisearch-theme-light {
    background:
        radial-gradient(circle at 50% 38%, rgba(92, 124, 250, 0.13), transparent 40%),
        rgba(245, 240, 230, 0.6);
    -webkit-backdrop-filter: blur(8px) saturate(112%);
    backdrop-filter: blur(8px) saturate(112%);
}

.aisearch-floating-btn.aisearch-theme-light {
    --ais-text: #302a21;
    color: var(--ais-text);
    border-color: rgba(83, 68, 45, 0.18);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.46), rgba(92, 124, 250, 0.13)),
        rgba(255, 250, 241, 0.8);
    box-shadow: 0 16px 38px rgba(74, 58, 33, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.aisearch-floating-btn.aisearch-theme-light:hover {
    border-color: rgba(63, 189, 161, 0.38);
    box-shadow: 0 20px 46px rgba(74, 58, 33, 0.22), 0 0 28px rgba(92, 124, 250, 0.14);
}

.aisearch-floating-btn.aisearch-theme-light::after {
    border-color: rgba(63, 189, 161, 0.3);
}

.aisearch-chat-panel.aisearch-theme-light {
    --ais-accent-blue: #5c7cfa;
    --ais-accent-mint: #36b99b;
    --ais-accent-amber: #d9822b;
    --ais-border: rgba(89, 74, 47, 0.16);
    --ais-border-strong: rgba(89, 74, 47, 0.24);
    --ais-text: #2d281f;
    --ais-text-muted: rgba(45, 40, 31, 0.72);
    --ais-text-dim: rgba(45, 40, 31, 0.5);
    --ais-danger: #b9434e;
    --ais-shadow: 0 26px 76px rgba(74, 58, 33, 0.24);
    --ais-shadow-soft: 0 12px 30px rgba(74, 58, 33, 0.14);
    color: var(--ais-text);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.64), rgba(255, 248, 235, 0.34)),
        rgba(255, 250, 241, 0.78);
    border-color: rgba(89, 74, 47, 0.16);
    box-shadow: var(--ais-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-header {
    border-bottom-color: rgba(89, 74, 47, 0.12);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(92, 124, 250, 0.08)),
        rgba(255, 250, 241, 0.28);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-title svg {
    color: var(--ais-accent-mint);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-clear,
.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-close,
.aisearch-chat-panel.aisearch-theme-light .aisearch-theme-toggle {
    color: var(--ais-text);
    border-color: rgba(89, 74, 47, 0.13);
    background: rgba(255, 255, 255, 0.44);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-clear:hover,
.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-close:hover,
.aisearch-chat-panel.aisearch-theme-light .aisearch-theme-toggle:hover {
    border-color: rgba(63, 189, 161, 0.32);
    background: rgba(255, 255, 255, 0.66);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-theme-thumb {
    background: #fff9ee;
    box-shadow: 0 5px 12px rgba(74, 58, 33, 0.18);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-theme-moon::after {
    background: rgba(255, 250, 241, 0.86);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-messages {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(120, 91, 43, 0.04));
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(89, 74, 47, 0.24);
    background-clip: content-box;
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-message-avatar {
    color: #162219;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 8px 18px rgba(74, 58, 33, 0.12);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-message-bot .aisearch-message-content {
    color: var(--ais-text);
    background: rgba(255, 255, 255, 0.58);
    border-color: rgba(89, 74, 47, 0.13);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-message-user .aisearch-message-content {
    color: #102118;
    background: linear-gradient(135deg, rgba(167, 232, 215, 0.96), rgba(170, 192, 255, 0.9));
    border-color: rgba(255, 255, 255, 0.5);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-message-content a {
    color: #1f7f6c;
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-message-user .aisearch-message-content a {
    color: #1f407a;
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-message-content code {
    color: #2d281f;
    background: rgba(45, 40, 31, 0.08);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-message-content pre {
    color: #233044;
    background: rgba(255, 255, 255, 0.62);
    border-color: rgba(89, 74, 47, 0.12);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-article-card {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(89, 74, 47, 0.12);
    border-left-color: var(--ais-accent-mint);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-article-card:hover {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(63, 189, 161, 0.26);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-article-title {
    color: var(--ais-text);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-error {
    color: #5d141c;
    background: rgba(255, 138, 147, 0.14);
    border-color: rgba(185, 67, 78, 0.24);
    border-left-color: var(--ais-danger);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-notice,
.aisearch-chat-panel.aisearch-theme-light .aisearch-highlight {
    color: #35210a;
    background: rgba(255, 208, 122, 0.74);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-footer {
    border-top-color: rgba(89, 74, 47, 0.12);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 249, 238, 0.54)),
        rgba(255, 250, 241, 0.28);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-input {
    color: var(--ais-text);
    border-color: rgba(89, 74, 47, 0.16);
    background: rgba(255, 255, 255, 0.64);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-input:focus {
    border-color: rgba(63, 189, 161, 0.56);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 0 0 4px rgba(63, 189, 161, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-input::placeholder {
    color: rgba(45, 40, 31, 0.42);
}

.aisearch-chat-panel.aisearch-theme-light .aisearch-chat-send {
    color: #102118;
    border-color: rgba(255, 255, 255, 0.54);
    background: linear-gradient(135deg, #8fe6cf, #9bb1ff);
    box-shadow: 0 12px 24px rgba(74, 58, 33, 0.16);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .aisearch-overlay {
        background: rgba(3, 6, 12, 0.82);
    }

    .aisearch-floating-btn,
    .aisearch-chat-panel {
        background: rgba(16, 22, 35, 0.96);
    }

    .aisearch-overlay.aisearch-theme-light {
        background: rgba(245, 240, 230, 0.78);
    }

    .aisearch-floating-btn.aisearch-theme-light,
    .aisearch-chat-panel.aisearch-theme-light {
        background: rgba(255, 250, 241, 0.96);
    }
}

@media (max-width: 768px) {
    .aisearch-overlay {
        background: rgba(3, 6, 12, 0.78);
    }

    .aisearch-overlay.aisearch-theme-light {
        background: rgba(245, 240, 230, 0.7);
    }

    .aisearch-floating-btn {
        right: 16px;
        bottom: 16px;
        width: 52px;
        height: 52px;
    }

    .aisearch-chat-panel {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        transform: none;
        border-right: 0;
        border-left: 0;
        animation: ais-panel-mobile-in 0.24s ease-out;
    }

    @keyframes ais-panel-mobile-in {
        from { opacity: 0; transform: translateY(18px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .aisearch-chat-header {
        min-height: 58px;
        padding: 10px 12px 10px 14px;
    }

    .aisearch-chat-title {
        font-size: 14px;
    }

    .aisearch-chat-clear {
        min-width: 44px;
        padding: 0 10px;
    }

    .aisearch-theme-toggle {
        width: 54px;
    }

    .aisearch-chat-messages {
        padding: 14px 12px;
        gap: 12px;
    }

    .aisearch-message-content {
        max-width: calc(100% - 44px);
        font-size: 14px;
    }

    .aisearch-articles-list {
        width: calc(100% - 44px);
        margin-left: 44px;
    }

    .aisearch-chat-footer {
        padding: 12px 12px max(12px, env(safe-area-inset-bottom));
    }

    .aisearch-chat-input {
        height: 42px;
    }

    .aisearch-chat-send {
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 420px) {
    .aisearch-chat-close {
        width: 30px;
        height: 30px;
    }

    .aisearch-message-avatar {
        width: 32px;
        height: 32px;
    }

    .aisearch-message-content {
        max-width: calc(100% - 42px);
        padding: 10px 12px;
    }

    .aisearch-articles-list {
        width: calc(100% - 42px);
        margin-left: 42px;
    }
}
