/* ===== 全局样式 ===== */
:root {
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --primary-soft: #eff6ff;
    --bg-card: #ffffff;
    --bg-page: #f8fafc;
    --bg-section: #f1f5f9;
    --bg-section-alt: #f8fafc;
    --text-main: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== 导航栏 ===== */
.navbar {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05), var(--shadow-sm);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    color: var(--primary);
    font-size: 1.5rem;
}

.navbar-toggler {
    border: none;
    padding: 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary) !important;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary) !important;
    background-color: var(--primary-soft);
}

.navbar .btn-outline-light {
    color: var(--text-secondary);
    border-color: var(--border-color);
    background: #fff;
    font-size: 0.875rem;
    padding: 0.4rem 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.navbar .btn-outline-light:hover {
    background: var(--bg-page);
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== Hero 区域 ===== */
.hero-section {
    background: linear-gradient(135deg, #ffffff 0%, var(--primary-soft) 50%, #ffffff 100%);
    padding: 4rem 0 3rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-block;
}

.hero-badge .badge {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
}

.hero-badge .badge i {
    color: #f59e0b;
    margin-right: 0.25rem;
}

.hero-section h1 {
    color: var(--text-main);
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-section .lead {
    color: var(--text-muted);
    font-size: 1.15rem;
    font-weight: 400;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* 搜索框 */
.hero-section .input-group {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(59, 130, 246, 0.1);
    border: none;
    background: #fff;
    transition: var(--transition);
}

.hero-section .input-group:focus-within {
    box-shadow: var(--shadow-xl), 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.hero-section .input-group-text {
    background: #fff;
    border: none;
    padding-left: 1.25rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.hero-section .form-control {
    border: none;
    background: #fff;
    font-size: 1rem;
    padding: 1rem 1.25rem;
    font-weight: 400;
}

.hero-section .form-control:focus {
    box-shadow: none;
}

.hero-section .form-control::placeholder {
    color: #94a3b8;
}

.hero-section .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    font-weight: 600;
    padding: 1rem 2rem;
    font-size: 1rem;
}

.hero-section .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #1d4ed8);
    transform: translateY(-1px);
}

/* 快捷标签 */
.quick-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.quick-tag {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    transition: var(--transition);
}

.quick-tag:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== 区域标题 ===== */
.section-header {
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.section-title i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
}

.section-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
    padding-left: 2.75rem;
}

/* ===== 精选推荐区域 ===== */
.recommend-section {
    background: #fff;
    border-top: 1px solid var(--border-light);
    padding: 3rem 0;
}

/* ===== 分类区域 ===== */
.category-section {
    padding: 3rem 0;
    background: #fff;
}

.category-section.bg-alt {
    background: var(--bg-section-alt);
}

/* ===== 站点卡片（浅色背景风格） ===== */
.site-item {
    border-radius: var(--radius);
    transition: var(--transition);
    background: #f8fafc;
    border: 1px solid var(--border-light);
    height: 100%;
    position: relative;
}

.site-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color);
    background: #fff;
}

.site-item-main {
    display: block;
    text-decoration: none;
    color: inherit;
}

.site-item-body {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    padding-right: 2rem;
}

.site-item-logo {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.site-item-logo img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-light);
    background: #fff;
}

.site-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.site-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 0.2rem 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-item:hover .site-item-title {
    color: var(--primary);
}

.site-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 新窗口打开图标 */
.site-item-link {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    opacity: 0;
    transition: var(--transition);
    padding: 0.25rem;
    z-index: 2;
}

.site-item:hover .site-item-link {
    opacity: 1;
}

.site-item-link:hover {
    color: var(--primary);
}

/* 置顶/推荐小徽章 */
.site-item-badge {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    border: 2px solid #fff;
    box-shadow: var(--shadow-sm);
}

.site-item-badge.top {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.site-item-badge.rec {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

/* ===== 查看全部按钮 ===== */
.btn-outline-primary.btn-sm {
    color: var(--text-secondary);
    border-color: var(--border-color);
    background: #fff;
    font-weight: 500;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-outline-primary.btn-sm:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}

/* ===== 详情页样式 ===== */
.detail-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.detail-logo {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    object-fit: cover;
}

.detail-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.detail-title .badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.3em 0.6em;
}

.detail-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.detail-meta i {
    color: var(--primary);
}

.detail-section {
    margin-bottom: 1.25rem;
}

.detail-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.detail-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

.detail-url {
    font-size: 0.85rem;
}

.detail-url a {
    color: var(--primary);
    text-decoration: none;
    word-break: break-all;
}

.detail-url a:hover {
    text-decoration: underline;
}

.detail-sidebar {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.detail-sidebar .card-header {
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
}

.detail-sidebar .list-group-item {
    border-color: var(--border-light);
    transition: var(--transition);
}

.detail-sidebar .list-group-item:hover {
    background: var(--primary-soft);
}

/* ===== 底部 ===== */
footer {
    background: #fff !important;
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
}

.footer-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-brand i {
    color: var(--primary);
    font-size: 1.5rem;
}

footer .text-muted {
    color: var(--text-muted) !important;
    font-size: 0.875rem;
}

/* ===== 工具函数 ===== */
.min-w-0 {
    min-width: 0;
}

/* ===== 面包屑 ===== */
.breadcrumb {
    font-size: 0.9rem;
    background: transparent;
    padding: 0;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ===== 按钮 ===== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #1d4ed8);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ===== 分页 ===== */
.pagination .page-link {
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    margin: 0 2px;
    border-color: var(--border-color);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
}

.pagination .page-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: var(--primary-light);
}

/* ===== 搜索结果高亮 ===== */
.search-match {
    background: linear-gradient(180deg, transparent 60%, #fef3c7 60%);
    border-radius: 2px;
    padding: 0 2px;
}

/* ===== 动画 ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-item {
    animation: fadeInUp 0.4s ease forwards;
}

/* 错开动画 */
.site-item:nth-child(1) { animation-delay: 0.02s; }
.site-item:nth-child(2) { animation-delay: 0.04s; }
.site-item:nth-child(3) { animation-delay: 0.06s; }
.site-item:nth-child(4) { animation-delay: 0.08s; }
.site-item:nth-child(5) { animation-delay: 0.10s; }
.site-item:nth-child(6) { animation-delay: 0.12s; }
.site-item:nth-child(7) { animation-delay: 0.14s; }
.site-item:nth-child(8) { animation-delay: 0.16s; }

/* ===== 列表组 ===== */
.list-group-item-action:hover {
    background-color: var(--primary-soft);
}

/* ===== 响应式优化 ===== */
@media (max-width: 991px) {
    .hero-section {
        padding: 3rem 0 2.5rem;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .hero-section .lead {
        font-size: 1.05rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .section-title i {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .navbar-collapse {
        background: #fff;
        margin: 0.75rem -0.75rem -0.75rem;
        padding: 0.75rem;
        border-top: 1px solid var(--border-color);
        border-radius: 0 0 var(--radius) var(--radius);
    }

    .nav-link {
        padding: 0.625rem 0.875rem !important;
    }

    .recommend-section,
    .category-section {
        padding: 2rem 0;
    }
}

@media (max-width: 767px) {
    .hero-section {
        padding: 2.5rem 0 2rem;
    }

    .hero-section h1 {
        font-size: 1.65rem;
    }

    .hero-section .lead {
        font-size: 0.95rem;
    }

    .hero-section .form-control {
        font-size: 16px;
        padding: 0.875rem 1rem;
    }

    .hero-section .btn-primary {
        padding: 0.875rem 1.5rem;
    }

    .quick-tag {
        font-size: 0.8rem;
        padding: 0.35rem 0.75rem;
    }

    .section-title {
        font-size: 1.15rem;
    }

    .section-desc {
        font-size: 0.85rem;
        padding-left: 2.5rem;
    }

    .site-item-body {
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .site-item-logo {
        width: 44px;
        height: 44px;
    }

    .site-item-title {
        font-size: 0.875rem;
    }

    .site-item-desc {
        font-size: 0.75rem;
    }

    .recommend-section,
    .category-section {
        padding: 1.75rem 0;
    }

    footer {
        padding: 2rem 0;
    }
}

@media (max-width: 575px) {
    .hero-section h1 {
        font-size: 1.5rem;
    }

    .col-6 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .row.g-3 {
        --bs-gutter-x: 0.75rem;
    }

    .site-item-body {
        padding: 0.75rem;
    }

    .site-item-logo {
        width: 40px;
        height: 40px;
    }

    .site-item-title {
        font-size: 0.8rem;
    }

    .site-item-desc {
        font-size: 0.7rem;
    }

    .site-item-badge {
        width: 16px;
        height: 16px;
        font-size: 7px;
        bottom: -2px;
        right: -2px;
    }
}

/* ===== 平板适配 ===== */
@media (min-width: 768px) and (max-width: 991px) {
    .site-item-body {
        padding: 1rem;
    }
}

/* ===== 大屏优化 ===== */
@media (min-width: 1400px) {
    .container {
        max-width: 1280px;
    }

    .hero-section h1 {
        font-size: 2.75rem;
    }
}
