/* ========== 全局样式与装饰 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: radial-gradient(circle at 20% 30%, #FFF9F0 0%, #FFEFDF 100%);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #2e241f;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" opacity="0.03"><path fill="%23d97a1c" d="M60,70 L80,60 L100,70 L120,60 L140,70 L130,100 L140,130 L120,140 L100,130 L80,140 L60,130 L70,100 Z"/><circle cx="100" cy="100" r="15"/></svg>');
    background-repeat: repeat;
    background-size: 80px;
    pointer-events: none;
    z-index: -1;
}

/* ========== 玻璃导航栏 ========== */
.navbar-glass {
    background: rgba(255, 248, 235, 0.75);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(230, 180, 120, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.8rem 2rem;
    transition: background 0.2s, backdrop-filter 0.2s;
}
.navbar-glass.scrolled {
    background: rgba(255, 245, 225, 0.9);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #E48D3A, #F2B46A);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1.2rem;
    border-radius: 2rem;
    font-weight: 600;
    color: #5a3e2e;
    transition: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    cursor: pointer;
}

.nav-link:hover {
    background: rgba(230, 160, 80, 0.2);
    transform: translateY(-2px);
}

.nav-link.active {
    background: #E48D3A;
    color: white;
    box-shadow: 0 4px 12px rgba(228, 141, 58, 0.3);
}

/* ========== 用户区域 ========== */
.user-area {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.user-area span {
    background: #E48D3A;
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-block;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.user-area .btn-logout,
.user-area button.btn-login {
    background: rgba(255,255,255,0.9);
    border: 1px solid #E48D3A;
    color: #E48D3A;
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.user-area .btn-logout:hover,
.user-area button.btn-login:hover {
    background: #E48D3A;
    color: white;
    transform: translateY(-1px);
}

.user-area button#showLoginBtn {
    background: #E48D3A;
    color: white;
    border: none;
    padding: 0.4rem 1.2rem;
    border-radius: 2rem;
    font-weight: 600;
}

/* ========== 主容器 ========== */
.main-container {
    max-width: 1300px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* 视图切换动画 */
.view {
    display: none;
    animation: fadeSlideUp 0.4s cubic-bezier(0.2, 0.9, 0.4, 1);
}

.view.active-view {
    display: block;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 英雄区 ========== */
.hero-section {
    text-align: center;
    margin: 1.5rem 0 1.5rem;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, #C3702A, #E48D3A);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}

.hero-section p {
    color: #a57c5c;
    font-size: 1rem;
}

/* ========== 搜索框 ========== */
.search-wrapper {
    max-width: 500px;
    margin: 1rem auto 0.5rem;
}

.search-box {
    display: flex;
    gap: 0.6rem;
    background: white;
    border-radius: 3rem;
    padding: 0.2rem 0.2rem 0.2rem 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.search-box:focus-within {
    box-shadow: 0 6px 18px rgba(228, 141, 58, 0.2);
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    padding: 0.6rem 0;
    background: transparent;
}

.search-box button {
    background: linear-gradient(100deg, #E48D3A, #F2B46A);
    border: none;
    border-radius: 2rem;
    padding: 0.4rem 1.5rem;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
}

.search-box button:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 10px rgba(228, 141, 58, 0.4);
}
.search-box button:active {
    transform: scale(0.98);
}

/* 地区栏 - 修复按钮换行 */
.region-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.8rem;
    max-width: 500px;
    margin: 0.5rem auto 1.5rem;
    padding: 0;
    flex-wrap: wrap;
}

.region-bar span {
    font-size: 0.85rem;
    font-weight: 500;
    color: #a57c5c;
}

.region-bar select {
    background: white;
    border: 1px solid #f0d5b0;
    border-radius: 2rem;
    padding: 0.3rem 1.5rem 0.3rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
    width: auto;
    min-width: 80px;
    text-align: center;
    text-align-last: center;
}

.region-bar button {
    background: #f8e2c0;
    border: none;
    border-radius: 2rem;
    padding: 0.3rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
    width: auto;
    min-width: 80px;
    white-space: nowrap;
    transition: all 0.2s;
}
.region-bar button:active {
    transform: scale(0.96);
}
.region-bar button:hover {
    background: #eccb9c;
    transform: translateY(-1px);
}

/* ========== 标题装饰 ========== */
.seasonal-section h2,
.view > h2,
#groupTitle h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #2e241f;
    position: relative;
    display: inline-block;
}
.seasonal-section h2::after,
.view > h2::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #E48D3A, #FFC785);
    border-radius: 2px;
}

/* ========== 卡片网格通用 ========== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

/* 卡片进入动画 */
.recipe-card, .post-card, .group-card {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 1.8rem;
    padding: 1.2rem;
    transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1), box-shadow 0.25s;
    box-shadow: 0 8px 20px rgba(0,0,0,0.03);
    border: 1px solid rgba(250, 210, 150, 0.5);
    cursor: pointer;
    animation: cardEnter 0.4s ease backwards;
}
@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* 错开延迟 */
.recipe-card:nth-child(1) { animation-delay: 0.02s; }
.recipe-card:nth-child(2) { animation-delay: 0.05s; }
.recipe-card:nth-child(3) { animation-delay: 0.08s; }
.recipe-card:nth-child(4) { animation-delay: 0.11s; }
.recipe-card:nth-child(5) { animation-delay: 0.14s; }
.recipe-card:nth-child(6) { animation-delay: 0.17s; }

.recipe-card:hover, .post-card:hover, .group-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 24px 36px -12px rgba(0,0,0,0.15);
    border-color: #E48D3A;
    background: white;
}

/* 人群卡片纹理 */
.group-card {
    background: linear-gradient(135deg, #fff8f0, #fff2e4), url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" opacity="0.08"><path fill="%23d97a1c" d="M20,30 L35,20 L50,30 L65,20 L80,30 L75,50 L80,70 L65,80 L50,70 L35,80 L20,70 L25,50 Z"/></svg>');
    background-repeat: repeat;
    background-size: 60px;
    background-blend-mode: overlay;
}

.group-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #C3702A;
    margin-bottom: 0.5rem;
}

.recipe-card img, .post-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 1.2rem;
    margin-bottom: 0.8rem;
}

.recipe-card strong, .post-card strong {
    font-size: 1.2rem;
    font-weight: 700;
}

.fav-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform 0.1s;
}
.fav-btn:active {
    transform: scale(1.2);
}

