* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

:root {
    --primary: #e50914;
    --primary-dark: #b20710;
    --dark: #0f0f0f;
    --dark-light: #1a1a1a;
    --gray: #2d2d2d;
    --light-gray: #8c8c8c;
    --white: #ffffff;
    --card-bg: #1f1f1f;
    --text-light: #f0f0f0;
    --transition: all 0.3s ease;
}

body {
    background-color: var(--dark);
    color: var(--white);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 顶部搜索导航 */
.search-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--dark);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    gap: 12px;

    backdrop-filter: blur(5px);
    max-width: 1000px;
    margin: 0 auto;
}

.back-btn {
    color: var(--white);
    font-size: 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: var(--transition);
}

.back-btn:hover {
    background: var(--gray);
}

.search-input-container {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    background: var(--dark-light);
    border: none;
    color: var(--white);
    font-size: 16px;
    outline: none;
    padding: 12px 45px 12px 15px;
    border-radius: 24px;
    transition: var(--transition);
}

.search-input:focus {
    box-shadow: 0 0 0 2px var(--primary);
}

.search-icon-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--light-gray);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
}

.search-icon-btn:hover {
    color: var(--primary);
}

.close-search {
    color: var(--light-gray);
    font-size: 18px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: var(--transition);
}

.close-search:hover {
    background: var(--gray);
    color: var(--primary);
}

/* 搜索内容区域 */
.search-container {
    padding: 15px 16px 80px;
    min-height: 100vh;
}

.search-results-count {
    margin: 10px 0 15px;
    font-size: 14px;
    color: var(--light-gray);
}

.highlight {
    color: var(--primary);
    font-weight: 600;
}

/* 搜索历史 - 缩小版本 */
.search-history {
    margin-bottom: 20px;
    background: var(--dark-light);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.section-title {
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding-bottom: 8px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.history-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border-radius: 18px;
    padding: 6px 12px;
    transition: var(--transition);
}

.history-term {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
}

.history-term i {
    color: var(--light-gray);
    font-size: 11px;
}

.delete-history {
    color: var(--light-gray);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 0 2px 6px;
    transition: var(--transition);
    font-size: 11px;
}

.delete-history:hover {
    color: var(--primary);
}

.clear-history {
    text-align: right;
    margin-top: 10px;
}

.clear-history-btn {
    color: var(--light-gray);
    background: transparent;
    border: none;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 20px;
}

.clear-history-btn:hover {
    color: var(--primary);
}

/* 标签云 - 增大字体 */
.search-tags {
    margin-bottom: 20px;
}

.section-title-large {
    font-size: 18px;
    margin-bottom: 12px;
    position: relative;
    padding-bottom: 8px;
}

.section-title-large::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background: var(--dark-light);
    color: var(--light-gray);
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 15px;
    white-space: nowrap;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.tag:hover, .tag.active {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(229, 9, 20, 0.3);
}

/* 搜索结果网格 */
.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.result-card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    position: relative;
    animation: fadeIn 0.4s ease-out;
    animation-fill-mode: both;
}

.result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.result-card:active {
    transform: scale(0.98);
}

.result-thumb {
    position: relative;
    height: 110px;
    overflow: hidden;
}

.result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.result-card:hover .result-thumb img {
    transform: scale(1.05);
}

.media-type {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.8);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    z-index: 2;
    text-transform: uppercase;
    color: var(--primary);
}

.result-info {
    padding: 10px;
}

.result-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.result-meta {
    display: flex;
    justify-content: space-between;
    color: var(--light-gray);
    font-size: 11px;
    margin-top: 6px;
}

.result-meta span:first-child {
    color: var(--primary);
}

.rating {
    display: flex;
    align-items: center;
    gap: 3px;
}

.rating i {
    color: #FFC107;
    font-size: 11px;
}

/* 加载指示器 */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    min-height: 60px;
}

.loading-indicator {
    display: none;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(229, 9, 20, 0.2);
    border-radius: 50%;
    border-top: 3px solid var(--primary);
    animation: spin 1s linear infinite;
}

.loading-text {
    color: var(--light-gray);
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
}

/* 无结果状态 */
.no-results {
    text-align: center;
    padding: 40px 20px;
}

.no-results-icon {
    font-size: 50px;
    color: var(--light-gray);
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-light);
}

.no-results p {
    color: var(--light-gray);
    margin-bottom: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    font-size: 14px;
}

.btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(229, 9, 20, 0.4);
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
    transform: translateY(20px);
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-5px);
}

/* 底部导航 */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background: var(--dark-light);
    padding: 8px 0;
    z-index: 100;
    border-top: 1px solid var(--gray);

    max-width: 1000px;
    margin: 0 auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--light-gray);
    font-size: 12px;
    transition: var(--transition);
    padding: 6px 12px;
    border-radius: 8px;
}

.nav-item.active, .nav-item:hover {
    color: var(--primary);
    background: rgba(229, 9, 20, 0.15);
}

.nav-item i {
    font-size: 18px;
    margin-bottom: 4px;
}

.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    background: rgba(15, 15, 15, 0.9);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    backdrop-filter: blur(10px);
}

/* 响应式设计 */
@media (min-width: 768px) {
    .search-header {
        padding: 15px 30px;
    }
    
    .search-container {
        padding: 20px 30px 100px;
    }
    
    .results-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .result-thumb {
        height: 140px;
    }
    
    .section-title-large {
        font-size: 20px;
    }
    
    .tag {
        font-size: 16px;
        padding: 11px 18px;
    }
    
    .search-history {
        padding: 15px 20px;
    }
    
    .back-to-top {
        bottom: 90px;
        right: 30px;
    }
}

@media (min-width: 992px) {
    .results-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 18px;
    }
    
    .section-title-large {
        font-size: 22px;
    }
    
    .tag {
        font-size: 17px;
        padding: 12px 20px;
    }
}

.link-reset {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* PWA安装提示样式 */
.pwa-install-banner {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    padding: 12px 16px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
    z-index: 999;
    display: none;
    border-radius: 8px 8px 0 0;
    margin: 0 auto;
    width: 55%;
    max-width: 550px;
}
.pwa-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 550px;
    margin: 0 auto;
}
.pwa-banner-text {
    display: flex;
    align-items: center;
    flex: 1;
}
.pwa-banner-text i {
    margin-right: 10px;
    font-size: 1.2rem;
}
.pwa-banner-actions {
    display: flex;
    gap: 10px;
}
.pwa-install-btn, .pwa-close-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}
.pwa-install-btn {
    background-color: white;
    color: #6e8efb;
}
.pwa-close-btn {
    background-color: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.5);
}

/* 调整底部导航栏位置，为PWA提示留出空间 */
.mobile-nav {
    bottom: 0;
    z-index: 1000;
}

/* 调整回到顶部按钮位置 */
.back-to-top.visible {
    bottom: 80px;
}

@media (max-width: 768px) {
    .pwa-banner-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .pwa-banner-actions {
        align-self: flex-end;
    }
}

