/* 主页特定样式 */

/* ===== Google Drive 风格图标按钮 ===== */
.drive-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #444746;
    cursor: pointer;
    position: relative;
    transition: background 0.15s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.drive-icon-btn:hover {
    background: rgba(60, 64, 67, 0.08);
    color: #1F1F1F;
}

.drive-icon-btn:active {
    background: rgba(60, 64, 67, 0.12);
}

.drive-icon-btn:focus-visible {
    outline: 2px solid #0B57D0;
    outline-offset: 2px;
}

.drive-icon-btn svg {
    width: 24px;
    height: 24px;
}

/* tooltip */
.drive-icon-btn::after {
    content: attr(aria-label);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 8px;
    background: rgba(32, 33, 36, 0.9);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 400;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s 0.3s;
    letter-spacing: 0.01em;
}

.drive-icon-btn:hover::after {
    opacity: 1;
}

/* ===== Google Drive 风格覆盖层 ===== */
.drive-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.drive-overlay--visible {
    opacity: 1;
    pointer-events: auto;
}

/* 搜索执行期间的暗色遮罩 */
.drive-overlay--dimmed {
    background: rgba(0, 0, 0, 0.4);
}

/* ===== Google Drive 风格弹出面板 (gb_F) ===== */
.drive-popup {
    position: fixed;
    z-index: 200;
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 28px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 8px 28px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    pointer-events: none;
    transition:
        opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 8px 0;
    min-width: 320px;
    max-width: 380px;
    overflow: hidden;
}

.drive-popup--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.drive-popup__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px 8px 24px;
}

.drive-popup__title {
    font-size: 16px;
    font-weight: 500;
    color: #1F1F1F;
    line-height: 24px;
}

.drive-popup__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #444746;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.drive-popup__close:hover {
    background: rgba(60, 64, 67, 0.08);
}

.drive-popup__close:active {
    background: rgba(60, 64, 67, 0.12);
}

.drive-popup__close svg {
    width: 18px;
    height: 18px;
}

.drive-popup__body {
    padding: 0 16px;
    max-height: 360px;
    overflow-y: auto;
}

.drive-popup__footer {
    padding: 8px 16px;
    margin-top: 8px;
}

/* 分割线 */
.drive-divider {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin: 8px 0;
}

/* 弹出面板内的列表项 */
.drive-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 14px;
    color: #1F1F1F;
}

.drive-item:hover {
    background: rgba(60, 64, 67, 0.06);
}

.drive-item__icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: #444746;
}

.drive-item__text {
    flex: 1;
    line-height: 20px;
}

.drive-item__meta {
    font-size: 12px;
    color: #5F6368;
}

/* 空状态 */
.drive-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px;
    text-align: center;
    color: #5F6368;
}

.drive-empty__icon {
    margin-bottom: 12px;
    color: #BDC1C6;
}

.drive-empty__text {
    font-size: 13px;
    line-height: 20px;
}

/* Drive 风格按钮 */
.drive-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    border-radius: 100px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
    outline: none;
}

.drive-btn:focus-visible {
    outline: 2px solid #0B57D0;
    outline-offset: 2px;
}

.drive-btn--full {
    width: 100%;
    justify-content: center;
}

.drive-btn--outline {
    background: transparent;
    color: #0B57D0;
    border: 1px solid #DADCE0;
}

.drive-btn--outline:hover {
    background: rgba(11, 87, 208, 0.06);
    border-color: #0B57D0;
}

.drive-btn--outline:active {
    background: rgba(11, 87, 208, 0.12);
}

.drive-btn--primary {
    background: #0B57D0;
    color: #FFFFFF;
}

.drive-btn--primary:hover {
    background: #0842A0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.12);
}

.drive-btn--primary:active {
    background: #07348A;
}

/* ===== 弹出面板内卡片（gb_F 无缝风格） ===== */
.drive-popup .drive-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 12px 0;
    margin-bottom: 0;
}