/* 时令蔬菜网格 */
.vegetable-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin: 1rem 0;
}

.vegetable-card {
    background: white;
    border-radius: 3rem;
    padding: 0.4rem 1.2rem;
    font-weight: 500;
    font-size: 0.85rem;
    border: 1px solid #f7d9a8;
    transition: all 0.2s;
    cursor: pointer;
}
.vegetable-card:active {
    transform: scale(0.96);
}
.vegetable-card:hover {
    background: #ffedd5;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* ========== 分类详情页 ========== */
.back-btn {
    background: rgba(228, 141, 58, 0.1);
    border: 1px solid #E48D3A;
    border-radius: 3rem;
    padding: 0.4rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: #C3702A;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
    cursor: pointer;
    margin-bottom: 1.5rem;
}
.back-btn:active {
    transform: scale(0.96);
}
.back-btn:hover {
    background: #E48D3A;
    color: white;
    border-color: #E48D3A;
    transform: translateX(-4px);
}

.group-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* 餐别筛选按钮 */
.meal-filter-buttons {
    display: flex;
    gap: 0.8rem;
    margin: 1rem 0 1.5rem;
    flex-wrap: wrap;
}

.meal-filter-btn {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    border: 1px solid #e5b88a;
    border-radius: 3rem;
    padding: 0.4rem 1.2rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: #7a583c;
    cursor: pointer;
    transition: all 0.2s;
}
.meal-filter-btn:active {
    transform: scale(0.96);
}
.meal-filter-btn.active {
    background: #E48D3A;
    color: white;
    border-color: #E48D3A;
    box-shadow: 0 2px 8px rgba(228,141,58,0.3);
}
.meal-filter-btn:hover:not(.active) {
    background: #f8e2c0;
    transform: translateY(-2px);
}

/* ========== 模态框 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 2rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 30px 50px -20px rgba(0,0,0,0.3);
    animation: modalPop 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.2);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-large {
    max-width: 750px;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #b48c64;
    transition: color 0.2s;
}
.modal-close:hover {
    color: #E48D3A;
}

/* 菜谱详情优化 */
.modal-image {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 1rem;
    margin-bottom: 0.75rem;
}
.steps-container {
    background: #fef7e8;
    padding: 1rem;
    border-radius: 1.2rem;
    margin-top: 1rem;
    max-height: 280px;
    overflow-y: auto;
    line-height: 1.6;
    font-size: 0.9rem;
}
.step-item {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}
.step-num {
    background: #E48D3A;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.7rem;
}

/* 登录注册 tabs */
.tab-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.tab-header button {
    background: #f0ebe3;
    border: none;
    padding: 0.5rem 1rem;
    font-weight: 600;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #5a3e2e;
}
.tab-header button.active {
    background: #E48D3A;
    color: white;
    box-shadow: 0 2px 6px rgba(228,141,58,0.3);
}
.tab-header button:hover:not(.active) {
    background: #e5d9c8;
}

.modal-input {
    width: 100%;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid #f0d5b0;
    border-radius: 1.2rem;
    background: #fffcf8;
    outline: none;
    transition: border 0.2s;
}
.modal-input:focus {
    border-color: #E48D3A;
    box-shadow: 0 0 0 3px rgba(228,141,58,0.15);
}
.modal-btn {
    width: 100%;
    background: linear-gradient(100deg, #E48D3A, #F2B46A);
    border: none;
    border-radius: 2rem;
    padding: 0.8rem;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.1s;
}
.modal-btn:active {
    transform: scale(0.98);
}
.modal-btn:hover {
    transform: scale(1.02);
}
.auth-message {
    color: #e03a3a;
    font-size: 0.8rem;
    margin-top: 0.8rem;
    text-align: center;
}

/* 通用输入框 */
input, textarea, select {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid #f0d5b0;
    border-radius: 1.2rem;
    background: #fffcf8;
    margin-bottom: 1rem;
    outline: none;
    transition: border 0.2s;
    font-size: 0.9rem;
}
input:focus, textarea:focus, select:focus {
    border-color: #E48D3A;
    box-shadow: 0 0 0 2px rgba(228,141,58,0.1);
}

/* 营养网格 */
.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    background: #fff6ed;
    padding: 0.5rem;
    border-radius: 1.5rem;
    margin: 1rem 0;
    text-align: center;
}
.nutrition-grid div span {
    display: block;
    font-size: 0.7rem;
    color: #a57c5c;
}
.nutrition-grid strong {
    font-size: 1rem;
    font-weight: 800;
    color: #C3702A;
}

/* 标签容器 */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.8rem 0;
}
.tags-container span {
    background: #fbe8cf;
    padding: 0.2rem 0.8rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #a55d2a;
}

