/* --- Global Styles & Variables --- */
:root {
    --primary-font: 'Source Serif 4', serif;
    --secondary-font: 'Work Sans', sans-serif;
    --text-color: #333;
    --primary-color: #af4d43; /* Dark red from logo */
    --accent-color: #e58c3d;  /* Orange from logo */
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --container-width: 1100px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--secondary-font);
    line-height: 1.7;
    color: var(--text-color);
    background-color: #fff;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--primary-font);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Header & Navigation --- */
.main-header {
    background-color: var(--light-gray);
    padding: 1.5rem 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
    text-align: center;
}

.header-logo a {
    display: inline-block;
}

.header-logo img {
    max-width: 280px;
    height: auto;
}

.main-nav {
    margin-top: 1rem;
}

.main-nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
}

.main-nav a {
    color: var(--text-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.main-nav a:hover {
    color: var(--primary-color);
}

/* Styles for Dropdown Menu */
.dropdown {
    position: relative;
}
.dropdown-toggle {
    cursor: pointer;
}
.dropdown-toggle::after {
    content: ' ▼';
    font-size: 0.7em;
    display: inline-block;
    vertical-align: middle;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 5px;
    padding: 0.5rem 0;
    margin-top: 1rem;
    min-width: 200px;
    z-index: 100;
    border: 1px solid var(--border-color);
}
.dropdown-menu ul {
    flex-direction: column;
    gap: 0;
}
.dropdown-menu li {
    width: 100%;
}
.dropdown-menu a {
    padding: 0.75rem 1.5rem;
    display: block;
    white-space: nowrap;
    text-align: left;
    text-transform: none;
    font-weight: 400;
    letter-spacing: 0;
}
.dropdown.dropdown-show .dropdown-menu {
    display: block;
}


/* --- Footer --- */
.main-footer {
    margin-top: 3rem;
    background-color: #f4f4f4; /* Reverted light-gray */
    color: #555;
    font-size: 0.9rem;
    padding: 2rem 0;
    text-align: center;
}


/* --- Homepage/Category Recipe Grid --- */
.recipe-grid h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
}
.recipe-grid .grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.recipe-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}
.recipe-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}
.recipe-card .card-content {
    padding: 1rem;
}
.recipe-card h3 {
    margin-bottom: 0.5rem;
}

/* --- Single Recipe Page --- */
.recipe-page article {
    padding-bottom: 2rem;
}
.recipe-header {
    text-align: center;
    margin-bottom: 2rem;
}
.recipe-header h1 {
    font-size: 3rem;
}
.recipe-header .description {
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto 1.5rem auto;
}
.info-box {
    display: inline-flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    background-color: #f4f4f4; /* Reverted light-gray */
    padding: 1rem;
    border-radius: 8px;
}

.recipe-main-media {
    margin-bottom: 2rem;
    border-radius: 8px;
    overflow: hidden;
}
.recipe-main-media img {
    width: 100%;
}
.recipe-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}
.recipe-sidebar section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #fafafa;
    border-radius: 8px;
}
.recipe-sidebar h2 {
    font-size: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}
.recipe-sidebar h2 span {
    font-size: 0.8rem;
    font-weight: 400;
    color: #666;
}
.ingredients-list, .equipment-list, .nutrition-list {
    list-style: none;
    padding: 0;
}
.ingredients-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}
.equipment-list li, .nutrition-list li {
    padding: 0.3rem 0;
}

.recipe-content h2 {
    font-size: 2rem;
}
.method-list {
    list-style: none;
    counter-reset: method-counter;
    padding-left: 0;
}
.method-list li {
    counter-increment: method-counter;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
}
.method-list li::before {
    content: counter(method-counter);
    font-family: var(--primary-font);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 1.5rem;
    line-height: 1;
    float: left;
}
.method-list p {
    overflow: hidden; /* Clear the float */
}
.method-list img {
    margin-top: 1rem;
    border-radius: 8px;
}
.content-block {
    margin-top: 3rem;
}

/* --- Video Lazy Load --- */
.video-container {
    position: relative;
    cursor: pointer;
    height: 0;
    padding-top: 56.25%; /* This creates a 16:9 aspect ratio */
    overflow: hidden;
}
.video-container .play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M8 5v14l11-7z"/></svg>') no-repeat center center;
    background-color: rgba(0,0,0,0.6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 10;
}
.video-container:hover .play-button {
    background-color: rgba(175, 77, 67, 0.9);
}
.video-container iframe,
.video-container picture { /* Also target the initial picture element */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}


/* --- Admin Panel --- */
.admin-header { background-color: var(--text-color); color: #fff; }
.admin-header nav { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-top: 1rem; }
.admin-content { padding: 2rem 0; }
.admin-content h2 { border-bottom: 1px solid var(--border-color); padding-bottom: 1rem;}

form fieldset {
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 5px;
}
form legend {
    font-family: var(--primary-font);
    font-weight: 700;
    font-size: 1.2rem;
    padding: 0 0.5rem;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
input[type="text"], input[type="number"], input[type="url"], textarea, select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--secondary-font);
    font-size: 1rem;
}
textarea {
    resize: vertical;
}
.form-hint {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}
.grid-2, .grid-3 {
    display: grid;
    gap: 1.5rem;
}
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.dynamic-row, .content-block-row {
    position: relative;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px dashed var(--border-color);
    border-radius: 4px;
}
.content-block-row { display: grid; gap: 1rem; grid-template-columns: 150px 1fr; }
.content-block-row textarea { grid-column: 1 / -1; }

.btn, button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--secondary-font);
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
}
.btn-primary { background-color: var(--primary-color); color: #fff; }
.btn-primary:hover { background-color: #8c3e35; }
.btn-secondary { background-color: #6c757d; color: #fff; }
.btn-secondary:hover { background-color: #5a6268; }
.btn-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: #e0e0e0;
    color: var(--text-color);
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
}
.btn-remove:hover {
    background-color: #d0d0d0;
}


#loading-indicator {
    margin-top: 1rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Author Box Styling */
.author-box {
  display: flex; /* Aligns image and text side-by-side */
  align-items: center; /* Vertically centers the content */
  gap: 20px; /* Space between the image and the text */
  margin-top: 3rem; /* Space above the author box */
  padding: 20px;
  background-color: #f9f9f9;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

.author-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%; /* Makes the image circular */
  object-fit: cover; /* Ensures the image covers the area without distortion */
}

.author-info {
  flex: 1; /* Allows the text content to take up the remaining space */
}

.author-name {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  font-weight: bold;
}

.author-bio {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.5;
  color: #555;
}

/* --- Media Queries (Mobile First) --- */

/* Tablet */
@media (min-width: 768px) {
    .recipe-grid .grid {
        grid-template-columns: 1fr 1fr;
    }
    .recipe-body {
        grid-template-columns: 300px 1fr;
    }
    .recipe-sidebar {
        grid-row: 1; /* Puts sidebar on the left */
    }
    .recipe-content {
        grid-column: 2;
    }
}

/* Desktop */
@media (min-width: 1024px) {
     .recipe-grid .grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}