.wp-pan-search-chat-container {
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    position: relative;
}

.pan-search-chat-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.pan-search-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
}

.pan-search-avatar .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.pan-search-header-info {
    flex: 1;
    min-width: 0;
}

.pan-search-header-info h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pan-search-status {
    font-size: 11px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pan-search-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pan-search-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.pan-search-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.pan-search-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.pan-search-chat-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.pan-search-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

.pan-search-message {
    display: flex;
    margin-bottom: 14px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pan-search-message.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pan-search-message.user-message .message-avatar {
    background: #667eea;
    color: #fff;
}

.message-avatar .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.message-content {
    max-width: 75%;
    margin: 0 8px;
    min-width: 0;
}

.pan-search-message.user-message .message-content {
    text-align: right;
}

.message-content p {
    margin: 0;
    padding: 10px 14px;
    border-radius: 16px;
    display: inline-block;
    text-align: left;
    word-wrap: break-word;
    max-width: 100%;
    line-height: 1.5;
}

.pan-search-message.bot-message .message-content p {
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.pan-search-message.user-message .message-content p {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.pan-search-result-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 12px;
    margin-top: 8px;
    max-width: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}

.pan-search-result-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.result-title {
    font-weight: 600;
    color: #0073aa;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.result-title:hover {
    color: #005a87;
    text-decoration: underline;
}

.result-category {
    display: inline-block;
    background: linear-gradient(135deg, #e8f4f8 0%, #d4edda 100%);
    color: #0085ba;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    white-space: nowrap;
}

.result-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: -2px 0 10px;
}

.result-quality-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(41, 121, 255, 0.1);
    color: #1f5ca8;
    font-size: 11px;
    font-weight: 700;
}

.result-quality-score {
    font-size: 11px;
    color: #6b7f99;
}

.result-merge-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(40, 167, 69, 0.12);
    color: #1a7f45;
    font-size: 11px;
    font-weight: 700;
}

.result-source-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.result-source-label {
    font-size: 11px;
    color: #6b7f99;
    line-height: 24px;
}

.result-source-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.result-source-tag {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: #f4f7fb;
    color: #385375;
    font-size: 11px;
    font-weight: 600;
}

.result-link-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #fafafa;
    border-radius: 8px;
    margin: 8px 0;
    flex-wrap: wrap;
    border: 1px solid #f0f0f0;
}

.link-type {
    font-weight: 500;
    color: #333;
    font-size: 13px;
    min-width: 60px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.link-type::before {
    content: '📁';
    font-size: 14px;
}

.link-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.code-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.code-text {
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
    font-size: 13px;
    font-weight: 600;
    color: #e74c3c;
    letter-spacing: 0.5px;
}

.copy-btn {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.copy-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn:disabled {
    background: #95a5a6;
    cursor: default;
    transform: none;
}

.copy-btn.copied {
    background: #27ae60;
}

.open-link-btn {
    background: #27ae60;
    color: #fff;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.open-link-btn:hover {
    background: #219a52;
    color: #fff;
    transform: translateY(-1px);
}

.open-link-btn:active {
    transform: translateY(0);
}

.open-link-btn.copied {
    background: #1f7a45;
}

.result-code-only {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #fafafa;
    border-radius: 8px;
    margin: 8px 0;
    flex-wrap: wrap;
    border: 1px solid #f0f0f0;
}

.code-label {
    font-size: 13px;
    color: #666;
}

.result-description {
    font-size: 12px;
    color: #888;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e8e8e8;
    line-height: 1.5;
}

.result-title mark,
.link-type mark,
.result-category mark,
.result-description mark {
    background: rgba(255, 225, 107, 0.55);
    color: inherit;
    padding: 0 2px;
    border-radius: 4px;
}

.pan-search-discovery-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 2px;
}

.pan-search-discovery-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pan-search-discovery-title {
    font-size: 12px;
    font-weight: 700;
    color: #5b6f8c;
}

.pan-search-discovery-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pan-search-inline-tag {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid #d7e3f4;
    border-radius: 999px;
    background: #f6f9ff;
    color: #1f4c87;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pan-search-inline-tag:hover {
    transform: translateY(-1px);
    border-color: #8ab2e4;
    box-shadow: 0 8px 16px rgba(31, 76, 135, 0.08);
}

.pan-search-secondary-text {
    margin-top: 6px;
    font-size: 12px;
    color: #6e7e95;
}

.pan-search-filter-summary {
    margin: 6px 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f5f8fc;
    color: #5f7592;
    font-size: 12px;
}

.pan-search-filter-summary strong {
    color: #1f4c87;
}

.pan-search-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e8eef6;
}