/* 社区编辑器 */
.post-editor {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.03);
}
.post-editor button {
    background: #E48D3A;
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 2rem;
    font-weight: 600;
    width: auto;
    transition: transform 0.1s;
}
.post-editor button:active {
    transform: scale(0.97);
}
.community-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.tab-btn {
    background: none;
    border: none;
    padding: 0.3rem 1rem;
    border-radius: 2rem;
    font-weight: 500;
    transition: all 0.2s;
}
.tab-btn.active {
    background: #E48D3A;
    color: white;
}

/* 个人资料卡片 */
.profile-card {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.favorites-entry {
    background: #ffefdb;
    border-radius: 1.5rem;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    transition: 0.2s;
}
.favorites-entry:active {
    transform: scale(0.98);
}
.favorites-entry:hover {
    background: #ffe3c2;
    transform: translateY(-2px);
}
.logout-btn {
    background: none;
    border: 1px solid #E48D3A;
    color: #E48D3A;
    border-radius: 2rem;
    padding: 0.4rem 1.2rem;
    margin-top: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.logout-btn:active {
    transform: scale(0.96);
}
.logout-btn:hover {
    background: #E48D3A;
    color: white;
}

/* 隐藏原有样式保留功能 */
.recipe-desc-hidden {
    display: none;
}

/* 点赞动画 */
.like-animate {
    animation: likeBump 0.2s ease;
}
@keyframes likeBump {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); background: #E48D3A; color: white; }
    100% { transform: scale(1); }
}

/* 骨架屏动画 */
.loading-skeleton {
    background: linear-gradient(90deg, #f0e7dc 25%, #f5ede2 50%, #f0e7dc 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: 1rem;
}
@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 响应式 */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    .main-container {
        padding: 0 1rem;
    }
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .hero-section h1 {
        font-size: 2rem;
    }
    .region-bar {
        justify-content: center;
    }
    .region-bar select,
    .region-bar button {
        width: auto;
        min-width: 70px;
    }
    .modal-image {
        max-height: 150px;
    }
    .steps-container {
        max-height: 240px;
    }
}