/* ===== CSS Variables (Scout-inspired theme) ===== */
:root {
    --primary-color: #006341;
    --primary-light: #008756;
    --primary-dark: #004d32;
    --secondary-color: #ffd100;
    --accent-color: #e63946;
    --text-color: #2d3436;
    --text-light: #636e72;
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

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

/* ===== Header ===== */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--primary-color);
}

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

.logo-icon {
    font-size: 2rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-color);
    color: var(--white);
}

/* ===== Hero Section ===== */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 80px 0;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 15px;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 30px;
}

.hero-search {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-family: inherit;
}

.search-input:focus {
    outline: 3px solid var(--secondary-color);
}

/* ===== Buttons ===== */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: var(--secondary-color);
    color: var(--text-color);
}

.btn-primary:hover {
    background: #e6bc00;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

/* ===== Categories ===== */
.categories {
    padding: 40px 0 20px;
}

.category-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.category-btn {
    padding: 10px 24px;
    border: 2px solid var(--primary-color);
    background: var(--white);
    color: var(--primary-color);
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.category-btn:hover,
.category-btn.active {
    background: var(--primary-color);
    color: var(--white);
}

/* ===== Section Titles ===== */
.section-title {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 40px;
    color: var(--primary-color);
}

/* ===== Recipes Grid ===== */
.recipes-section {
    padding: 60px 0;
}

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

/* ===== Recipe Card ===== */
.recipe-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

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

.recipe-image {
    height: 200px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.recipe-photo-card {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.recipe-info {
    padding: 20px;
}

.recipe-category {
    display: inline-block;
    background: var(--secondary-color);
    color: var(--text-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.recipe-info h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

.recipe-info p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 15px;
}

.recipe-meta {
    display: flex;
    gap: 20px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.recipe-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ===== Recipe Detail Page ===== */
.recipe-detail {
    padding: 40px 0 80px;
}

.back-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 30px;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--primary-dark);
}

.recipe-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.recipe-image-large {
    height: 400px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8rem;
}

.recipe-photo-large {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: var(--border-radius);
}

.recipe-title-section h1 {
    font-size: 2.5rem;
    color: var(--text-color);
    margin-bottom: 15px;
}

.recipe-description {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.recipe-details {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
}

.detail-item span:first-child {
    font-size: 1.5rem;
}

/* ===== Servings Calculator ===== */
.servings-calculator {
    background: var(--primary-color);
    color: var(--white);
    padding: 25px;
    border-radius: var(--border-radius);
}

.servings-calculator h3 {
    margin-bottom: 15px;
}

.servings-input {
    display: flex;
    align-items: center;
    gap: 15px;
}

.servings-input input {
    width: 80px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    text-align: center;
    font-family: inherit;
}

.servings-input button {
    padding: 10px 20px;
    background: var(--secondary-color);
    color: var(--text-color);
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.servings-input button:hover {
    background: #e6bc00;
}

/* ===== Ingredients & Instructions ===== */
.recipe-body {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
}

.ingredients-section,
.instructions-section {
    background: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.ingredients-section h2,
.instructions-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

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

.ingredients-list li {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

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

.ingredient-amount {
    font-weight: 700;
    color: var(--primary-color);
}

.instructions-section ol {
    padding-left: 20px;
}

.instructions-section li {
    padding: 15px 0;
    padding-left: 10px;
}

.instructions-section li::marker {
    color: var(--primary-color);
    font-weight: 700;
}

/* ===== About Section ===== */
.about {
    background: var(--white);
    padding: 80px 0;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.about-text h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.about-text p {
    color: var(--text-light);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.about-features {
    display: grid;
    gap: 25px;
}

.feature {
    background: var(--bg-color);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
}

.feature:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.feature-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
}

.feature h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

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

/* ===== Footer ===== */
.footer {
    background: var(--primary-dark);
    color: var(--white);
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-info h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.footer-info p {
    opacity: 0.8;
}

.footer-links h4 {
    margin-bottom: 15px;
}

.footer-links a {
    display: block;
    color: var(--white);
    opacity: 0.8;
    text-decoration: none;
    padding: 5px 0;
    transition: var(--transition);
}

.footer-links a:hover {
    opacity: 1;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.7;
}

/* ===== Loading State ===== */
.loading {
    text-align: center;
    padding: 60px;
    color: var(--text-light);
    font-size: 1.2rem;
}

/* ===== Menu Planning Styles ===== */
.hero-small {
    padding: 50px 0;
}

.hero-small h1 {
    font-size: 2.5rem;
}

/* Create Menu Section */
.create-menu-section {
    padding: 40px 0;
}

.create-menu-card {
    background: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.create-menu-card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

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

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
}

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

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

.form-group input {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

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

.form-group select {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--white);
    transition: var(--transition);
}

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

/* Menus Grid */
.menus-section {
    padding: 40px 0 80px;
}

.menus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.menu-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.menu-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.menu-card-icon {
    font-size: 2.5rem;
}

.menu-card-info {
    flex: 1;
}

.menu-card-info h3 {
    color: var(--text-color);
    margin-bottom: 8px;
}

.menu-card-meta {
    display: flex;
    gap: 15px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.menu-card-date {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 8px;
}

.delete-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    opacity: 0.5;
    transition: var(--transition);
}

.delete-btn:hover {
    opacity: 1;
}

/* Menu Detail Page */
.menu-detail-page {
    padding: 40px 0 80px;
}

.back-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 20px;
}

.back-link:hover {
    text-decoration: underline;
}

.menu-header {
    margin-bottom: 30px;
}

.menu-title-section h1 {
    color: var(--text-color);
    margin-bottom: 10px;
}

.menu-meta {
    display: flex;
    gap: 20px;
    color: var(--text-light);
}

/* New Table-based Menu Layout */
.menu-table-wrapper {
    overflow-x: auto;
    margin-bottom: 30px;
}

.menu-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.menu-table thead {
    background: var(--primary-color);
}

.menu-table th {
    color: var(--white);
    font-weight: 700;
    padding: 18px 15px;
    text-align: center;
    font-size: 1rem;
}

.menu-table th.day-column {
    width: 100px;
    background: var(--primary-dark);
}

.menu-table th.meal-column {
    min-width: 180px;
}

.menu-row {
    border-bottom: 2px solid #e8e8e8;
}

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

.day-cell {
    background: var(--primary-color);
    text-align: center;
    vertical-align: middle;
}

.day-number {
    color: var(--white);
    font-weight: 700;
    font-size: 1.1rem;
}

.meal-cell {
    padding: 12px;
    vertical-align: top;
    cursor: pointer;
    transition: var(--transition);
    border-right: 1px solid #e8e8e8;
}

.meal-cell:last-child {
    border-right: none;
}

/* EMPTY SLOT - Dashed border, light gray */
.meal-cell.empty {
    background: #f8f8f8;
}

.meal-cell.empty:hover {
    background: #f0f0f0;
}

.empty-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    color: #999;
}

.empty-slot .plus-icon {
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
}

.empty-slot .add-text {
    font-size: 0.85rem;
    margin-top: 5px;
}

/* FILLED SLOT - Strong green background with recipe card */
.meal-cell.has-recipe {
    background: #e8f5e9;
}

.meal-cell.has-recipe:hover {
    background: #c8e6c9;
}

.recipe-card {
    background: var(--white);
    border: 3px solid var(--primary-color);
    border-radius: 8px;
    padding: 12px;
    min-height: 80px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 99, 65, 0.15);
}

.recipe-card-name {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 5px;
    padding-right: 60px;
}

.recipe-card-time {
    color: var(--text-light);
    font-size: 0.85rem;
}

.remove-recipe-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ffebee;
    border: 1px solid #ef5350;
    color: #c62828;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.remove-recipe-btn:hover {
    background: #ef5350;
    color: white;
}

/* Legend */
.menu-legend {
    display: flex;
    gap: 30px;
    justify-content: center;
    padding: 20px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.legend-box {
    width: 30px;
    height: 30px;
    border-radius: 4px;
}

.legend-box.empty {
    background: #f8f8f8;
    border: 2px dashed #ccc;
}

.legend-box.filled {
    background: var(--white);
    border: 3px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 99, 65, 0.15);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.modal-search {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-search input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.modal-recipe {
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.modal-recipe:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.modal-recipe h4 {
    color: var(--text-color);
    margin-bottom: 5px;
}

.modal-recipe p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.modal-recipe-meta {
    display: flex;
    gap: 15px;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Shopping List */
.shopping-list-section {
    margin-top: 40px;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.shopping-list-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.servings-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.servings-selector input {
    width: 80px;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
}

.shopping-list-info {
    color: var(--text-light);
    margin-bottom: 15px;
}

.shopping-items {
    list-style: none;
    padding: 0;
}

.shopping-items li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.shopping-items li:last-child {
    border-bottom: none;
}

.editor-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    resize: vertical;
}

.editor-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.editor-ingredients-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.editor-ingredients-header h3 {
    color: var(--primary-color);
}

.editor-ingredients-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.editor-ingredient-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
    align-items: center;
}

.editor-ingredient-row input {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

.editor-ingredient-row input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.editor-ingredient-row select {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--white);
}

.editor-ingredient-row select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.remove-ingredient-btn {
    border-radius: 12px;
    padding: 10px 14px;
}

.editor-actions {
    margin-top: 10px;
}

.editor-message {
    min-height: 24px;
    font-weight: 700;
}

.editor-message.success {
    color: var(--primary-color);
}

.editor-message.error {
    color: var(--accent-color);
}

.editor-help {
    color: var(--text-light);
    font-size: 0.9rem;
}

.ingredient-name {
    color: var(--text-color);
}

.ingredient-amount {
    font-weight: 600;
    color: var(--primary-color);
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .menu-table th.meal-column {
        min-width: 140px;
    }
    
    .recipe-card-name {
        font-size: 0.9rem;
        padding-right: 50px;
    }
    
    .remove-recipe-btn {
        padding: 3px 8px;
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav {
        gap: 15px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-search {
        flex-direction: column;
    }
    
    .recipes-grid {
        grid-template-columns: 1fr;
    }
    
    .recipe-header {
        grid-template-columns: 1fr;
    }
    
    .recipe-body {
        grid-template-columns: 1fr;
    }
    
    .about-content {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .menus-grid {
        grid-template-columns: 1fr;
    }
    
    /* Mobile menu table - scroll horizontally */
    .menu-table-wrapper {
        margin: 0 -15px;
        padding: 0 15px;
    }
    
    .menu-table th {
        padding: 12px 10px;
        font-size: 0.85rem;
    }
    
    .menu-table th.meal-column {
        min-width: 120px;
    }
    
    .meal-cell {
        padding: 8px;
    }
    
    .recipe-card {
        padding: 8px;
        min-height: 70px;
    }
    
    .recipe-card-name {
        font-size: 0.8rem;
        padding-right: 40px;
    }
    
    .empty-slot {
        min-height: 70px;
    }
    
    .empty-slot .plus-icon {
        font-size: 1.5rem;
    }
    
    .menu-legend {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .servings-selector {
        flex-wrap: wrap;
    }

    .editor-ingredient-row {
        grid-template-columns: 1fr;
    }
}
