/* 基本样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8fafc;
    color: #334155;
    padding: 0;
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

/* 日间模式下的左侧导航 */
.sidebar {
    background: #f8fafc;
    color: #334155;
    min-height: 100vh;
    padding: 0;
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
    transition: background 0.3s, color 0.3s, box-shadow 0.3s;
}

.nav-category-title {
    font-weight: 600;
    margin: 0;
    font-size: 1.3rem; /* 增大导航分类标题字体 */
    color: #64748b;
}

/* 夜间模式样式 */
[data-bs-theme="dark"] body {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .sidebar {
    background: #1e1e1e;
    color: #e0e0e0;
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .nav-category-title {
    color: #e0e0e0; /* 优化夜间模式下分类标题颜色 */
}

/* 分类导航样式 */
.list-group-item {
    background-color: transparent;
    color: #64748b;
    border: none;
    border-radius: 0;
    text-align: center;
    padding: 14px 5px;
    border-left: 3px solid transparent;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem; /* 增大分类字体 */
    flex-direction: column;
}

.list-group-item:hover, .list-group-item.active {
    background-color: #e2e8f0;
    color: #3b82f6;
    border-left: 3px solid #3b82f6;
}

[data-bs-theme="dark"] .list-group-item {
    color: #e0e0e0; /* 优化夜间模式下分类字体颜色 */
}

[data-bs-theme="dark"] .list-group-item:hover, 
[data-bs-theme="dark"] .list-group-item.active {
    background-color: #2d2d2d;
    color: #60a5fa;
    border-left: 3px solid #60a5fa;
}

.list-group-item i {
    width: 25px;
    text-align: center;
    margin-bottom: 5px;
    font-size: 1.3rem; /* 增大分类图标字体 */
}

/* 搜索区域样式 - 优化后 */
.search-section {
    background-color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
    transition: background-color 0.3s, box-shadow 0.3s, border 0.3s;
    margin: 0;
}

[data-bs-theme="dark"] .search-section {
    background-color: #2d2d2d; /* 修复搜索框背景色 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid #444;
}

.search-container {
    max-width: 100%;
    margin: 0;
    padding: 0 15px;
}

.input-group {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    transition: box-shadow 0.3s;
    margin: 0;
}

[data-bs-theme="dark"] .input-group {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.input-group-text {
    background-color: white;
    border-right: none;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    transition: background-color 0.3s, color 0.3s;
}

[data-bs-theme="dark"] .input-group-text {
    background-color: #3d3d3d;
    color: #60a5fa;
    border-color: #444;
}

.form-control {
    border-left: none;
    padding: 0.75rem;
    border-right: none;
    flex: 1 1 auto;
    background-color: white;
    color: #334155;
    transition: background-color 0.3s, color 0.3s;
    width: 100%;
}

[data-bs-theme="dark"] .form-control {
    background-color: #3d3d3d; /* 修复搜索框输入背景色 */
    color: #e2e8f0;
    border-color: #444;
}

.form-control:focus {
    box-shadow: none;
    border-color: #d1d5db;
}

[data-bs-theme="dark"] .form-control:focus {
    border-color: #475569;
}

.form-control::placeholder {
    color: #94a3b8;
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: #a0a0a0;
}

.search-engine-selector {
    position: relative;
    width: 160px;
    border-left: 1px solid #e2e8f0;
    transition: border 0.3s;
}

[data-bs-theme="dark"] .search-engine-selector {
    border-left: 1px solid #444;
}

.search-engine-selector::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 24px;
    width: 1px;
    background-color: #e2e8f0;
    transition: background-color 0.3s;
}

[data-bs-theme="dark"] .search-engine-selector::before {
    background-color: #444;
}

#engine-select {
    border: none;
    border-radius: 0;
    padding: 0.75rem 1rem 0.75rem 2rem;
    background-color: #f8fafc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%233b82f6'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    width: 100%;
    height: 100%;
    color: #334155;
    transition: background-color 0.3s, color 0.3s;
}

[data-bs-theme="dark"] #engine-select {
    background-color: #3d3d3d;
    color: #e2e8f0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2360a5fa'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
}

#engine-select:focus {
    box-shadow: none;
    background-color: #f1f5f9;
}

[data-bs-theme="dark"] #engine-select:focus {
    background-color: #444;
}

#search-button {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border-radius: 0 8px 8px 0;
    white-space: nowrap;
    border: none;
    background-color: #3b82f6;
    color: white;
    transition: background-color 0.3s;
}

[data-bs-theme="dark"] #search-button {
    background-color: #60a5fa;
    color: #0f172a;
}

#search-button:hover {
    background-color: #2563eb;
}

[data-bs-theme="dark"] #search-button:hover {
    background-color: #93c5fd;
}

/* 卡片样式 */
.card {
    border: none;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s;
    height: 100%;
    overflow: hidden;
}

[data-bs-theme="dark"] .card {
    background-color: #2d2d2d;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
}

[data-bs-theme="dark"] .card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

.card-body {
    padding: 1rem;
}

/* 小图标容器 - 用于列表视图 */
.card-icon-small {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%; /* 圆形图标容器 */
    background-color: #f1f5f9; /* 背景颜色 */
    padding: 5px; /* 添加内边距 */
}

.card-icon-small img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    display: block;
    border-radius: 50%; /* 圆形图片 */
}