.pan-search-pagination-meta {
    font-size: 12px;
    color: #5f738c;
}

.pan-search-load-more-btn {
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid #c7d8ec;
    border-radius: 999px;
    background: linear-gradient(135deg, #f7fbff 0%, #e7f0fb 100%);
    color: #214f84;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pan-search-load-more-btn:hover {
    transform: translateY(-1px);
    border-color: #8ab1df;
    box-shadow: 0 10px 20px rgba(36, 84, 140, 0.08);
}

.pan-search-load-more-btn:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.pan-search-load-more-finished {
    font-size: 12px;
    color: #6d7f92;
}

.pan-search-recommend-list {
    display: grid;
    gap: 8px;
}

.pan-search-recommend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    background: #f8fbff;
    border: 1px solid #e1ebf8;
    color: #24466d;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pan-search-recommend-item:hover {
    transform: translateY(-1px);
    border-color: #c2d7f0;
    box-shadow: 0 10px 20px rgba(36, 70, 109, 0.08);
}

.pan-search-recommend-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

.result-share-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.pan-search-share-btn {
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid #d8e6f5;
    border-radius: 999px;
    background: linear-gradient(135deg, #f7fbff 0%, #eef5ff 100%);
    color: #204c7d;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pan-search-share-btn:hover {
    transform: translateY(-1px);
    border-color: #8ab1df;
    box-shadow: 0 10px 20px rgba(36, 84, 140, 0.08);
}

.pan-search-share-btn.copied {
    background: linear-gradient(135deg, #1f9d57 0%, #2dbb6d 100%);
    border-color: transparent;
    color: #fff;
}

.pan-search-recommend-meta {
    flex-shrink: 0;
    font-size: 11px;
    color: #5b7b9f;
}

.pan-search-chat-input {
    padding: 12px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    flex-shrink: 0;
    position: relative;
}

#pan-search-form,
.js-pan-search-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

#pan-search-input,
.pan-search-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e8e8e8;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
    min-width: 0;
    background: #fafafa;
}

#pan-search-input:focus,
.pan-search-input:focus {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#pan-search-input::placeholder,
.pan-search-input::placeholder {
    color: #aaa;
}

#pan-search-submit,
.pan-search-submit {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#pan-search-submit:hover,
.pan-search-submit:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#pan-search-submit:active,
.pan-search-submit:active {
    transform: scale(0.98);
}

#pan-search-submit .dashicons,
.pan-search-submit .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

#pan-search-submit:disabled,
.pan-search-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #f0f0f0;
    border-radius: 16px;
    display: inline-flex;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.pan-search-quick-tags {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: #fafafa;
    border-top: 1px solid #e8e8e8;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}

.pan-search-quick-tags::-webkit-scrollbar {
    height: 4px;
}

.pan-search-quick-tags::-webkit-scrollbar-track {
    background: transparent;
}

.pan-search-quick-tags::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.quick-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.quick-tag:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.quick-tag .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.pan-search-category-filters {
    display: flex;
    gap: 8px;
    padding: 8px 12px 12px;
    background: linear-gradient(180deg, #fafafa 0%, #f6f9fd 100%);
    border-top: 1px solid #e8e8e8;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}

.pan-search-source-filters {
    display: none;
    gap: 8px;
    padding: 0 12px 12px;
    background: linear-gradient(180deg, #fafafa 0%, #f6f9fd 100%);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}

.pan-search-source-filters.is-visible {
    display: flex;
}

.pan-search-category-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid #d9e4f0;
    background: #fff;
    color: #4e6786;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.pan-search-category-chip:hover {
    transform: translateY(-1px);
    border-color: #8fb1d8;
    box-shadow: 0 10px 20px rgba(42, 92, 199, 0.08);
}

.pan-search-category-chip.is-active {
    background: linear-gradient(135deg, #1d76d2 0%, #5b73f3 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 12px 22px rgba(42, 92, 199, 0.2);
}

.pan-search-source-chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid #e0e7ef;
    background: #fff;
    color: #5a708c;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.pan-search-source-chip:hover {
    transform: translateY(-1px);
    border-color: #8fb1d8;
    box-shadow: 0 8px 16px rgba(42, 92, 199, 0.08);
}

.pan-search-source-chip.is-active {
    background: linear-gradient(135deg, #244d7f 0%, #4f6ed1 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 20px rgba(42, 92, 199, 0.16);
}

.pan-search-wechat-guide {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 99999;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.pan-search-wechat-guide__content {
    width: min(560px, 100%);
    padding: 16px;
    border-radius: 18px;
    background: rgba(17, 30, 49, 0.95);
    color: #fff;
    box-shadow: 0 20px 50px rgba(10, 23, 39, 0.28);
    pointer-events: auto;
}

.pan-search-wechat-guide__title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
}

.pan-search-wechat-guide__desc {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.82);
}

.pan-search-wechat-guide__actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.pan-search-wechat-guide__button {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.pan-search-wechat-guide__button.is-primary {
    background: linear-gradient(135deg, #55a8ff 0%, #6f7dff 100%);
    border-color: transparent;
}

.pan-search-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.pan-search-empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.pan-search-empty-state p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .wp-pan-search-chat-container {
        border-radius: 0;
        height: 100vh !important;
        width: 100vw !important;
        max-width: 100%;
    }
    
    .pan-search-chat-header {
        padding: 10px 12px;
    }
    
    .pan-search-avatar {
        width: 36px;
        height: 36px;
    }
    
    .pan-search-header-info h3 {
        font-size: 14px;
    }
    
    .pan-search-chat-messages {
        padding: 12px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .message-content p {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
    }
    
    .message-avatar .dashicons {
        font-size: 14px;
        width: 14px;
        height: 14px;
    }
    
    .pan-search-result-card {
        padding: 10px;
        border-radius: 8px;
    }
    
    .result-title {
        font-size: 13px;
    }
    
    .result-link-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 10px;
    }
    
    .link-type {
        min-width: auto;
    }
    
    .link-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .code-box {
        flex: 1;
        min-width: 0;
    }
    
    .copy-btn,
    .open-link-btn {
        flex: 1;
        justify-content: center;
        padding: 8px 12px;
    }
    
    #pan-search-input,
    .pan-search-input {
        padding: 10px 12px;
        font-size: 16px;
    }
    
    #pan-search-submit,
    .pan-search-submit {
        width: 40px;
        height: 40px;
    }
    
    .pan-search-quick-tags {
        padding: 8px 10px;
    }

    .pan-search-category-filters {
        padding: 8px 10px 10px;
    }

    .pan-search-source-filters {
        padding: 0 10px 10px;
    }
    
    .quick-tag {
        padding: 5px 10px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .pan-search-chat-header {
        padding: 8px 10px;
    }
    
    .pan-search-chat-messages {
        padding: 10px;
    }
    
    .message-content {
        max-width: 90%;
        margin: 0 6px;
    }
    
    .message-content p {
        padding: 8px 10px;
        font-size: 13px;
        border-radius: 12px;
    }
    
    .pan-search-result-card {
        padding: 8px;
        margin-top: 6px;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .result-meta-row {
        margin-top: -4px;
    }
    
    .result-title {
        font-size: 12px;
    }
    
    .result-link-item {
        padding: 8px;
        margin: 6px 0;
    }
    
    .link-type {
        font-size: 12px;
    }
    
    .code-text {
        font-size: 12px;
    }
    
    .copy-btn,
    .open-link-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    #pan-search-input,
    .pan-search-input {
        padding: 8px 10px;
        font-size: 16px;
        border-radius: 18px;
    }
    
    #pan-search-submit,
    .pan-search-submit {
        width: 38px;
        height: 38px;
    }
    
    #pan-search-submit .dashicons,
    .pan-search-submit .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }
    
    .pan-search-chat-input {
        padding: 10px;
    }
}

@media (min-width: 769px) {
    .wp-pan-search-chat-container {
        max-height: 800px;
    }
    
    .pan-search-chat-messages {
        max-height: calc(800px - 140px);
    }
}

@media (hover: none) and (pointer: coarse) {
    .copy-btn:hover,
    .open-link-btn:hover,
    #pan-search-submit:hover,
    .pan-search-submit:hover,
    .quick-tag:hover,
    .pan-search-category-chip:hover {
        transform: none;
    }
    
    .copy-btn:active {
        background: #5568d3;
    }
    
    .open-link-btn:active {
        background: #219a52;
    }
    
    #pan-search-submit:active,
    .pan-search-submit:active {
        transform: scale(0.98);
    }
    
    .quick-tag:active {
        background: #667eea;
        color: #fff;
    }

    .pan-search-category-chip:active {
        background: #eff5fb;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pan-search-message,
    .copy-btn,
    .open-link-btn,
    #pan-search-submit,
    .pan-search-submit,
    .quick-tag,
    .pan-search-category-chip {
        animation: none;
        transition: none;
    }
    
    .pan-search-status::before {
        animation: none;
    }
    
    .typing-indicator span {
        animation: none;
        opacity: 0.7;
    }
}

@media (prefers-color-scheme: dark) {
    .wp-pan-search-chat-container {
        background: #1a1a1a;
    }
    
    .pan-search-chat-messages {
        background: #1f1f1f;
    }
    
    .pan-search-message.bot-message .message-content p {
        background: #2a2a2a;
        color: #e0e0e0;
    }
    
    .pan-search-result-card {
        background: #252525;
        border-color: #333;
    }
    
    .result-title {
        color: #6cb2eb;
    }
    
    .result-title:hover {
        color: #93c5fd;
    }
    
    .result-link-item,
    .result-code-only {
        background: #2a2a2a;
        border-color: #333;
    }
    
    .link-type {
        color: #e0e0e0;
    }
    
    .code-box {
        background: #1f1f1f;
        border-color: #444;
    }
    
    .result-description {
        color: #888;
        border-color: #333;
    }
    
    .pan-search-chat-input {
        background: #1f1f1f;
        border-color: #333;
    }
    
    #pan-search-input,
    .pan-search-input {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    #pan-search-input:focus,
    .pan-search-input:focus {
        background: #1f1f1f;
        border-color: #667eea;
    }
    
    .pan-search-quick-tags {
        background: #1f1f1f;
        border-color: #333;
    }
    
    .quick-tag {
        background: #2a2a2a;
        border-color: #444;
        color: #aaa;
    }
    
    .quick-tag:hover {
        background: #667eea;
        color: #fff;
    }
}

.pan-search-history {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 60px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 8px;
    z-index: 100;
    max-height: 250px;
    overflow: hidden;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 12px;
    color: #666;
    background: #fafafa;
}

.clear-history {
    background: none;
    border: none;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.clear-history:hover {
    background: #fee;
    color: #e74c3c;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: #f5f5f5;
}

.pan-search-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    display: none;
    padding: 10px;
    border: 1px solid #dde8f4;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 40px rgba(20, 43, 74, 0.16);
    backdrop-filter: blur(12px);
    z-index: 120;
}

.pan-search-suggestions.is-visible {
    display: block;
}

.pan-search-suggestion-group + .pan-search-suggestion-group {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eef3f9;
}

.pan-search-suggestion-title {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #69809a;
}

.pan-search-suggestion-item {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease, transform 0.2s ease;
}

.pan-search-suggestion-item:hover {
    background: #f3f8fe;
    transform: translateX(2px);
}

.pan-search-suggestion-item mark {
    background: rgba(86, 145, 245, 0.18);
    color: #163e6d;
}

.pan-search-suggestion-label {
    font-size: 13px;
    color: #20364d;
    line-height: 1.5;
}

.pan-search-suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 768px) {
    .pan-search-pagination {
        flex-direction: column;
        align-items: flex-start;
    }

    .pan-search-history {
        right: 50px;
        max-height: 200px;
    }

    .pan-search-suggestions {
        right: 0;
    }

    .pan-search-wechat-guide {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .pan-search-wechat-guide__actions {
        flex-direction: column;
    }

    .pan-search-wechat-guide__button {
        width: 100%;
        justify-content: center;
    }
    
    .history-header {
        padding: 8px 10px;
    }
    
    .history-item {
        padding: 8px 10px;
        font-size: 12px;
    }
}

@media (prefers-color-scheme: dark) {
    .pan-search-pagination {
        border-color: #314055;
    }

    .pan-search-pagination-meta,
    .pan-search-load-more-finished {
        color: #a8b7ca;
    }

    .pan-search-load-more-btn {
        background: linear-gradient(135deg, #253449 0%, #2a3d57 100%);
        border-color: #3b587a;
        color: #d9e7f7;
    }

    .result-source-tag {
        background: #2a3444;
        color: #d6e1ef;
    }

    .result-source-label,
    .result-quality-score {
        color: #a8b7ca;
    }

    .result-merge-badge {
        background: rgba(45, 187, 109, 0.15);
        color: #92f0b8;
    }

    .pan-search-share-btn {
        background: linear-gradient(135deg, #253449 0%, #2a3d57 100%);
        border-color: #3b587a;
        color: #d9e7f7;
    }

    .pan-search-source-filters {
        background: linear-gradient(180deg, #1f1f1f 0%, #202838 100%);
    }

    .pan-search-source-chip {
        background: #2a2a2a;
        border-color: #3b4d67;
        color: #b1c1d6;
    }

    .pan-search-source-chip.is-active {
        background: linear-gradient(135deg, #395f96 0%, #5f78e0 100%);
        color: #fff;
    }


    .pan-search-history {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .history-header {
        background: #252525;
        border-color: #444;
        color: #aaa;
    }
    
    .clear-history {
        color: #888;
    }
    
    .clear-history:hover {
        background: #4a2020;
        color: #ff6b6b;
    }
    
    .history-item {
        color: #e0e0e0;
        border-color: #333;
    }
    
    .history-item:hover {
        background: #333;
    }

    .pan-search-suggestions {
        background: rgba(31, 39, 51, 0.98);
        border-color: #354a62;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    }

    .pan-search-suggestion-group + .pan-search-suggestion-group {
        border-color: #314055;
    }

    .pan-search-suggestion-title {
        color: #9db0c6;
    }

    .pan-search-suggestion-item:hover {
        background: #29384b;
    }

    .pan-search-suggestion-item mark {
        background: rgba(123, 170, 255, 0.22);
        color: #dce9ff;
    }

    .pan-search-suggestion-label {
        color: #e0ebf8;
    }
}

/* Floating Button and Chatbox */
#pan-search-floating-wrapper {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
}

#pan-search-floating-button {
    width: 60px;
    height: 60px;
    background: #0073aa;
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

#pan-search-floating-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#pan-search-floating-button .dashicons {
    font-size: 30px;
    width: 30px;
    height: 30px;
}

.pan-search-tooltip {
    position: absolute;
    right: 75px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.pan-search-tooltip::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 0 5px 5px;
    border-style: solid;
    border-color: transparent transparent transparent #333;
}

#pan-search-floating-button:hover .pan-search-tooltip {
    opacity: 1;
    visibility: visible;
}

#pan-search-floating-chatbox {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: none;
    animation: panSearchFadeIn 0.3s ease;
}

.pan-search-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #fff;
    cursor: pointer;
    z-index: 10;
}

.pan-search-close-btn:hover {
    color: #ffcccc;
}

@keyframes panSearchFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Home Notice */
.pan-search-home-notice {
    background: linear-gradient(135deg, #f4f9ff 0%, #eef5ff 55%, #f7f2ff 100%);
    border: 1px solid rgba(25, 118, 210, 0.16);
    padding: 28px;
    margin: 24px auto 0;
    border-radius: 22px;
    position: relative;
    color: #103a68;
    max-width: 960px;
    box-shadow: 0 16px 40px rgba(16, 58, 104, 0.12);
    overflow: hidden;
}

.pan-search-notice-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}

.pan-search-home-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(25, 118, 210, 0.12);
    color: #1356a8;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.pan-search-notice-content h2 {
    margin: 0;
    font-size: 30px;
    line-height: 1.25;
    color: #0f2547;
}

.pan-search-notice-content p {
    margin: 0;
    max-width: 720px;
    font-size: 16px;
    line-height: 1.7;
    color: #4a6485;
}

.pan-search-home-form {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 760px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(25, 118, 210, 0.12);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.pan-search-home-form input {
    flex: 1;
    min-width: 0;
    height: 52px;
    padding: 0 18px;
    border: none;
    border-radius: 14px;
    background: transparent;
    color: #10213d;
    font-size: 15px;
    outline: none;
}

.pan-search-home-form input::placeholder {
    color: #6f86a6;
}

.pan-search-home-form button {
    height: 52px;
    padding: 0 22px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #1976d2 0%, #6d4aff 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.pan-search-home-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(42, 92, 199, 0.22);
}

.pan-search-home-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 14px;
    color: #5b7190;
}

.pan-search-home-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(25, 118, 210, 0.1);
    color: #1356a8;
    font-weight: 700;
    text-decoration: none;
}

.pan-search-home-actions a:hover {
    background: rgba(25, 118, 210, 0.16);
}

.pan-search-home-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pan-search-home-panels {
    display: grid;
    gap: 14px;
    width: 100%;
}

.pan-search-home-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pan-search-home-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: #32557d;
}

.pan-search-home-history-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pan-search-home-history-tags a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(25, 118, 210, 0.14);
    color: #1d4d86;
    text-decoration: none;
    font-size: 14px;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.pan-search-home-history-tags a:hover {
    border-color: rgba(25, 118, 210, 0.28);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(16, 58, 104, 0.08);
}

.pan-search-home-tags a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(16, 58, 104, 0.1);
    color: #2d4f78;
    text-decoration: none;
    font-size: 14px;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.pan-search-home-tags a:hover {
    border-color: rgba(25, 118, 210, 0.28);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(16, 58, 104, 0.08);
}

.pan-search-notice-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.72);
    color: #4f6991;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pan-search-notice-close:hover {
    background: rgba(255, 255, 255, 0.95);
    color: #16345d;
}

@media (max-width: 480px) {
    #pan-search-floating-chatbox {
        width: calc(100vw - 40px);
        right: -10px;
    }

    .pan-search-home-notice {
        margin: 16px;
        padding: 20px;
        border-radius: 18px;
    }

    .pan-search-notice-content h2 {
        font-size: 24px;
    }

    .pan-search-notice-content p {
        font-size: 14px;
    }

    .pan-search-home-form {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
    }

    .pan-search-home-form input,
    .pan-search-home-form button {
        width: 100%;
    }

    .pan-search-home-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .pan-search-home-tags {
        gap: 8px;
    }

    .pan-search-recommend-item {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        padding: 10px 14px;
    }
}
