/* Recipes by CM - Frontend Styles */

.recipe-container {
    max-width: 1000px;
    margin: 20px 0;
    padding: 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

/* RTL Support */
.recipe-container.rtl {
    direction: rtl;
    text-align: right;
}

.recipe-container.rtl .recipe-layout {
    flex-direction: row-reverse;
}

.recipe-container.rtl .recipe-meta li {
    border-left: none;
    border-right: 2px solid #aaa;
}

.recipe-container.rtl .ingredients-list li {
    padding-left: 0;
    padding-right: 25px;
}

.recipe-container.rtl .ingredients-list li:before {
    left: auto;
    right: 0;
}

.recipe-container.rtl .instructions-list li {
    padding-left: 0;
    padding-right: 50px;
}

.recipe-container.rtl .instructions-list li:before {
    left: auto;
    right: 0;
}



.recipe-container.rtl .categories-list {
    justify-content: flex-end;
}

/* Recipe Post Content (Full Width) */
.recipe-post-content {
    padding: 30px 0;
}

.recipe-title {
    font-size: 2.5em;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 20px 0;
    line-height: 1.2;
}

.recipe-description {
    font-size: 1.1em;
    line-height: 1.6;
    color: #555;
    max-width: 800px;
    margin: 0 auto;
}

.recipe-layout {
    display: flex;
    min-height: 400px;
    gap: 20px;
}

.recipe-featured-image {
    flex: 0 0 35%;
    max-width: 35%;
    position: relative;
}

.recipe-main-image {
    width: 100%;
    display: block;
}

.recipe-content-wrapper {
    flex: 1;
    padding: 0 20px 20px 20px;
    overflow-y: auto;
}

.recipe-content-wrapper > .recipe-details,
.recipe-content-wrapper > .recipe-ingredients,
.recipe-content-wrapper > .recipe-instructions,
.recipe-content-wrapper > .recipe-nutrition {
    margin-bottom: 30px;
}

.recipe-content-wrapper > .recipe-details:first-of-type {
    margin-top: 0;
}

.recipe-container h3 {
    color: #2c3e50;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
    margin-bottom: 15px;
    font-size: 1.4em;
    font-weight: 600;
}

/* Recipe Details */
.recipe-details {
    margin-top: 30px;
}

.recipe-meta {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.recipe-meta li {
    background: #f6f8fb;
    padding: 12px 15px;
    border-radius: 0;
    border-left: 2px solid #aaa;
    margin-left: 0px !important;
    font-size: 12px;
}

.recipe-meta strong {
    color: #2c3e50;
    font-weight: 600;
    display: block;
}

/* Ingredients */
.recipe-ingredients {
    margin-bottom: 30px;
}

.ingredients-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ingredients-list li {
    padding: 8px 0;
    border-bottom: 1px solid #ecf0f1;
    position: relative;
    padding-left: 25px;
}

.ingredients-list li:before {
    content: "●";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 8px;
}

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

/* Instructions */
.recipe-instructions {
    margin-bottom: 30px;
}

.instructions-list {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
    margin: 0;
}

.instructions-list li {
    counter-increment: step-counter;
    padding: 15px 0;
    border-bottom: 1px solid #ecf0f1;
    position: relative;
    padding-left: 50px;
    line-height: 1.6;
}

.instructions-list li:before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 15px;
    background: var(--primary-color);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

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

/* Nutrition Information */
.recipe-nutrition {
    margin-bottom: 30px;
}

.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.nutrition-item {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.nutrition-label {
    font-weight: 400;
    color: #2c3e50;
}

.nutrition-value {
    color: #000;
    font-weight: 400;
}

.nutrition-disclaimer {
    font-size: 0.9em;
    color: #7f8c8d;
    font-style: italic;
    margin: 0;
    padding: 10px 15px;
    background: #ecf0f1;
    border-radius: 6px;
}

/* Categories */
.recipe-categories {
    margin-bottom: 30px;
}

.categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.categories-list li {
    background: #e74c3c;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9em;
}

.categories-list li a {
    color: white;
    text-decoration: none;
}

.categories-list li a:hover {
    text-decoration: underline;
}





/* Recipes Grid Styles */
.recipes-grid-container {
    margin: 20px 0;
}

.recipes-filter {
    margin-bottom: 30px;
}

.filter-buttons-desktop {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: left;
}

.filter-dropdown-mobile {
    display: none;
}


.filter-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: #495057;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.filter-btn {
    background: #eee;
    color: #495057;
    padding: 0 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
}

.filter-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #343a40;
}

.filter-btn.active {
    background: var(--primary-color);
    color: #fff;
}

.recipes-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.recipes-grid.columns-1 {
    grid-template-columns: 1fr;
}

.recipes-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.recipes-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.recipes-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.recipe-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eee;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}



.recipe-image {
    position: relative;
    overflow: hidden;
}

.recipe-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.recipe-content {
    padding: 20px;
}

.recipe-card .recipe-title {
    font-size: 1.2em;
}

.recipe-title {
    margin: 0 0 15px 0;
    font-size: 2em;
    font-weight: 600;
}

.recipe-title a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.recipe-title a:hover {
    color: var(--primary-color);
}

.recipe-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.meta-item {
    background: #f6f8fb;
    color: #6c757d;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
}

.meta-item.serving-size {
    background: #e8f5e8;
    color: #28a745;
}

.meta-item.time {
    background: #fff3cd;
    color: #856404;
}

.meta-item.difficulty {
    background: #d1ecf1;
    color: #0c5460;
}

.recipe-excerpt {
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 15px;
}

