:root {
    --primary: #4caf50;
    --primary-dark: #388e3c;
    --secondary: #ff9800;
    --bg-light: #f4fbf4;
    --white: #ffffff;
    --dark: #333333;
    --gray: #777777;
    --card-bg: rgba(255, 255, 255, 0.9);
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--dark);
    line-height: 1.6;
}

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

/* Header */
header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    padding: 40px 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.custom-logo {
    width: 60px;
    height: 60px;
    background-color: var(--white);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

header p {
    font-weight: 300;
    opacity: 0.9;
}

/* Intro */
.intro {
    padding: 40px 0;
    text-align: center;
}

.intro h2 {
    font-size: 1.8rem;
    color: var(--primary-dark);
    margin-bottom: 15px;
}

/* Gallery Grid */
.gallery {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.card {
    background-color: var(--white);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.05);
}

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

.card-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    position: relative;
    background-color: #eee;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Since these are guide pages, we want to see the whole content */
    padding: 10px;
    transition: var(--transition);
}

.card:hover .card-image img {
    transform: scale(1.05);
}

.card-info {
    padding: 25px;
    text-align: left;
}

.card-info h3 {
    color: var(--primary-dark);
    margin-bottom: 15px;
    font-size: 1.4rem;
    text-align: center;
    border-bottom: 2px solid var(--bg-light);
    padding-bottom: 10px;
}

.card-info p {
    color: var(--gray);
    font-size: 0.95rem;
    margin-bottom: 8px;
    text-align: center;
}

.info-list {
    list-style: none;
    padding: 0;
    margin-top: 10px;
}

