/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* Header Styles */
.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

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

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
}

.logo-img {
    height: 32px;
    width: auto;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c3e50;
}

.nav-desktop {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-desktop a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}

.nav-desktop a:hover {
    color: #2c3e50;
    background: #f5f5f5;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Noto Sans Thai', sans-serif;
    font-size: 0.95rem;
    color: #666;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.dropdown-toggle:hover {
    background: #f5f5f5;
    border-color: #999;
}

.dropdown-arrow {
    font-size: 0.75rem;
    transition: transform 0.3s;
}

.dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 0.5rem;
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: #666;
    text-decoration: none;
    transition: all 0.3s;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

.dropdown-menu a:hover {
    background: #f5f5f5;
    color: #2c3e50;
    padding-left: 1.25rem;
}

/* Mobile Menu Styles */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #333;
    transition: all 0.3s;
}

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

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.nav-mobile {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s;
}

.nav-mobile.active {
    transform: translateX(0);
}

.nav-mobile a {
    display: block;
    padding: 1rem 1.5rem;
    color: #666;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s;
}

.nav-mobile a:hover {
    background: #f5f5f5;
    color: #2c3e50;
    padding-left: 2rem;
}

/* Breadcrumb */
.breadcrumb {
    padding: 1rem 0;
    color: #666;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s;
}

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

/* Content Container */
.content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Typography */
h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

h2 {
    color: #2c3e50;
    font-size: 1.5rem;
}

h3 {
    color: #34495e;
    font-size: 1.2rem;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
    margin-bottom: 2rem;
    font-style: italic;
}

.section {
    margin: 2.5rem 0;
}

.section h2 {
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.section p {
    color: #555;
    line-height: 1.8;
    margin-bottom: 1rem;
}

/* Macros Grid */
.macros {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.macro-card {
    background: linear-gradient(135deg, #51BCFE 0%, #338BFF 100%);
    padding: 1.5rem 1rem;
    border-radius: 12px;
    text-align: center;
    color: white;
    transition: transform 0.3s, box-shadow 0.3s;
}

.macro-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
}

.macro-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.macro-unit {
    font-size: 0.9rem;
    opacity: 0.9;
}

.macro-label {
    font-size: 0.85rem;
    opacity: 0.95;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Nutrition Table */
.nutrition-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nutrition-table thead {
    background: linear-gradient(135deg, #51BCFE 0%, #338BFF 100%);
    color: white;
}

.nutrition-table th,
.nutrition-table td {
    padding: 1rem;
    text-align: left;
}

.nutrition-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.nutrition-table tbody tr {
    background: white;
    transition: background 0.3s;
}

.nutrition-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.nutrition-table tbody tr:hover {
    background: #e3f2fd;
}

.nutrition-table td:last-child {
    font-weight: 600;
    color: #2c3e50;
}

/* Recipe Cards */
.recipes {
    display: grid;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.recipe-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
}

.recipe-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.recipe-card h3 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

.recipe-card p {
    color: #666;
    line-height: 1.6;
}

.recipe-ingredients {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.recipe-ingredients strong {
    color: #34495e;
}

.recipe-ingredients ul {
    margin-top: 0.5rem;
    margin-left: 1.5rem;
    color: #666;
}

/* Source Box */
.source {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2.5rem 0;
}

.source strong {
    color: #856404;
}

.source p {
    margin: 0.5rem 0;
    color: #856404;
}

.source a {
    color: #0056b3;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s;
}

.source a:hover {
    color: #003d82;
    text-decoration: underline;
}

/* Hero Section (Homepage) */
.hero {
    background: linear-gradient(135deg, #51BCFE 0%, #338BFF 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: white;
}

.hero p {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    opacity: 0.95;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* Categories Grid */
.categories {
    padding: 3rem 0;
}

.categories h2 {
    text-align: center;
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 2rem;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.category-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.category-count {
    color: #666;
    font-size: 0.9rem;
}

/* Items Grid (Category Pages) */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

.item-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-decoration: none;
    color: #333;
    transition: transform 0.3s, box-shadow 0.3s;
}

.item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.item-card h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.item-card p {
    color: #666;
    font-size: 0.9rem;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer a {
    color: #3498db;
    text-decoration: none;
}

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

/* Loading State */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 992px) {
    .nav-desktop {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .nav-mobile {
        display: block;
    }
}

@media (max-width: 768px) {
    .logo-container {
        gap: 0.5rem;
    }

    .logo-img {
        height: 28px;
    }

    .logo-text {
        font-size: 1rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .stats {
        flex-direction: column;
        gap: 1.5rem;
    }

    .macros {
        grid-template-columns: repeat(2, 1fr);
    }

    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .content {
        padding: 1.5rem;
    }

    .nutrition-table {
        font-size: 0.9rem;
    }

    .nutrition-table th,
    .nutrition-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .macros {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.5rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }
}