.recipe-categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.category-tag {
    color: #000;
    font-size: 0.8em;
    font-weight: 500;
}

/* Newsletter Styles */
.recipe-newsletter {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
    border: 2px solid #e9ecef;
}

.recipe-newsletter.rtl {
    direction: rtl;
    text-align: right;
}

.newsletter-header {
    text-align: center;
    margin-bottom: 25px;
}

.newsletter-header h3 {
    color: #2c3e50;
    font-size: 1.6em;
    font-weight: 600;
    margin: 0 0 10px 0;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 8px;
    display: inline-block;
}

.newsletter-header p {
    color: #6c757d;
    font-size: 1.1em;
    margin: 0;
    line-height: 1.5;
}

.newsletter-form {
    max-width: 500px;
    margin: 0 auto;
}

/* Gravity Forms specific styling */
.newsletter-form .gform_wrapper {
    margin: 0 !important;
    padding: 0 !important;
}

/* =================================== */
/* CONSOLIDATED RESPONSIVE MEDIA QUERIES */
/* =================================== */

/* Large screens - reduce 4-column grids to 3 columns */
@media (max-width: 1024px) {
    .recipes-grid.columns-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet and smaller screens - primary mobile layout */
@media (max-width: 768px) {
    /* Recipe layout adjustments */
    .recipe-container {
        margin: 10px;
    }
    
    .recipe-post-content {
        padding: 20px;
    }
    
    .recipe-title {
        font-size: 2em;
    }
    
    .recipe-description {
        font-size: 1em;
    }
    
    .recipe-layout {
        flex-direction: column;
        min-height: auto;
    }
    
    .recipe-container.rtl .recipe-layout {
        flex-direction: column;
    }
    
    .recipe-featured-image {
        max-width: 100%;
    }
    
    .recipe-content-wrapper {
        padding: 15px;
    }
    
    .recipe-meta {
        grid-template-columns: 1fr;
    }
    
    .nutrition-grid {
        grid-template-columns: 1fr;
    }
    
    .instructions-list li {
        padding-left: 45px;
    }
    
    .recipe-container.rtl .instructions-list li {
        padding-left: 0;
        padding-right: 45px;
    }
    
    .instructions-list li:before {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    /* Filter system - switch to mobile dropdown */
    .filter-buttons-desktop {
        display: none !important;
    }
    
    .filter-dropdown-mobile {
        display: block !important;
        width: 100%;
        margin-bottom: 20px;
    }
    
    .filter-select {
        margin-bottom: 20px;
        width: 100%;
        max-width: 100%;
        font-size: 14px;
        padding: 0px 15px;
        border-width: 1px;
    }
    
    /* Grid layout adjustments */
    .recipes-grid.columns-3,
    .recipes-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .recipe-content {
        padding: 15px;
    }
    
    .recipe-image img {
        height: 220px;
    }
    
    /* Newsletter responsive */
    .recipe-newsletter {
        padding: 20px;
        margin: 20px 0;
    }
    
    .newsletter-header h3 {
        font-size: 1.4em;
    }
    
    .newsletter-header p {
        font-size: 1em;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    /* Recipe layout refinements */
    .recipe-container {
        margin: 5px;
    }
    
    .recipe-post-content {
        padding: 15px;
    }
    
    .recipe-title {
        font-size: 1.8em;
    }
    
    .recipe-description {
        font-size: 0.95em;
    }
    
    .recipe-content-wrapper {
        padding: 10px;
    }
    
    .recipe-container h3 {
        font-size: 1.2em;
    }
    
    /* Categories layout */
    .categories-list {
        flex-direction: column;
    }
    
    .categories-list li {
        text-align: center;
    }
    
    .recipe-container.rtl .categories-list {
        justify-content: center;
    }
    
    /* Filter system - ensure mobile dropdown visibility */
    .filter-buttons-desktop {
        display: none !important;
    }
    
    .filter-dropdown-mobile {
        display: block !important;
    }
    
    .filter-select {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 0 15px;
        border-width: 1px;
    }
    
    /* Grid layout - single column */
    .recipes-grid.columns-2,
    .recipes-grid.columns-3,
    .recipes-grid.columns-4 {
        grid-template-columns: 1fr;
    }
    
    .recipe-meta-grid {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Newsletter responsive */
    .recipe-newsletter {
        padding: 15px;
        margin: 15px 0;
    }
    
    .newsletter-header h3 {
        font-size: 1.2em;
    }
    
    .newsletter-header p {
        font-size: 0.9em;
    }
    
    .newsletter-form {
        max-width: 100%;
    }
}

/* Medium mobile screens - additional safety breakpoint */
@media (max-width: 600px) {
    /* Ensure mobile dropdown is visible */
    .filter-buttons-desktop {
        display: none !important;
    }
    
    .filter-dropdown-mobile {
        display: block !important;
    }
    
    /* Single column grids */
    .recipes-grid.columns-2,
    .recipes-grid.columns-3,
    .recipes-grid.columns-4 {
        grid-template-columns: 1fr;
    }
}

/* Print styles */
@media print {
    .recipe-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .recipe-container h3 {
        color: #000;
        border-bottom-color: #000;
    }
    
    .recipe-meta li,
    .nutrition-item {
        background: #f5f5f5;
        border: 1px solid #ddd;
    }
    
    .instructions-list li:before {
        background: #000;
    }
    
    .categories-list li {
        background: #000;
    }
    
    .recipes-grid {
        display: block;
    }
    
    .recipe-card {
        break-inside: avoid;
        margin-bottom: 20px;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