.info-list li {
    font-size: 0.9rem;
    color: var(--dark);
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.info-list li::before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.info-list li strong {
    color: var(--primary-dark);
}

/* Navigation */
.main-nav {
    background-color: var(--white);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.main-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.main-nav li a {
    display: block;
    padding: 15px 25px;
    text-decoration: none;
    color: var(--gray);
    font-weight: 500;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.main-nav li a:hover,
.main-nav li a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background-color: rgba(76, 175, 80, 0.05);
}

/* Nutritional Table */
.nutritional-info {
    background-color: var(--white);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    margin-top: 40px;
}

.nutritional-info h2 {
    color: var(--primary-dark);
    text-align: center;
    margin-bottom: 20px;
}

.nutritional-info p {
    text-align: center;
    margin-bottom: 30px;
    color: var(--gray);
}

.table-responsive {
    overflow-x: auto;
}

.nutritional-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.nutritional-table th,
.nutritional-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.nutritional-table th {
    background-color: var(--bg-light);
    color: var(--primary-dark);
    font-weight: 600;
}

.nutritional-table tr:hover {
    background-color: #fafafa;
}

.category-header td {
    background-color: #f9f9f9;
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
    padding: 15px;
    border-left: 5px solid var(--primary);
}

.note-box {
    background-color: #fff9f0;
    border-left: 4px solid var(--secondary);
    padding: 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #665;
}

.note-box p {
    text-align: left;
    margin: 0;
}
/* Calculator */
.calculator-section {
    padding: 40px 20px;
    display: flex;
    justify-content: center;
}

.calculator-card {
    background-color: var(--white);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    max-width: 600px;
    width: 100%;
}

.calculator-card h2 {
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.calculator-card p {
    color: var(--gray);
    margin-bottom: 30px;
}

.calculator-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--dark);
}

.form-group select {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background-color: #fafafa;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group select:focus {
    border-color: var(--primary);
    outline: none;
    background-color: var(--white);
}

.btn-calculate {
    background-color: var(--primary);
    color: var(--white);
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.btn-calculate:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.result-box {
    margin-top: 40px;
    padding: 25px;
    background-color: rgba(76, 175, 80, 0.05);
    border: 2px dashed var(--primary);
    border-radius: 15px;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-box h3 {
    color: var(--primary-dark);
    margin-bottom: 20px;
    text-align: center;
}

.result-number {
    font-size: 1.2rem;
    color: var(--dark);
    margin-bottom: 15px;
    text-align: center;
}

.result-details {
    padding: 20px;
    background-color: var(--white);
    border-radius: 10px;
    margin-bottom: 15px;
}

.result-details p {
    margin-bottom: 10px;
    text-align: left;
}

.result-summary {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
}

.main-cal, .main-col {
    margin: 0 !important;
    font-size: 1.1rem;
    color: white !important;
}

.distribution-box {
    background: #fdfdfd;
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.distribution-box h4 {
    margin-bottom: 15px;
    color: var(--primary-dark);
    font-weight: 700;
}

.meal-list {
    list-style: none;
    padding: 0;
}

.meal-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
}

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

.meal-list li strong {
    color: var(--dark);
}

.meals-guide-expanded {
    display: flex;
    flex-direction: column;
    gap: 50px;
}

.meal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.meal-group h2 {
    color: var(--primary-dark);
    margin-bottom: 25px;
    text-align: center;
    border-bottom: 3px solid var(--secondary);
    padding-bottom: 15px;
    font-size: 1.8rem;
}

.meal-card {
    background-color: var(--white);
    padding: 15px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: var(--transition);
}

.meal-card:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.meal-card h4 {
    margin-bottom: 8px;
    font-size: 1.05rem;
    color: var(--primary-dark);
}

.meal-card p {
    font-size: 0.9rem;
    color: var(--gray);
    margin: 0 !important;
    text-align: left !important;
}

.water-box {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 12px;
    color: #1565c0;
    text-align: center;
    font-size: 1.1rem;
}

.water-box p {
    margin: 0 !important;
}

.menu-result-content {
    background-color: var(--white);
    padding: 20px;
    border-radius: 12px;
    margin-top: 15px;
    line-height: 1.8;
}

.menu-suggested-card p {
    margin-bottom: 15px !important;
    font-size: 1.05rem;
    color: var(--dark);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.menu-suggested-card p:last-child {
    border-bottom: none;
}

.section-divider {
    border: none;
    height: 1px;
    background-color: #eee;
    margin: 60px 0;
}

.full-catalog-title {
    color: var(--primary-dark);
    text-align: center;
    margin-bottom: 40px;
}

/* Mobile Navigation Improvements */
@media (max-width: 600px) {
    .main-nav ul {
        flex-wrap: wrap;
        gap: 0;
    }
    
    .main-nav li {
        width: 50%; /* 2x2 grid on mobile */
    }
    
    .main-nav li a {
        padding: 12px 10px;
        font-size: 0.85rem;
        text-align: center;
        border-bottom: 2px solid transparent;
        background-color: transparent !important; /* Reset highlighted bg */
    }

    .main-nav li a.active {
        border-bottom-color: var(--primary);
        font-weight: 700;
    }
}

/* Nutritional Table Transformation for Mobile */
@media screen and (max-width: 768px) {
    .nutritional-info {
        padding: 20px 15px;
    }

    .nutritional-table, 
    .nutritional-table thead, 
    .nutritional-table tbody, 
    .nutritional-table th, 
    .nutritional-table td, 
    .nutritional-table tr {
        display: block;
    }

    /* Hide table headers on mobile */
    .nutritional-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .nutritional-table tr {
        margin-bottom: 25px;
        border: 1px solid #ddd;
        border-radius: 12px;
        overflow: hidden;
        background: white;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }

    .nutritional-table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
        font-size: 0.95rem;
    }

    /* Label data for cells */
    .nutritional-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 700;
        color: var(--primary-dark);
    }

    /* Special style for category headers in mobile */
    .category-header td {
        background-color: var(--primary);
        color: white;
        text-align: center !important;
        padding-left: 15px;
        font-size: 1.1rem;
    }

    .category-header td::before {
        display: none;
    }
}

/* General Layout Optimization */
@media (max-width: 480px) {
    header {
        padding: 25px 15px;
    }
    
    .custom-logo {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }

    header h1 {
        font-size: 1.6rem;
    }
    
    .card-info {
        padding: 15px;
    }
    
    .card-info h3 {
        font-size: 1.1rem;
    }

    .calculator-card, .meal-card {
        padding: 20px;
        margin-bottom: 15px;
    }

    .meal-grid {
        grid-template-columns: 1fr;
    }
    
    .intro {
        padding: 25px 15px;
    }
    
    .lightbox-content {
        width: 100%;
        max-height: 70vh;
    }
}

/* Ensure buttons are easy to tap */
.btn-calculate {
    min-height: 50px;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    cursor: zoom-out;
}

.lightbox-content {
    margin: auto;
    display: block;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 5px;
}

#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 20px 0;
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

/* Footer */
footer {
    padding: 40px 20px;
    text-align: center;
    background-color: var(--dark);
    color: #888;
    margin-top: 40px;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    .lightbox-content {
        width: 100%;
    }
}