.drive-popup .drive-card + .drive-card {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.drive-card__title {
    font-size: 13px;
    font-weight: 500;
    color: #1F1F1F;
    margin-bottom: 14px;
    line-height: 20px;
}

/* ===== Chip 标签按钮 ===== */
.drive-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 100px;
    border: 1px solid #DADCE0;
    background: #FFFFFF;
    color: #444746;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.drive-chip:hover {
    background: #F0F4F9;
    border-color: #C4C7CC;
    color: #1F1F1F;
}

.drive-chip__row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

/* ===== 复选框网格 ===== */
.drive-check-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #E1E3E6;
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 12px;
}

.drive-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 13px;
    color: #1F1F1F;
}

.drive-check-item:hover {
    background: rgba(60, 64, 67, 0.05);
}

.drive-check-item input[type="checkbox"] {
    accent-color: #0B57D0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ===== 设置面板操作按钮区 ===== */
.drive-settings-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== Google Drive 风格开关 ===== */
.drive-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    margin-bottom: 4px;
}

.drive-toggle:last-child {
    margin-bottom: 0;
}

.drive-toggle__label {
    font-size: 13px;
    font-weight: 500;
    color: #1F1F1F;
    line-height: 20px;
}

.drive-toggle__desc {
    font-size: 12px;
    color: #5F6368;
    line-height: 18px;
    margin-top: 1px;
}

.drive-toggle__switch {
    position: relative;
    width: 40px;
    height: 24px;
    flex-shrink: 0;
    margin-left: 16px;
}

.drive-toggle__switch input {
    opacity: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 1;
    cursor: pointer;
    margin: 0;
}

.drive-toggle__track {
    width: 100%;
    height: 100%;
    background: #BDC1C6;
    border-radius: 100px;
    transition: background 0.2s;
}

.drive-toggle__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #FFFFFF;
    border-radius: 50%;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.drive-toggle__switch input:checked + .drive-toggle__track {
    background: #0B57D0;
}

.drive-toggle__switch input:checked + .drive-toggle__track .drive-toggle__thumb {
    transform: translateX(16px);
}

/* ===== 设置面板内分隔线 ===== */
.drive-section-divider {
    border: none;
    border-top: 1px solid #E1E3E6;
    margin: 12px 0;
}

/* ===== 自定义API列表项 ===== */
.drive-api-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 13px;
    color: #1F1F1F;
    transition: background 0.1s;
}

.drive-api-item:hover {
    background: rgba(60, 64, 67, 0.05);
}

/* ===== 表单输入框 ===== */
.drive-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 20px;
    border: 1px solid #DADCE0;
    border-radius: 8px;
    background: #FFFFFF;
    color: #1F1F1F;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    margin-bottom: 8px;
}

.drive-input:focus {
    border-color: #0B57D0;
    box-shadow: 0 0 0 2px rgba(11, 87, 208, 0.15);
}

.drive-input::placeholder {
    color: #80868B;
}

/* ===== API信息脚注 ===== */
.drive-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #5F6368;
    padding-top: 8px;
}

/* ===== 设置面板body高度 ===== */
#settingsPanel .drive-popup__body {
    max-height: 60vh;
}

/* 搜索区域样式 */
.search-box {
    height: 3.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    border: 1px solid #E2E8F0;
}

.search-button {
    width: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: black;
    font-weight: 500;
    transition: background-color 0.2s;
}

.search-button:hover {
    background: #f0f0f0;
}

#clearHistoryBtn:hover {
    transform: none !important;
}

/* 搜索栏容器需高于 overlay（z-index:100），确保输入框和搜索建议面板不被遮罩覆盖 */
#searchBarWrapper {
    position: relative;
    z-index: 110;
}

.search-input {
    flex: 1;
    background: white;
    border: none;
    color: #1E293B;
    padding: 0 1.5rem;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    background: #FAFBFC;
}

.search-input::placeholder {
    color: #94A3B8;
}

/* Google风格 Filter Chip 按钮 */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 24px;
    border: none;
    border-radius: 9999px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #e4e8ee;
    color: #4f545c;
}

.filter-chip:hover {
    background: #d3d8e0;
}

