/* ========== 全局样式 ========== */
:root {
    --primary: #e67e22;
    --primary-dark: #d35400;
    --secondary: #f39c12;
    --bg: #faf8f5;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #e8e4df;
    --success: #27ae60;
    --warning: #f39c12;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-hover: 0 8px 24px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== 头部 ========== */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 40px 0 60px;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '🍳';
    position: absolute;
    font-size: 120px;
    opacity: 0.08;
    top: -20px;
    right: 10%;
    transform: rotate(15deg);
}

.header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header p {
    font-size: 1rem;
    opacity: 0.95;
    margin-bottom: 24px;
}

/* ========== 搜索框 ========== */
.search-box {
    max-width: 560px;
    margin: 0 auto;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 16px 24px;
    padding-right: 56px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    outline: none;
    transition: box-shadow 0.3s;
}

.search-box input:focus {
    box-shadow: 0 4px 24px rgba(230,126,34,0.25);
}

.search-box button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.3s;
}

.search-box button:hover {
    background: var(--primary-dark);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
    display: none;
}

.search-dropdown.active { display: block; }

.search-dropdown .item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.search-dropdown .item:hover {
    background: #fff8f0;
}

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

.search-dropdown .item-name {
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
}

.search-dropdown .item-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 2px;
}

/* ========== 分类导航 ========== */
.categories {
    padding: 30px 0 10px;
}

.cat-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.cat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.cat-item:hover, .cat-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ========== 内容区块标题 ========== */
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 40px 0 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title span { font-size: 1.5rem; }

/* ========== 热门食材卡片 ========== */
.hot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.hot-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
    border: 1px solid var(--border);
}

.hot-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.hot-card .icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.hot-card h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text);
}

.hot-card p {
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== 食材详情页 ========== */
.ingredient-hero {
    background: linear-gradient(135deg, #fff8f0 0%, #fff 100%);
    padding: 40px 0;
    border-bottom: 1px solid var(--border);
}

.ingredient-hero h1 {
    font-size: 2rem;
    margin-bottom: 12px;
}

.ingredient-hero .meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--text-light);
    font-size: 0.9rem;
}

.ingredient-hero .meta span {
    background: white;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.ingredient-info {
    padding: 30px 0;
}

.info-block {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.info-block h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-block p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ========== 替代方案卡片 ========== */
.substitute-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sub-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.sub-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.sub-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.sub-card-header h3 {
    font-size: 1.2rem;
    color: var(--primary-dark);
}

.sub-ratio {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
}

.sub-details {
    display: grid;
    gap: 12px;
}

.sub-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.sub-row .label {
    min-width: 80px;
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sub-row .value {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.5;
}

.sub-tips {
    background: #fff8f0;
    border-left: 4px solid var(--primary);
    padding: 12px 16px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ========== 文章卡片 ========== */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.article-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.3s;
    cursor: pointer;
}

.article-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
    transform: translateX(4px);
}

.article-card h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--text);
}

.article-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card .meta {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-light);
    display: flex;
    gap: 16px;
}

/* ========== 文章详情页 ========== */
.article-content {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin: 30px 0;
}

.article-content h1 {
    font-size: 1.8rem;
    margin-bottom: 16px;
    line-height: 1.3;
}

.article-content h2 {
    font-size: 1.3rem;
    margin: 28px 0 12px;
    color: var(--primary-dark);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.article-content h3 {
    font-size: 1.1rem;
    margin: 20px 0 10px;
    color: var(--text);
}

.article-content p {
    margin-bottom: 12px;
    color: var(--text-light);
    line-height: 1.8;
}

.article-content ul, .article-content ol {
    margin: 12px 0 12px 24px;
    color: var(--text-light);
}

.article-content li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.article-content strong {
    color: var(--text);
}

/* ========== 面包屑 ========== */
.breadcrumb {
    padding: 16px 0;
    font-size: 0.85rem;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--primary);
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ========== 底部 ========== */
.footer {
    background: var(--text);
    color: white;
    padding: 30px 0;
    text-align: center;
    margin-top: 60px;
    font-size: 0.9rem;
}

.footer a {
    color: var(--secondary);
}

/* ========== 加载动画 ========== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 空状态 ========== */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ========== 响应式 ========== */
@media (max-width: 600px) {
    .header h1 { font-size: 1.6rem; }
    .header { padding: 30px 0 40px; }
    .hot-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .hot-card { padding: 16px 12px; }
    .sub-card-header { flex-direction: column; align-items: flex-start; }
    .article-content { padding: 24px 16px; }
    .sub-row { flex-direction: column; gap: 4px; }
    .sub-row .label { min-width: auto; }
}