.card-icon-small i {
    font-size: 1.5rem;
    color: #3b82f6;
}

[data-bs-theme="dark"] .card-icon-small {
    background-color: #475569; /* 夜间模式下的背景色 */
}

[data-bs-theme="dark"] .card-icon-small i {
    color: #60a5fa;
}

.card-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #1e293b;
    font-size: 1.1rem; /* 从1rem增大到1.1rem */
    transition: color 0.3s;
}

.card-title.only-title {
    display: flex;
    align-items: center;
    height: 100%;
    margin-bottom: 0;
}

[data-bs-theme="dark"] .card-title {
    color: #e2e8f0;
}

.card-text {
    color: #64748b;
    font-size: 0.9rem; /* 从0.8rem增大到0.9rem */
    line-height: 1.4;
    margin-bottom: 0;
    transition: color 0.3s;
}

[data-bs-theme="dark"] .card-text {
    color: #a0a0a0; /* 优化夜间模式下卡片文字颜色 */
}

/* 分类标题 */
.category-title {
    position: relative;
    padding-bottom: 10px;
    margin-top: 40px;
    margin-bottom: 25px;
    font-weight: 600;
    color: #1e293b;
    transition: color 0.3s;
    font-size: 1.5rem; /* 增大分类标题字体 */
}

[data-bs-theme="dark"] .category-title {
    color: #e2e8f0;
}

.category-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 60px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 3px;
}

[data-bs-theme="dark"] .category-title::after {
    background: linear-gradient(90deg, #60a5fa, #93c5fd);
}

/* 响应式调整 */
@media (max-width: 992px) {
    .search-container {
        max-width: 100%;
    }

    .search-engine-selector {
        width: 140px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .search-section {
        padding: 10px 0;
    }

    .input-group {
        flex-wrap: wrap;
    }

    .form-control {
        border-right: 1px solid #e2e8f0;
        border-radius: 8px 8px 0 0;
        order: 1;
    }

    [data-bs-theme="dark"] .form-control {
        border-right: 1px solid #444;
    }

    .search-engine-selector {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e2e8f0;
        order: 2;
    }

    [data-bs-theme="dark"] .search-engine-selector {
        border-top: 1px solid #444;
    }

    .search-engine-selector::before {
        display: none;
    }

    #engine-select {
        border-radius: 0;
        padding-left: 1rem;
        background-position: right 1rem center;
    }

    #search-button {
        width: 100%;
        border-radius: 0 0 8px 8px;
        order: 3;
    }

    .list-group-item {
        padding: 12px 5px;
        font-size: 1rem; /* 调整移动端分类字体大小 */
    }

    /* 移动设备上减小图标容器 */
    .card-icon-small {
        width: 36px;
        height: 36px;
    }

    /* 移动设备上减小图标大小 */
    .card-icon-small i {
        font-size: 1.3rem;
    }
    
    .category-title {
        font-size: 1.3rem; /* 调整移动端分类标题字体大小 */
    }
}

@media (max-width: 576px) {
    #search-button {
        padding: 0.75rem;
    }

    #engine-select {
        padding: 0.75rem 2rem 0.75rem 1rem;
    }

    .card-title {
        font-size: 0.9rem;
    }
    
    .card-text {
        font-size: 0.75rem;
    }
}

/* 内容区域容器 */
#content-area {
    padding: 20px;
    max-width: 100%;
    margin: 0 auto;
}

/* 分类部分 */
.category-section {
    margin-bottom: 40px;
}

/* 网站卡片网格 */
.row-cols-lg-4 > * {
    padding: 8px;
}

/* 卡片点击效果 */
.card {
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(59, 130, 246, 0.05);
    opacity: 0;
    transition: opacity 0.3s;
}

[data-bs-theme="dark"] .card::after {
    background: rgba(96, 165, 250, 0.05);
}

.card:hover::after {
    opacity: 1;
}

.card-title {
    position: relative;
    z-index: 1;
}

.card-text {
    position: relative;
    z-index: 1;
}

/* 导航栏样式 */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.navbar-brand {
    font-weight: 500;
}

/* 夜间模式下导航栏样式 */
[data-bs-theme="dark"] .navbar {
    background-color: #2d2d2d !important;
    box-shadow: 0 2px 4px rgba(0,0,0,.3);
}

[data-bs-theme="dark"] .navbar-brand {
    color: #e0e0e0 !important;
}

/* 搜索框样式 */
.search-box {
    position: sticky;
    top: 10px;
    z-index: 1000;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.search-box input::placeholder {
    color: #6c757d;
}

/* 夜间模式样式 */
[data-bs-theme="dark"] {
    --bs-dark: #1a1a1a;
    --bs-card-bg: #2d2d2d;
    --bs-body-bg: #1e1e1e;
    --bs-body-color: #e0e0e0;
    --bs-light: #2d2d2d;
    --bs-border-color: #444;
}

/* 夜间模式下搜索框样式 */
[data-bs-theme="dark"] .search-box {
    background: #2d2d2d;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

[data-bs-theme="dark"] .search-box input {
    background-color: #3d3d3d;
    border-color: #444;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .search-box input::placeholder {
    color: #a0a0a0;
}

[data-bs-theme="dark"] .search-box .input-group-text {
    background-color: #3d3d3d;
    border-color: #444;
    color: #e0e0e0;
}