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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
}

/* Typography - Heading Hierarchy */
h1 {
    font-size: 2.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    margin-top: 0;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    margin-top: 0;
    line-height: 1.3;
}

h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin: 25px 0 15px 0;
    line-height: 1.4;
}

/* Responsive typography - Mobile First Approach */
/* Tablet (768px and below) */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
        margin-bottom: 12px;
        line-height: 1.25;
    }
    
    h2 {
        font-size: 1.3rem;
        margin-bottom: 12px;
        line-height: 1.35;
    }
    
    h3 {
        font-size: 1.1rem;
        margin: 20px 0 12px 0;
        line-height: 1.4;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
        margin-bottom: 10px;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 1.4rem;
        margin-bottom: 10px;
        line-height: 1.4;
    }
    
    h3 {
        font-size: 1rem;
        margin: 18px 0 10px 0;
        line-height: 1.45;
    }
}

/* Small Mobile (360px and below) */
@media (max-width: 360px) {
    h1 {
        font-size: 1.8rem;
        margin-bottom: 8px;
        line-height: 1.35;
    }
    
    h2 {
        font-size: 1.3rem;
        margin-bottom: 8px;
        line-height: 1.45;
    }
    
    h3 {
        font-size: 0.9rem;
        margin: 15px 0 8px 0;
        line-height: 1.5;
    }
}

/* Navigation bar */
.header {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: none;
}

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

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.logo {
    color: #333;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-menu a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: #ffd700;
}

/* Dropdown menu styles */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-toggle::after {
    content: '▼';
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    color: #666;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 200px;
    max-width: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    list-style: none;
    padding: 8px 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* 桌面端hover效果 */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    /* 桌面端下拉菜单与文字右侧对齐 */
    .dropdown-menu {
        right: 0;
        left: auto;
        flex-direction: column;
        min-width: 280px;
        max-width: 350px;
        transform-origin: top right;
    }
    
    .dropdown-menu li {
        width: 100%;
        margin: 0;
    }
    
    .dropdown-menu a {
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 12px 20px;
    }
}

.dropdown-menu li {
    padding: 8px 16px;
}

.dropdown-menu a {
    color: #333;
    text-decoration: none;
    display: block;
    transition: background-color 0.3s ease;
}

.dropdown-menu a:hover {
    background-color: #f8f9fa;
}

/* Mobile navigation */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
    flex-direction: column;
    padding: 5px;
    z-index: 1001;
}

.mobile-nav-toggle span {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.mobile-nav-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Main content */
main {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
}

/* Footer */
.footer {
    background: #f8f9fa;
    padding: 40px 0;
    margin-top: 60px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-title {
    color: #333;
    margin-bottom: 20px;
}

.footer-description {
    color: #666;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.footer-link {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #333;
}

/* Responsive design */
@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        display: none;
        position: fixed;
        top: 70px;
        right: 20px;
        background: white;
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        max-height: 80vh;
        overflow-y: auto;
        min-width: 250px;
        border-radius: 8px;
        margin-top: 5px;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        width: 100%;
        margin: 0;
        text-align: left;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .nav-menu a {
        display: block;
        padding: 12px 20px;
        font-size: 1rem;
        font-weight: 500;
        color: #333;
        text-decoration: none;
        transition: all 0.3s ease;
    }
    
    .nav-menu a:hover {
        color: #ffd700;
        background: #f8f9fa;
    }
    
    /* 移动端下拉菜单样式 */
    .dropdown {
        width: 100%;
        display: block;
    }
    
    .dropdown-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 20px;
        font-size: 1rem;
        font-weight: 500;
        color: #333;
        text-decoration: none;
        border-bottom: 1px solid #f0f0f0;
        cursor: pointer;
        background: transparent;
        transition: all 0.3s ease;
    }
    
    .dropdown-toggle:hover {
        background: #f8f9fa;
        color: #ffd700;
    }
    
    .dropdown-toggle::after {
        content: '▼';
        font-size: 0.8rem;
        transition: transform 0.3s ease;
        color: #666;
        margin-left: 8px;
    }
    
    .dropdown.active .dropdown-toggle::after {
        content: '▲';
        transform: rotate(180deg);
        color: #ffd700;
    }
    
    .dropdown-menu {
        position: static;
        opacity: 0;
        visibility: hidden;
        transform: none;
        background: #f8f9fa;
        border: none;
        box-shadow: none;
        min-width: auto;
        padding: 0;
        margin: 0;
        max-height: 0;
        overflow: hidden;
        transition: all 0.3s ease;
        display: block;
        /* 确保默认状态完全隐藏 */
        pointer-events: none;
    }
    
    .dropdown.active .dropdown-menu {
        opacity: 1;
        visibility: visible;
        max-height: 400px;
        overflow: visible;
        /* 激活时恢复交互 */
        pointer-events: auto;
    }
    
    .dropdown-menu li {
        border-bottom: 1px solid #e9ecef;
    }
    
    .dropdown-menu a {
        padding: 12px 20px 12px 40px;
        font-size: 0.9rem;
        font-weight: 500;
        color: #333;
        border-bottom: none;
        background: transparent;
        margin: 0;
        border-radius: 0;
        transition: all 0.3s ease;
    }
    
    .dropdown-menu a:hover {
        background: #e9ecef;
        color: #ffd700;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 15px;
    }
}

/* Food Generator Styles - Matching Reference Design */
.food-result-card {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border: 3px solid #ffd700;
    color: white;
}

.food-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 25px;
}

.food-info {
    flex: 1;
}

.food-name-result {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 15px;
    line-height: 1.2;
    text-align: center;
}

.food-tags {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    justify-content: center;
}

.food-tag {
    background: #333;
    color: #ccc;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.food-tag::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffd700;
}

.food-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 25px;
}

.detail-section {
    background: #2a2a2a;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #444;
}

.detail-title {
    font-weight: 600;
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-title::before {
    content: '';
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
}

.detail-title.ingredients::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffd700'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E");
}

.detail-title.nutrition::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffd700'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E");
}

.ingredients-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ingredients-list li {
    padding: 8px 0;
    border-bottom: 1px solid #444;
    color: #ccc;
}

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

.nutrition-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.nutrition-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #444;
    align-items: center;
}

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

.nutrition-label {
    color: #ccc;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nutrition-label::before {
    content: '';
    width: 16px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
}

.nutrition-label.calories::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffd700'%3E%3Cpath d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E");
}

.nutrition-label.fat::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffd700'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E");
}

.nutrition-value {
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Responsive design for food generator */
@media (max-width: 768px) {
    .food-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .food-name-result {
        font-size: 1.6rem;
    }
    
    .food-details {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .food-tags {
        justify-content: center;
    }
} 

/* Food Generator Page Layout Styles */
.generator-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.generator-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    margin-top: 0;
}

.generator-description {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 40px;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.controls-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 400px;
    margin: 0 auto 30px auto;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.control-label {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
    margin-bottom: 4px;
}

.control-select {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.control-select:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.control-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 40px;
    font-size: 1.2rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    margin: 20px 0;
}

.generate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.food-result {
    margin-top: 30px;
}

/* Responsive design for food generator page */
@media (max-width: 768px) {
    .generator-section {
        padding: 20px 15px;
    }
    
    .generator-title {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .generator-description {
        font-size: 1rem;
        margin-bottom: 30px;
    }
    
    .controls-section {
        max-width: 100%;
    }
    
    .generate-btn {
        padding: 12px 30px;
        font-size: 1.1rem;
    }
}