.filter-chip.active {
    background: #c2e7ff;
    color: #004a7c;
}

/* 粉色变体（搜索历史） */
.filter-chip--pink {
    height: 36px;
    padding: 0 16px;
    font-size: 14px;
    background: #fce4ec;
    color: #880e4f;
}

.filter-chip--pink:hover {
    background: #f8bbd0;
}

/* 豆瓣区域样式 */
.douban-container {
    margin: 2rem auto;
    max-width: 1280px;
    padding: 0 0.5rem;
}

.douban-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.douban-toggle {
    display: flex;
    align-items: center;
    background: #F1F5F9;
    border-radius: 9999px;
    padding: 0.25rem;
    border: 1px solid #E2E8F0;
}

.douban-toggle-button {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 9999px;
}

.douban-toggle-button.active {
    background: #2563EB;
    color: white;
}

.douban-toggle-button:not(.active) {
    color: #64748B;
}

.douban-toggle-button:not(.active):hover {
    color: #2563EB;
}

.douban-refresh-button {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    background: #2563EB;
    color: white;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.douban-refresh-button:hover {
    background: #1D4ED8;
}

.douban-tags-container {
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.douban-tags {
    display: flex;
    gap: 0.5rem;
    min-width: max-content;
}

.douban-tag {
    padding: 0.25rem 0.75rem;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 0.5rem;
    color: #2563EB;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.douban-tag:hover {
    background: #DBEAFE;
    border-color: #60A5FA;
}

.douban-tag.active {
    background: #2563EB;
    border-color: #2563EB;
    color: white;
}

/* 搜索结果样式 */
.search-results-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 0.5rem;
}

.search-result-stats {
    text-align: right;
    font-size: 0.875rem;
    color: #64748B;
    margin-bottom: 1rem;
}

/* 响应式网格布局 */
.search-results-grid {
    display: grid;
    gap: 1rem;
}

@media (max-width: 640px) {
    .search-results-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 641px) and (max-width: 768px) {
    .search-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .search-results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1025px) {
    .search-results-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== 搜索建议下拉面板 ===== */
.search-suggest-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.04),
        0 10px 24px rgba(0, 0, 0, 0.08),
        0 24px 48px rgba(0, 0, 0, 0.10);
    padding: 8px 0;
    z-index: 150;
    transform: translateY(-4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.search-suggest-panel--open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.search-suggest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px 6px 20px;
    font-size: 13px;
    font-weight: 500;
    color: #5F6368;
}

.search-suggest-action {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #0B57D0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.search-suggest-action:hover {
    background: rgba(11, 87, 208, 0.06);
}

.search-suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    color: #1F1F1F;
    transition: background 0.1s;
    line-height: 20px;
    user-select: none;
}

.search-suggest-item:hover,
.search-suggest-item--highlighted {
    background: rgba(60, 64, 67, 0.06);
}

.search-suggest-item__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9AA0A6;
}

.search-suggest-item__icon svg {
    width: 16px;
    height: 16px;
}

.search-suggest-item__text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggest-item__text strong {
    color: #0B57D0;
    font-weight: 600;
}

.search-suggest-item__rate {
    flex-shrink: 0;
    font-size: 12px;
    color: #E8740C;
    font-weight: 500;
}

/* 加载骨架屏 */
.search-suggest-loading {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-suggest-skeleton {
    height: 16px;
    background: #F1F3F4;
    border-radius: 4px;
    animation: suggest-pulse 1.5s ease-in-out infinite;
}

.search-suggest-skeleton:nth-child(2) { width: 80%; }
.search-suggest-skeleton:nth-child(3) { width: 65%; }
.search-suggest-skeleton:nth-child(4) { width: 75%; }

@keyframes suggest-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* 移动端适配 */
@media (max-width: 480px) {
    .search-suggest-panel {
        border-radius: 16px;
    }
    .search-suggest-item {
        padding: 9px 16px;
    }
    .search-suggest-header {
        padding: 8px 16px 6px 16px;
    }
}
