/* 小解 - 全新样式表 */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #0a0a0f;
    color: #fff;
    height: 100%;
    overflow: hidden;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ==================== 顶部栏 ==================== */
.top-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 100;
}

.top-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #646cff, #aea9f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.now-playing {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(100, 108, 255, 0.1);
    border-radius: 20px;
    font-size: 13px;
    max-width: 300px;
}

.now-playing-label { 
    color: rgba(255, 255, 255, 0.6); 
    width: 70px;
}
.now-playing-title { 
    color: #fff; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
    width: 230px; 
}

.top-center {
    position: relative;
    display: flex;
    justify-content: center;
}

.top-right {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

/* 搜索框 */
.search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 500px;
    max-width: 90vw;
    padding: 4px 4px 4px 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    transition: all 0.3s;
}

.search-box:focus-within {
    border-color: rgba(100, 108, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.mode-tabs {
    display: flex;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 2px;
}

.mode-tabs button {
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.mode-tabs button.active {
    background: #646cff;
    color: #fff;
}

.search-box input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 13px;
    outline: none;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #646cff, #9089fc);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.search-btn svg { width: 16px; height: 16px; }
.search-btn:hover:not(:disabled) { transform: scale(1.05); }
.search-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* 操作按钮 */
.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn svg { width: 16px; height: 16px; }
.action-btn:hover { 
    background: rgba(100, 108, 255, 0.2); 
    border-color: rgba(100, 108, 255, 0.4); 
}

/* 移动端菜单按钮 */
.menu-btn {
    display: none;
}

.history-btn-mobile {
    display: none;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.history-btn-mobile svg { width: 18px; height: 18px; }

/* ==================== 搜索下拉 ==================== */
.search-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    max-height: 60vh;
    background: rgba(20, 20, 25, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 200;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px;
}

.search-results::-webkit-scrollbar { width: 6px; }
.search-results::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
.search-results::-webkit-scrollbar-thumb { background: rgba(50, 50, 50, 0.8); border-radius: 3px; }
.search-results::-webkit-scrollbar-thumb:hover { background: rgba(80, 80, 80, 0.9); }

.search-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-item:hover { background: rgba(255, 255, 255, 0.08); }

.search-item-img {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: rgba(100, 108, 255, 0.2);
}

.search-item-img.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
}

.search-item-img.placeholder svg { width: 24px; height: 24px; }

.search-item-info { flex: 1; min-width: 0; }

.search-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.search-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

.search-item-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tag {
    padding: 2px 6px;
    background: rgba(100, 108, 255, 0.3);
    border-radius: 4px;
    color: #9089fc;
    font-size: 11px;
}

.tag.site { background: rgba(255, 200, 100, 0.2); color: #ffc864; }
.tag.official { background: rgba(255, 200, 100, 0.2); color: #ffc864; border: 1px solid rgba(255, 200, 100, 0.4); }
.tag.recommend { background: rgba(0, 220, 130, 0.18); color: rgba(0, 220, 130, 0.95); border: 1px solid rgba(0, 220, 130, 0.25); }

.search-loading {
    padding: 30px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ==================== 移动端菜单 ==================== */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    pointer-events: none;
}

.mobile-menu.show { pointer-events: auto; }

.mobile-menu .overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-menu.show .overlay { opacity: 1; }

.mobile-menu .menu-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 260px;
    height: 100%;
    background: rgba(15, 15, 20, 0.98);
    backdrop-filter: blur(10px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    transform: translateX(100%);
    transition: transform 0.3s;
}

.mobile-menu.show .menu-content { transform: translateX(0); }

.mobile-menu .menu-content button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.mobile-menu .menu-content button:hover {
    background: rgba(100, 108, 255, 0.2);
    border-color: rgba(100, 108, 255, 0.4);
}

.mobile-menu .menu-content button svg { width: 20px; height: 20px; }

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}

#artplayer {
    width: 100%;
    height: 100%;
}

.placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: 
        linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
        url('https://objectstorageapi.gzg.sealos.run/ykb656yi-abb-1/downloaded-image.png') center/cover no-repeat;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #888;
}

/* ==================== 面板通用 ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.show { opacity: 1; pointer-events: auto; }

.panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    pointer-events: none;
    width: 90%;
    max-width: 500px;
    max-height: 60vh;
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s;
}

.panel.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.episode-panel { max-width: 600px; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header span { font-size: 15px; font-weight: 500; }

.panel-header button {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-header button:hover { background: rgba(255, 255, 255, 0.2); }
.panel-header button svg { width: 14px; height: 14px; }

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.panel-body::-webkit-scrollbar { width: 6px; }
.panel-body::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
.panel-body::-webkit-scrollbar-thumb { background: rgba(50, 50, 50, 0.8); border-radius: 3px; }

.panel-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

/* 历史记录 */
.history-list {
    display: flex;
    flex-direction: column;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.history-item:hover { background: rgba(255, 255, 255, 0.08); }

.history-info { flex: 1; min-width: 0; }
.history-title { font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: 12px; color: rgba(255, 255, 255, 0.5); margin-top: 4px; }

.delete-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.delete-btn:hover { background: rgba(255, 107, 107, 0.2); color: #ff6b6b; }
.delete-btn svg { width: 14px; height: 14px; }

.empty {
    text-align: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.5);
}

.clear-btn {
    padding: 8px 16px;
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 6px;
    color: #ff6b6b;
    font-size: 13px;
    cursor: pointer;
}

.clear-btn:hover { background: rgba(255, 107, 107, 0.25); }

/* 选集 */
.episode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.episode-item {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid transparent;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s;
}

.episode-item:hover {
    background: rgba(100, 108, 255, 0.3);
    border-color: rgba(100, 108, 255, 0.5);
}

.episode-item.active {
    background: #646cff;
    border-color: #646cff;
    color: #fff;
    font-weight: 600;
}

/* ==================== 状态提示 ==================== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 32px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 12px;
    font-size: 14px;
    z-index: 1000;
    text-align: center;
    max-width: 80%;
}

.toast.error { color: #ff6b6b; background: rgba(30, 15, 15, 0.95); border: 1px solid rgba(255, 107, 107, 0.3); }

/* ==================== Spinner ==================== */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-lg {
    width: 48px;
    height: 48px;
    border: 3px solid #333;
    border-top-color: #646cff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 恢复播放提示 ==================== */
.resume-prompt {
    position: absolute;
    bottom: 70px;
    left: 12px;
    z-index: 100;
}

.resume-prompt-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.resume-btn {
    padding: 2px 6px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
}

.resume-btn.resume { background: #646cff; color: #fff; }
.resume-btn.start { background: rgba(255,255,255,0.2); color: #fff; }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .top-bar {
        grid-template-columns: 1fr auto;
        padding: 8px 12px;
        gap: 10px;
    }
    
    .top-left { display: none; }
    .top-center { grid-column: 1; justify-content: flex-start; }
    .top-right { display: none; }
    .menu-btn { display: none; }
    .history-btn-mobile { display: flex; }
    
    .search-box { 
        width: 100%; 
        flex-wrap: nowrap;
    }
    
    .mode-tabs { 
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
    }
    
    .mode-tabs button {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .search-dropdown {
        left: 0px;
        right: -12px;
        width: calc(100vw - 24px);
        max-width: none;
    }
    
    .panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: translateY(100%);
        width: 100%;
        max-width: 100%;
        max-height: 50vh;
        border-radius: 16px 16px 0 0;
    }
    
    .panel.show { transform: translateY(0); }
    
    .episode-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==================== 热门搜索下拉 ==================== */
.hot-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: rgba(20, 20, 25, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.hot-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.hot-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.hot-header-icon {
    font-size: 16px;
}

.hot-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.hot-list::-webkit-scrollbar { width: 6px; }
.hot-list::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
.hot-list::-webkit-scrollbar-thumb { background: rgba(50, 50, 50, 0.8); border-radius: 3px; }

.hot-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.hot-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.hot-rank {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.hot-rank.top {
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: #fff;
    border-radius: 4px;
}

.hot-title {
    flex: 1;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hot-type-tag {
    padding: 2px 6px;
    background: rgba(100, 108, 255, 0.2);
    color: #9089fc;
    font-size: 11px;
    border-radius: 4px;
    flex-shrink: 0;
}

.hot-rating {
    padding: 2px 6px;
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    flex-shrink: 0;
}

.hot-loading,
.hot-empty {
    padding: 30px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.hot-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* 移动端热门搜索适配 */
@media (max-width: 768px) {
    .top-center {
        width: 100%;
    }
    
    .hot-dropdown {
        position: fixed;
        left: 10px;
        right: 10px;
        width: auto;
        border-radius: 12px;
    }
    
    .hot-list {
        max-height: 50vh;
    }
    
    .hot-item {
        padding: 12px;
    }
}
