/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f9f0;
    color: #333;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    background-color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    position: relative;
}

/* App Bar */
.app-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #4CAF50;
    margin-bottom: 0;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    z-index: 100;
    box-sizing: border-box;
}

.app-bar-left {
    display: flex;
    align-items: center;
}

.app-logo {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
    color: #fff;
}

.app-title {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    margin-right: 5px;
}

.app-subtitle {
    font-size: 12px;
    color: #4CAF50;
    background-color: #fff;
    padding: 3px 8px;
    border-radius: 15px;
}

.vip-button {
    background-color: #ffd700; /* Gold */
    color: #8B4513; /* SaddleBrown */
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.vip-button i {
    margin-right: 5px;
}

/* Search Bar */
.search-bar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: #f0f0f0;
    margin: 0 10px;
    border-radius: 20px;
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    z-index: 99;
    box-sizing: border-box;
}

.search-bar i {
    margin-right: 10px;
    color: #999;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    flex-grow: 1;
    font-size: 14px;
}

/* 食材大类区域 - 手机版 */
.mobile-category-section {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    z-index: 98;
    box-sizing: border-box;
}

.mobile-category-section h2 {
    margin-bottom: 15px;
    font-size: 1.2em;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

/* 手机版大类网格 */
.mobile-category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 8px;
    max-height: 120px;
    overflow: hidden;
}

.category-item {
    padding: 2px 3px;
    background-color: #fff;
    border: 2px solid #d9534f;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.3s ease;
    color: #d9534f;
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-item:hover {
    background-color: #d9534f;
    color: #fff;
    transform: translateY(-2px);
}

.category-item.active {
    background-color: #d9534f;
    color: #fff;
}

/* 手机版小类区域 */
.mobile-subcategory-section {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.mobile-subcategory-section h2 {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

/* 手机版小类网格 */
.mobile-subcategory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 8px;
    max-height: 120px;
    overflow: hidden;
}

.subcategory-item {
    padding: 8px 5px;
    background-color: #fff;
    border: 2px solid #5cb85c;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.3s ease;
    color: #5cb85c;
    font-weight: 500;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subcategory-item:hover {
    background-color: #5cb85c;
    color: #fff;
    transform: translateY(-2px);
}

.subcategory-item.active {
    background-color: #5cb85c;
    color: #fff;
}

/* 更多按钮样式 */
.more-item {
    background-color: #f8f9fa;
    border: 2px dashed #adb5bd;
    color: #6c757d;
    font-style: italic;
    cursor: pointer;
    transition: all 0.3s ease;
}

.more-item:hover {
    background-color: #e9ecef;
    border-color: #6c757d;
}

/* 食材列表区域 */
.ingredient-list-section {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    margin-top: 180px;
    margin-bottom: 60px;
}

.ingredient-list-section h2 {
    margin-bottom: 20px;
    font-size: 1.5em;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

/* 手机版食材网格 */
.ingredient-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    overflow: hidden;
    flex: 1;
    padding-right: 5px;
}

.ingredient-card {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.ingredient-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.ingredient-card.active {
    border: 3px solid #ffc107;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

.ingredient-image {
    width: 100%;
    padding-top: 133.33%; /* 3:4 比例 */
    position: relative;
    border-radius: 5px;
    margin-bottom: 12px;
    background-color: #e0e0e0;
    overflow: hidden;
}

.ingredient-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ingredient-name {
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.3;
}

.ingredient-desc {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
    min-height: 36px;
    line-height: 1.3;
}

.ingredient-origin {
    font-size: 0.85em;
    color: #5cb85c;
    margin: 8px 0;
    font-weight: 500;
    line-height: 1.3;
}

/* 右下：位置筛选区域 */
.location-section {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.location-section h2 {
    margin-bottom: 15px;
    font-size: 1.2em;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.location-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
    overflow: hidden;
}

.location-column {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.location-column h3 {
    font-size: 1em;
    color: #666;
    margin-bottom: 10px;
    text-align: center;
}

.location-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.location-item {
    padding: 8px 12px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.3s ease;
    color: #666;
    font-weight: 500;
    text-align: center;
}

.location-item:hover {
    background-color: #f0f0f0;
    color: #333;
    transform: translateY(-1px);
}

.location-item.active {
    background-color: #428bca;
    color: #fff;
    border-color: #428bca;
}

/* 滚动条样式 */
.ingredient-grid::-webkit-scrollbar {
    width: 6px;
}

.ingredient-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ingredient-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ingredient-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 食材分类显示样式 */
.ingredient-category {
    font-size: 0.85em;
    color: #5cb85c;
    margin: 8px 0;
    font-weight: 500;
    line-height: 1.3;
}

/* 底部导航栏 */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    border-top: 1px solid #eee;
    background-color: #fff;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 101;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #999;
    font-size: 10px;
}

.bottom-nav .nav-item.active {
    color: #4CAF50;
}

.bottom-nav .nav-item i {
    font-size: 20px;
    margin-bottom: 3px;
}

/* 弹出窗口样式 */
.category-modal, .subcategory-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    width: 90%;
    max-width: 300px;
    border-radius: 10px;
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2em;
    color: #333;
}

.close-btn {
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-body .category-item {
    margin: 0;
    padding: 8px;
    font-size: 0.85em;
    border: 1px solid #d9534f;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.modal-body .subcategory-item {
    margin: 0;
    padding: 8px;
    font-size: 0.85em;
    border: 1px solid #5cb85c;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.modal-body .category-item:hover {
    background-color: #d9534f;
    color: #fff;
    transform: translateY(-1px);
}

.modal-body .subcategory-item:hover {
    background-color: #5cb85c;
    color: #fff;
    transform: translateY(-1px);
}

/* 分类标题样式 */
.category-title {
    font-size: 1em;
    font-weight: 600;
    color: #333;
    margin: 10px 0 5px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

/* 小类容器样式 */
.subcategory-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

/* 小类项目样式 */
.subcategory-container .subcategory-item {
    padding: 8px;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
    color: #666;
    text-align: center;
}

.subcategory-container .subcategory-item:hover {
    background-color: #e9ecef;
    color: #333;
    transform: translateY(-1px);
}


