/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: 'AlimamaFangYuanTiVF';
    src: url('fonts/AlimamaFangYuanTiVF/AlimamaFangYuanTiVF-Thin.woff2') format('woff2'),
         url('fonts/AlimamaFangYuanTiVF/AlimamaFangYuanTiVF-Thin.woff') format('woff'),
         url('fonts/AlimamaFangYuanTiVF/AlimamaFangYuanTiVF-Thin.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body {
    font-family: "AlimamaFangYuanTiVF", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding-bottom: 60px; /* 为移动端底部导航栏留出空间 */
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部 */
.header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.site-logo a {
    font-size: 24px;
    font-weight: bold;
    color: #409EFF;
    text-decoration: none;
}

.nav-menu ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    margin: 0 15px;
}

.nav-menu a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: #409EFF;
    background-color: rgba(64, 158, 255, 0.1);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-menu a {
    color: #409EFF;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 4px;
    border: 1px solid #409EFF;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-menu a:hover {
    background-color: #409EFF;
    color: white;
}

.nav-icon {
    font-size: 16px;
}

/* 面包屑导航 */
.breadcrumb {
    padding: 15px 0;
    font-size: 14px;
}

.breadcrumb a {
    color: #409EFF;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span:not(.active) {
    color: #999;
}

.breadcrumb .active {
    color: #333;
}

/* 卡片 */
.card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    background-color: #fafafa;
}

.card-header h1,
.card-header h2,
.card-header h3 {
    margin: 0;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #409EFF;
    box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #409EFF;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s;
    font-size: 16px;
    font-weight: 500;
}

.btn:hover {
    background-color: #66b1ff;
}

.btn-secondary {
    background-color: #909399;
}

.btn-secondary:hover {
    background-color: #a6a9ad;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 14px;
}

/* 警告框 */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-icon {
    font-size: 18px;
    line-height: 1;
}

.alert-danger {
    background-color: #fef0f0;
    border: 1px solid #fde2e2;
    color: #f56c6c;
}

.alert-success {
    background-color: #f0f9eb;
    border: 1px solid #e1f3d8;
    color: #67c23a;
}

.alert-info {
    background-color: #edf6ff;
    border: 1px solid #d0e6ff;
    color: #409eff;
}

.alert-warning {
    background-color: #fdf6ec;
    border: 1px solid #faecd8;
    color: #e6a23c;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 10px;
    font-weight: 500;
}

.badge-success {
    background-color: #f0f9eb;
    color: #67c23a;
    border: 1px solid #e1f3d8;
}

.badge-warning {
    background-color: #fdf6ec;
    color: #e6a23c;
    border: 1px solid #faecd8;
}

.badge-danger {
    background-color: #fef0f0;
    color: #f56c6c;
    border: 1px solid #fde2e2;
}

/* 网格系统 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col-12,
.col-8,
.col-6,
.col-4 {
    padding: 0 10px;
    margin-bottom: 20px;
}

.col-12 {
    width: 100%;
}

.col-8 {
    width: 66.666667%;
}

.col-6 {
    width: 50%;
}

.col-4 {
    width: 33.333333%;
}

/* 首页特色区域 */
.hero {
    background: linear-gradient(135deg, #409EFF 0%, #64b5f6 100%);
    color: #fff;
    padding: 80px 0;
    text-align: center;
    margin-bottom: 40px;
    border-radius: 0 0 10px 10px;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 20px;
}

.hero-subtitle {
    font-size: 20px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.hero-btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: #fff;
    color: #409EFF;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.hero-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* 首页内容区域 */
.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: #409EFF;
    border-radius: 3px;
}

.section-description {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 16px;
}

/* 食谱卡片 */
.recipe-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.recipe-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.recipe-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.recipe-card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.recipe-card-description {
    color: #666;
    flex: 1;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.recipe-card-meta {
    display: flex;
    justify-content: space-between;
    color: #999;
    font-size: 14px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* 食谱详情页 */
.recipe-detail-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.recipe-detail-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #333;
}

.recipe-detail-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    color: #666;
    margin-bottom: 20px;
}

.recipe-detail-image-container {
    text-align: center;
}

.recipe-detail-image {
    max-width: 100%;
    border-radius: 8px;
}

.no-image {
    padding: 40px;
    text-align: center;
    background-color: #f8f9fa;
    color: #6c757d;
    border-radius: 8px;
    font-style: italic;
}

.recipe-detail-section {
    margin-bottom: 30px;
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.recipe-detail-section h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #409EFF;
}

.recipe-ingredients-list,
.recipe-instructions-list {
    padding-left: 20px;
}

.recipe-ingredients-list li,
.recipe-instructions-list li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.recipe-ingredients-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
}

.recipe-ingredient-name {
    font-weight: 500;
}

.recipe-ingredient-quantity {
    color: #666;
}

.recipe-actions {
    margin: 20px 0;
    text-align: center;
}

.favorite-form {
    display: inline-block;
}

