/* 全局字体设置为微软雅黑 */
body {
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
}

html {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* 修复index.php顶部空白问题 */
.search-box {
    margin-top: 20px;
    margin-bottom: 20px;
}

.container {
    margin-top: 0;
    padding-top: 0;
}

/* 优化最近搜索样式 */
.search-tag {
    display: inline-block;
    padding: 3px 10px;
    margin: 0 5px 5px 0;
    background-color: #f8f9fa;
    color: #495057;
    border-radius: 20px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
}

.search-tag:hover {
    background-color: #28a745;
    color: #fff;
    border-color: #28a745;
    text-decoration: none;
}

.search-tag-hot {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}

.search-tag-hot:hover {
    background-color: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.search-tag .badge {
    margin-left: 5px;
    font-size: 0.75rem;
}

.search-tag:hover .badge {
    background-color: #212529 !important;
    color: #fff !important;
}

/* 调整分类和食物名称字体大小 */
.food-category h2 {
    font-size: 1.5rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
}

.food-category .d-flex {
    margin-bottom: 1rem;
}

.food-card .card-title {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* 美化食物卡片 */
.food-card {
    background-color: #f8f9fa;
    border-left: 3px solid var(--primary-color);
    transition: all 0.3s ease;
    margin-top: 20px; /* 增加与标题的间距 */
}

.food-card:hover {
    background-color: #ffffff;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

/* 详情页卡片样式 */
.food-detail-card, .food-search-card, .nutrition-table-card, 
.nutrition-analysis-card, .related-foods-card, .food-pairing-card {
    margin-top: 30px; /* 增加卡片之间的间距 */
    margin-bottom: 30px;
}

/* 营养素链接样式 */
.nutrition-link {
    color: #28a745;
    text-decoration: none;
    transition: all 0.3s ease;
}

.nutrition-link:hover {
    color: #218838;
    text-decoration: underline;
}

/* 搜索结果样式优化 */
.search-result-item {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.search-result-item:last-child {
    border-bottom: none;
}

.category-badge {
    display: inline-block;
    padding: 3px 10px;
    background-color: #e9f7ef;
    color: #28a745;
    border-radius: 20px;
    font-size: 0.85rem;
}
/* 全局字体设置为微软雅黑 */
body {
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
}

html {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* 修复index.php顶部空白问题 */
.search-box {
    margin-top: 20px;
    margin-bottom: 20px;
}

.container {
    margin-top: 0;
    padding-top: 0;
}

/* 优化最近搜索样式 */
.search-tag {
    display: inline-block;
    padding: 3px 10px;
    margin: 0 5px 5px 0;
    background-color: #f8f9fa;
    color: #495057;
    border-radius: 20px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
}

.search-tag:hover {
    background-color: #28a745;
    color: #fff;
    border-color: #28a745;
    text-decoration: none;
}

.search-tag-hot {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}

.search-tag-hot:hover {
    background-color: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.search-tag .badge {
    margin-left: 5px;
    font-size: 0.75rem;
}

.search-tag:hover .badge {
    background-color: #212529 !important;
    color: #fff !important;
}

/* 调整分类和食物名称字体大小 */
.food-category h2 {
    font-size: 1.5rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
}

.food-category .d-flex {
    margin-bottom: 1rem;
}

.food-card .card-title {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* 全局字体设置为微软雅黑 */
body {
    font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
}

html {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* 修复index.php顶部空白问题 */
.search-box {
    margin-top: 20px;
    margin-bottom: 20px;
}

.container {
    margin-top: 0;
    padding-top: 0;
}

/* 优化最近搜索样式 */
.search-tag {
    display: inline-block;
    padding: 3px 10px;
    margin: 0 5px 5px 0;
    background-color: #f8f9fa;
    color: #495057;
    border-radius: 20px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
}

.search-tag:hover {
    background-color: #28a745;
    color: #fff;
    border-color: #28a745;
    text-decoration: none;
}

.search-tag-hot {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}

.search-tag-hot:hover {
    background-color: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.search-tag .badge {
    margin-left: 5px;
    font-size: 0.75rem;
}

.search-tag:hover .badge {
    background-color: #212529 !important;
    color: #fff !important;
}

/* 调整分类和食物名称字体大小 */
.food-category h2 {
    font-size: 1.5rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
}

.food-category .d-flex {
    margin-bottom: 1rem;
}

.food-card .card-title {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* 美化食物卡片 */
.food-card {
    background-color: #f8f9fa;
    border-left: 3px solid var(--primary-color);
    transition: all 0.3s ease;
    margin-top: 20px;
}

.food-card:hover {
    background-color: #ffffff;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

/* 调整详情页标题和卡片间距 */
.food-detail-card h1, 
.food-detail-card h2, 
.food-detail-card h3,
.nutrition-table-card h2,
.nutrition-analysis-card h2,
.related-foods-card h3,
.food-pairing-card h3,
.food-search-card h3 {
    margin-bottom: 20px;
}

.card {
    margin-top: 10px;
}

/* 分类图标样式 */
.category-icon-水果:before {
    content: "\F4BC"; /* 水果图标 */
}

.category-icon-蔬菜:before {
    content: "\F3B1"; /* 蔬菜图标 */
}

.category-icon-肉类:before {
    content: "\F374"; /* 肉类图标 */
}

.category-icon-谷物:before {
    content: "\F293"; /* 谷物图标 */
}

.category-icon-豆类:before {
    content: "\F1A4"; /* 豆类图标 */
}

.category-icon-坚果:before {
    content: "\F1A5"; /* 坚果图标 */
}

.category-icon-海鲜:before {
    content: "\F3A9"; /* 海鲜图标 */
}

.category-icon-乳制品:before {
    content: "\F1B0"; /* 乳制品图标 */
}

.category-icon-饮料:before {
    content: "\F1C3"; /* 饮料图标 */
}

.category-icon-调味品:before {
    content: "\F1B1"; /* 调味品图标 */
}

/* 默认分类图标 */
.category-icon-default:before {
    content: "\F1F3"; /* 默认食物图标 */
}

/* 美化顶部分类菜单栏 */
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar-dark .navbar-nav .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 500;
}

.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1.5rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: #e9f7ef;
    color: #28a745;
}

/* 优化返回顶部按钮 */
#back-to-top {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
    padding: 0;
    line-height: 1;
}

#back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#back-to-top i {
    margin: 0;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    top: 0; /* 确保箭头完全居中 */
}

/* 修复轮播图点击切换问题 */
.swiper-button-prev, .swiper-button-next {
    z-index: 10;
    color: #fff !important;
    background-color: rgba(40, 167, 69, 0.7);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swiper-button-prev:after, .swiper-button-next:after {
    font-size: 20px;
}

.swiper-pagination-bullet {
    background: #fff;
    opacity: 0.8;
}

.swiper-pagination-bullet-active {
    background: var(--primary-color);
    opacity: 1;
}