/* === 老乡鸡菜谱宝典 - 经典英伦优雅设计 === */

/* === CSS变量调色板 - 经典英伦风格 === */
:root {
    /* 主色调 - 英国贵族建筑配色 */
    --primary-color: #2C3E50; /* 深海蓝 */
    --secondary-color: #E74C3C; /* 红砖色 */
    --accent-color: #F39C12; /* 黄金色 */
    --light-accent: #F8C291; /* 胡萝卜色 */
    --text-primary: #2C3E50;
    --text-secondary: #7F8C8D;
    --text-muted: #95A5A6;
    
    /* 背景色 - 典雅木质 */
    --bg-main: #F8F9FA; /* 浅灰 */
    --bg-secondary: #E8F5E9; /* 薄荷绿 */
    --bg-card: #FFFFFF; /* 纯白 */
    --bg-header: #FFFFFF; /* 纯白带阴影 */
    
    /* 边框颜色 */
    --border-color: #BDC3C7;
    
    /* 渐变色 - 英国皇室配色 */
    --gradient-primary: linear-gradient(135deg, #2C3E50, #34495E);
    --gradient-accent: linear-gradient(45deg, #E74C3C, #C0392B);
    --gradient-light: linear-gradient(45deg, #F39C12, #E67E22);
    
    /* 阴影效果 */
    --shadow-small: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 6px rgba(0,0,0,0.15);
    --shadow-large: 0 10px 20px rgba(0,0,0,0.2);
    
    /* 圆角 */
    --border-radius: 8px;
    --border-radius-large: 12px;
    
    /* 字体大小 */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
}

/* === 基础样式 === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Serif SC', 'Georgia', 'Times New Roman', serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-main);
    transition: all 0.3s ease;
}

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

/* === 全局装饰元素 === */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, var(--bg-header), transparent);
    z-index: -1;
}

/* === 头部 === */
.header-decoration {
    background: var(--gradient-primary);
    color: white;
    padding: 3rem 0 2rem;
    text-align: center;
    box-shadow: var(--shadow-large);
}

.header-decoration::before {
    content: '菜谱宝典';
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header h1 {
    font-family: 'Noto Sans SC', 'Arial', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.tagline {
    display: inline-block;
    padding: 8px 20px;
    border: 2px solid var(--accent-color);
    border-radius: 25px;
    background: var(--bg-card);
    color: var(--accent-color);
    font-weight: 600;
    animation: pulse 2s infinite;
}

/* === 动画效果 === */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* === 主要布局容器 === */
.main-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    margin: 2rem 0;
    padding-bottom: 4rem;
}

/* === AI推荐功能区 === */
.ai-recommendation {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-medium);
}

.ai-recommendation h2 {
    font-family: 'Noto Sans SC', 'Arial', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    border-bottom: 3px solid var(--accent-color);
    padding-bottom: 8px;
}

.recommendation-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.recommendation-btn {
    font-family: 'Noto Sans SC', 'Arial', sans-serif;
    padding: 1.2rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.recommendation-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.recommendation-btn:hover::before {
    left: 100%;
}

.recommendation-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* === 推荐按钮样式 === */
.recommendation-btn.simple {
    background: linear-gradient(135deg, #28B463, #22995A);
    color: white;
}

.recommendation-btn.surprise {
    background: linear-gradient(135deg, #F39C12, #E67E22);
    color: white;
}

.recommendation-btn.sweet {
    background: linear-gradient(135deg, #E91E63, #C2185B);
    color: white;
}

.recommendation-btn.fast {
    background: linear-gradient(135deg, #3498DB, #2980B9);
    color: white;
}

/* === 搜索和筛选区域 === */
.search-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.search-container label {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 60px;
}

.search-input, .filter-select {
    font-family: 'Noto Sans SC', 'Arial', sans-serif;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    width: 200px;
    transition: border-color 0.3s ease;
}

.search-input:focus, .filter-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.1);
}

.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 80px;
    text-align: center;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* === 菜谱卡片展示区 === */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.recipe-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-large);
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-large);
    border-color: var(--accent-color);
}

.recipe-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.recipe-card:hover::before {
    transform: scaleX(1);
}

.recipe-header {
    background: var(--gradient-accent);
    color: white;
    padding: 1rem;
    position: relative;
}

.recipe-header .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
}

.recipe-header h3 {
    font-family: 'Noto Sans SC', 'Arial', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    z-index: 1;
}

.recipe-info {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.5rem;
    z-index: 1;
}

.recipe-content {
    padding: 1.5rem;
}

.recipe-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.category-tag {
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-header);
}

.category-tag 主食 {
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    color: white;
}

.category-tag 炒菜 {
    background: linear-gradient(45deg, #45B7CF, #E03D70);
    color: white;
}

.category-tag.蒸菜 {
    background: linear-gradient(45deg, #F39C12, #E67E22);
    color: white;
}

.recipe-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.recipe-ingredients {
    margin-bottom: 1.5rem;
}

.recipe-ingredients h4 {
    font-family: 'Noto Sans SC', 'Arial', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.recipe-ingredients-list {
    list-style: none;
}

.recipe-ingredients-list li {
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.96rem;
}

.recipe-ingredients-list li:last-child {
    border-bottom: none;
}

.recipe-preview-btn {
    font-family: 'Noto Sans SC', 'Arial', sans-serif;
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: var(--border-radius);
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.recipe-preview-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* === 模态框 === */
.recipe-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    padding: 2rem;
}

.recipe-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-large);
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    background: var(--gradient-primary);
    color: white;
    padding: 1.5rem;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255,255,255,0.2);
}

.modal-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--bg-card);
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.modal-body h3 {
    font-family: 'Noto Sans SC', 'Arial', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-align: center;
}

.recipe-details {
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-header);
}

.recipe-details h4 {
    font-family: 'Noto Sans SC', 'Arial', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
}

.recipe-details ul {
    padding-left: 1.2rem;
}

/* === 页脚 === */
footer {
    background: var(--gradient-primary);
    color: white;
    padding: 3rem 0;
    text-align: center;
    margin-top: 4rem;
}

footer .container {
    max-width: 800px;
}

footer p {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

/* === 响应式设计 === */
@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .ai-recommendation {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .recommendation-buttons {
        grid-template-columns: 1fr;
    }
    
    .search-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .recipe-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    recipe-meta {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        padding-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .recipe-modal {
        padding: 1rem;
    }
    
    .modal-content {
        width: 100%;
        height: 95vh;
    }
    
    .recipe-grid {
        grid-template-columns: 1fr;
    }
}

/* === 加载状态 === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--bg-secondary);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

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

/* === 错误状态 === */
.error-message {
    padding: 1rem;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-small);
}

/* === 焦点状态 === */
*:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}