/* General Body & Typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: #fdfaf7; /* A warm, off-white background */
    color: #444;
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: #e67e22; /* A warm orange for links */
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Header and Footer */
.site-header {
    background-color: #ffffff;
    border-bottom: 1px solid #eee;
    padding: 20px 0;
    text-align: center;
    margin-bottom: 30px;
}
.site-header h1 a {
    color: #333;
    text-decoration: none;
}
.site-header h1 {
    margin: 0;
    font-size: 2.5em;
    color: #333;
}
.site-header p {
    margin: 5px 0 0;
    color: #777;
}

.site-footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    background-color: #ffffff;
    border-top: 1px solid #eee;
    color: #777;
    font-size: 0.9em;
}

/* Recipe Grid (index.php) */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.recipe-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: #444;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.card-image {
    height: 200px;
    background-size: cover;
    background-position: center;
}

.card-content {
    padding: 20px;
}

.card-content h3 {
    margin: 0 0 10px;
    font-size: 1.4em;
    color: #333;
}

.card-content p {
    margin: 0;
    color: #666;
    font-size: 0.95em;
}

/* Single Recipe Details (recipe.php) */
.recipe-details {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.recipe-title {
    margin: 0 0 5px;
    font-size: 2.8em;
}

.recipe-author {
    margin: 0 0 20px;
    font-style: italic;
    color: #777;
}

.recipe-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 20px;
}

.recipe-description {
    font-size: 1.1em;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.recipe-categories {
    margin-bottom: 20px;
}

.category-tag {
    display: inline-block;
    background-color: #e67e22;
    color: #fff;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    margin-right: 8px;
    margin-bottom: 8px;
}

.recipe-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-top: 30px;
}

@media (min-width: 768px) {
    .recipe-columns {
        grid-template-columns: 1fr 2fr;
    }
}

.recipe-ingredients p,
.recipe-instructions p {
    white-space: pre-wrap; /* Preserves line breaks from the database */
}

.sub-recipes {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.sub-recipes ul {
    list-style-type: none;
    padding: 0;
}

.sub-recipes li {
    margin-bottom: 10px;
}

/* Add Recipe Form (add_recipe.php) */
.add-recipe-form {
    background-color: #fff;
    padding: 30px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="url"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #e67e22;
}


.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.form-group .category-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.form-group .category-checkboxes label {
    font-weight: normal;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.form-group .category-checkboxes input {
    margin-right: 8px;
}

.submit-btn {
    display: inline-block;
    background-color: #e67e22;
    color: #fff;
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.2s;
}

.submit-btn:hover {
    background-color: #d35400;
}

/* Form Messages */
.success-message {
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #c8e6c9;
}
.error-message {
    background-color: #ffcdd2;
    color: #c62828;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #ef9a9a;
}

/* --- ADMIN PANEL STYLES --- */
.admin-sections {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

@media (min-width: 992px) {
    .admin-sections {
        grid-template-columns: 2fr 1fr;
    }
}

.admin-section {
    background-color: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.admin-section h2 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.admin-table th, .admin-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.admin-table th {
    font-weight: bold;
    color: #555;
}

.admin-table td:last-child {
    text-align: right;
    white-space: nowrap;
}

.btn-edit, .btn-delete, .cancel-btn {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    margin-left: 5px;
}

.btn-edit {
    background-color: #3498db;
    color: #fff;
}
.btn-edit:hover {
    background-color: #2980b9;
}

.btn-delete {
    background-color: #e74c3c;
    color: #fff;
}
.btn-delete:hover {
    background-color: #c0392b;
}

.cancel-btn {
    background-color: #7f8c8d;
    color: #fff;
}
.cancel-btn:hover {
    background-color: #6c7a7b;
}

.category-form {
    margin-top: 20px;
}