.recipe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.recipe-tag {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.vegetarian {
    background-color: #e8f5e9;
    color: #4caf50;
}

.gluten-free {
    background-color: #e3f2fd;
    color: #2196f3;
}

.low-sugar {
    background-color: #fff3e0;
    color: #ff9800;
}

.high-protein {
    background-color: #fce4ec;
    color: #e91e63;
}

.allergen-warning {
    padding: 15px;
    background-color: #fff8e1;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

/* 个人中心 */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.dashboard-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.welcome-message {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-link {
    color: #f56c6c;
    text-decoration: none;
}

.logout-link:hover {
    text-decoration: underline;
}

.form-section {
    margin-bottom: 30px;
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.form-section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* 食材大全页面 */
.category-title {
    font-size: 24px;
    font-weight: 600;
    margin: 30px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #409EFF;
}

.ingredients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.ingredient-item {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 15px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.ingredient-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.ingredient-name {
    font-weight: 500;
    margin-bottom: 5px;
}

.ingredient-category {
    font-size: 14px;
    color: #999;
}

/* 页脚 */
.footer {
    background-color: #f8f9fa;
    color: #6c757d;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #dee2e6;
}

.footer p {
    text-align: center;
    margin: 0;
    font-size: 14px;
}

/* 搜索表单 */
.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.search-form .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.search-form .form-actions {
    display: flex;
    gap: 10px;
}

.view-all-recipes {
    text-align: center;
    margin-top: 30px;
}

/* 移动端底部导航栏 */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.mobile-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav li {
    flex: 1;
}

.mobile-nav a {
    display: block;
    text-align: center;
    padding: 8px 0;
    color: #666;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.3s ease;
}

.mobile-nav a:hover,
.mobile-nav a.active {
    color: #409EFF;
}

.nav-text {
    display: block;
    margin-top: 2px;
}

.mobile-nav .nav-icon {
    font-size: 18px;
    display: block;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        position: relative; /* 移动端不固定头部 */
        box-shadow: none;
        border-bottom: 1px solid #eee;
    }
    
    .desktop-nav {
        display: none;
    }
    
    .mobile-nav {
        display: block;
    }
    
    body {
        padding-bottom: 60px; /* 为底部导航栏留出空间 */
    }
    
    .container {
        padding: 0 15px;
    }
    
    .col-8,
    .col-6,
    .col-4 {
        width: 100%;
    }
    
    .dashboard-header {
        flex-direction: column;
        text-align: center;
    }
    
    .welcome-message {
        justify-content: center;
    }
    
    .recipe-detail-title {
        font-size: 28px;
    }
    
    .recipe-detail-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .ingredients-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .section-title {
        font-size: 24px;
    }
    
    .recipe-card-title {
        font-size: 16px;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-form .form-group {
        min-width: 100%;
    }
    
    .search-form .form-actions {
        width: 100%;
        justify-content: center;
    }
    
    .filter-group {
        flex-direction: column;
    }
    
    .filter-option {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        margin: 30% auto;
        width: 95%;
    }
    
    .nav-menu a,
    .user-menu a {
        gap: 3px;
        padding: 6px 10px;
    }
    
    .nav-icon {
        font-size: 14px;
    }
}

@media (max-width: 992px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-menu ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-menu li {
        margin: 5px 10px;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 10px;
    }
    
    .hero {
        padding: 40px 0;
    }
    
    .hero-title {
        font-size: 28px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .nav-menu li {
        margin: 5px;
    }
    
    .user-menu {
        gap: 10px;
    }
    
    .user-menu a {
        padding: 6px 10px;
        font-size: 14px;
    }
}

.login-section {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px 0;
}

.login-card {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.login-form {
    margin-top: 20px;
}

.btn-block {
    width: 100%;
}

.login-links {
    margin-top: 20px;
    text-align: center;
}

.login-links a {
    color: #409EFF;
    text-decoration: none;
}

.login-links a:hover {
    text-decoration: underline;
}

.register-section {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px 0;
}

.register-card {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.register-form {
    margin-top: 20px;
}

.register-links {
    margin-top: 20px;
    text-align: center;
}

.register-links a {
    color: #409EFF;
    text-decoration: none;
}

.register-links a:hover {
    text-decoration: underline;
}

/* 食谱大全页面筛选区域 */
.recipes-filter-section {
    margin-bottom: 30px;
}

.search-section {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.search-form .form-group {
    flex: 1;
    min-width: 250px;
    margin-bottom: 0;
}

.search-form .form-actions {
    display: flex;
    gap: 10px;
}

.filters-section {
    padding-top: 10px;
}

.filters-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

.filters-form {
    margin-bottom: 15px;
}

.filter-options {
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.filter-option {
    display: inline-flex;
    align-items: center;
    padding: 8px 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.filter-option:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
}

.filter-option.active {
    background-color: #409EFF;
    border-color: #409EFF;
    color: white;
}

.filter-option input[type="checkbox"] {
    margin-right: 8px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #333;
}

.modal-content h2 {
    margin-top: 0;
    padding: 20px 20px 10px;
    border-bottom: 1px solid #eee;
}

.modal-content form {
    padding: 20px;
}

.modal-content .form-group {
    margin-bottom: 20px;
}

.modal-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.modal-content .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

.modal-content .btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #409EFF;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    font-size: 16px;
    transition: background-color 0.3s;
}

.modal-content .btn:hover {
    background-color: #337ecc;
}

.modal-content .btn-block {
    width: 100%;
}

.modal-content p {
    text-align: center;
    margin: 15px 0;
}

.modal-content a {
    color: #409EFF;
    text-decoration: none;
}

.modal-content a:hover {
    text-decoration: underline;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .search-form {
        flex-direction: column;
    }
    
    .search-form .form-group {
        min-width: 100%;
    }
    
    .search-form .form-actions {
        width: 100%;
        justify-content: center;
    }
    
    .filter-group {
        flex-direction: column;
    }
    
    .filter-option {
        width: 100%;
        justify-content: center;
    }
}
