:root {
    --sage-green: #7a9460;
    --deep-sage: #4a5d3f;
    --soft-blue: #5d8aa8;
    --navy-blue: #1b263b;
    --cream-bg: #fdfaf5;
    --warm-white: #ffffff;
    --paper-border: #d1d9ad;
    --text-color: #2c3e50;
    --accent-color: #e67e22; /* A warm orange for accents */
}

body {
    background-color: var(--cream-bg);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-image: radial-gradient(var(--paper-border) 0.5px, transparent 0.5px);
    background-size: 24px 24px;
}

.container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}

h1, h2, h3 {
    color: var(--deep-sage);
    font-family: 'Georgia', serif;
}

/* Back link styling */
.back-link {
    color: var(--soft-blue);
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 1.5rem;
    font-weight: 600;
    transition: transform 0.2s ease;
}

.back-link:hover {
    transform: translateX(-4px);
    color: var(--deep-sage);
}

/* Homey Card Style */
.recipe-card, .section, .filters, .modal, .container-white {
    background: var(--warm-white);
    border: 2px solid var(--paper-border);
    border-radius: 15px;
    box-shadow: 6px 6px 0px var(--paper-border);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.2s ease;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.btn-primary { background-color: var(--soft-blue); color: white; }
.btn-primary:hover { background-color: #4a6d8a; transform: translateY(-2px); }

.btn-success { background-color: var(--sage-green); color: white; }
.btn-success:hover { background-color: var(--deep-sage); transform: translateY(-2px); }

.btn-secondary { background-color: #95a5a6; color: white; }
.btn-secondary:hover { background-color: #7f8c8d; }

.btn-danger { background-color: #e74c3c; color: white; }
.btn-danger:hover { background-color: #c0392b; }

/* Form Elements */
input[type="text"], 
input[type="number"], 
textarea, 
select {
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    padding: 12px;
    width: 100%;
    margin-top: 5px;
    font-family: inherit;
    transition: border-color 0.3s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--sage-green);
}

label {
    font-weight: bold;
    color: var(--deep-sage);
    display: block;
    margin-top: 1rem;
}

/* Photo specific styles */
.recipe-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--paper-border);
    margin-right: 15px;
}

.recipe-photo-main {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 12px;
    border: 3px solid var(--paper-border);
    margin: 1rem 0;
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 1.5rem;
}

.gallery-photo {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid var(--paper-border);
    transition: transform 0.2s;
}

.gallery-photo:hover {
    transform: scale(1.05);
}

.btn-photo {
    background-color: var(--sage-green);
    color: white;
    font-size: 0.8rem;
    padding: 6px 12px;
    margin-left: 5px;
}

.btn-photo:hover {
    background-color: var(--deep-sage);
}

/* Modal specific styles */
#modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000; /* Increased z-index */
    overflow-y: auto;
    padding: 1rem; /* Reduced padding for mobile */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px); /* Safari support */
}

#modal-content {
    background: var(--cream-bg);
    max-width: 500px;
    margin: 2rem auto;
    padding: 1.5rem; /* Slightly reduced padding */
    border-radius: 15px;
    position: relative;
    border: 3px solid var(--paper-border);
    box-shadow: 10px 10px 0px var(--navy-blue);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--deep-sage);
}

/* Specific to Lists */
.recipe-card.collapsible {
    padding: 0;
    overflow: hidden;
}

.recipe-card.collapsible .recipe-header {
    padding: 1.2rem 2rem;
    margin-bottom: 0;
    border-bottom: none;
    cursor: pointer;
    transition: background 0.3s;
}

.recipe-card.collapsible .recipe-header:hover {
    background: #fcfdf9;
}

.recipe-card.collapsible .recipe-header.active {
    border-bottom: 2px dashed var(--paper-border);
    background: #fcfdf9;
}

.recipe-card.collapsible .recipe-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.recipe-card.collapsible .recipe-header h2::after {
    content: '▾';
    font-size: 1.2rem;
    transition: transform 0.3s;
    color: var(--soft-blue);
}

.recipe-card.collapsible .recipe-header.active h2::after {
    transform: rotate(180deg);
}

.recipe-content {
    display: none;
    padding: 2rem;
    animation: slideDown 0.3s ease-out;
}

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

.recipe-content.show {
    display: block;
}

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed var(--paper-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.meta {
    font-style: italic;
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.tag-badge {
    background: var(--paper-border);
    color: var(--deep-sage);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Tables for Ingredients */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
}

th {
    background-color: var(--cream-bg);
    color: var(--deep-sage);
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid var(--paper-border);
}

td {
    padding: 12px;
    border-bottom: 1px solid #f1f1f1;
}

tr:last-child td {
    border-bottom: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .recipe-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .container {
        padding: 0.5rem;
        margin: 1rem auto;
    }
    
    .recipe-card {
        padding: 1.5rem;
    }
}
