/**
 * NDS Recipes Shortcode Styles
 * Automatically adapts to different themes and Elementor
 */

/* Base container styles */
.nds-recipes-container {
    margin: 2rem 0;
    font-family: inherit;
    line-height: 1.6;
}

/* Grid layout - fixed card width, wraps like the 4 white blocks */
.nds-recipes-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem; /* ~20px */
    margin: 0;
    padding: 0;
    list-style: none;
    justify-content: center;
}

/* Recipe card base styles */
.nds-recipe-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
    width: 250px; /* fixed card width */
}

.nds-recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Recipe image */
.nds-recipe-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
    display: block;
}

.nds-recipe-card .nds-recipe-image img {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    object-position: center center !important;
    transition: transform 0.3s ease;
    display: block;
}

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

/* Recipe content */
.nds-recipe-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.nds-recipe-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
}

.nds-recipe-title a {
    color: inherit;
    text-decoration: none !important;
    transition: color 0.3s ease;
}

/* Remove underline from any link inside the card */
.nds-recipe-card a { text-decoration: none !important; }

.nds-recipe-title a:hover {
    color: #007cba;
}

.nds-recipe-description {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
    flex-grow: 1;
}

/* Recipe meta information */
.nds-recipe-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #888;
    margin-top: auto;
}

.nds-recipe-time,
.nds-recipe-servings {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nds-recipe-time i,
.nds-recipe-servings i {
    font-size: 0.8rem;
}

/* ========================================
   THEME-SPECIFIC STYLES
   ======================================== */

/* Elementor Theme Style */
.nds-style-elementor {
    --primary-color: #61ce70;
    --secondary-color: #4054b2;
    --text-color: #333;
    --border-color: #e5e5e5;
}

.nds-style-elementor .nds-recipe-card {
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

/* Modern Theme Style */
.nds-style-modern {
    --primary-color: #007cba;
    --secondary-color: #005a87;
    --text-color: #2c3e50;
    --border-color: #ecf0f1;
}

.nds-style-modern .nds-recipe-card {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

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

/* Minimal Theme Style */
.nds-style-minimal {
    --primary-color: #333;
    --secondary-color: #666;
    --text-color: #333;
    --border-color: #ddd;
}

.nds-style-minimal .nds-recipe-card {
    border: 1px solid var(--border-color);
    box-shadow: none;
    border-radius: 4px;
}

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

/* Card Theme Style */
.nds-style-card {
    --primary-color: #e74c3c;
    --secondary-color: #c0392b;
    --text-color: #2c3e50;
    --border-color: #bdc3c7;
}

.nds-style-card .nds-recipe-card {
    border-radius: 6px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

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

/* ========================================
   LAYOUT VARIATIONS
   ======================================== */

/* List Layout */
.layout-list .nds-recipes-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.layout-list .nds-recipe-card {
    flex-direction: row;
    max-height: 200px;
}

.layout-list .nds-recipe-image {
    width: 200px;
    flex-shrink: 0;
}

.layout-list .nds-recipe-content {
    flex: 1;
    padding: 1.5rem;
}

/* Masonry Layout */
.layout-masonry .nds-recipes-grid {
    columns: var(--columns, 3);
    column-gap: 2rem;
}

.layout-masonry .nds-recipe-card {
    break-inside: avoid;
    margin-bottom: 2rem;
    display: block;
}

/* ========================================
   SINGLE RECIPE STYLES
   ======================================== */

.nds-recipe-single {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.nds-recipe-single-content {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.nds-recipe-single-image {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
}

.nds-recipe-single-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nds-recipe-single-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 2rem 2rem 1rem 2rem;
    color: var(--text-color, #333);
}

.nds-recipe-single-meta {
    display: flex;
    gap: 2rem;
    margin: 0 2rem 2rem 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color, #eee);
    font-size: 0.95rem;
    color: #666;
}

.nds-recipe-single-description {
    margin: 0 2rem 2rem 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #555;
}

.nds-recipe-ingredients,
.nds-recipe-steps {
    margin: 0 2rem 2rem 2rem;
}

.nds-recipe-ingredients h3,
.nds-recipe-steps h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color, #333);
}

.nds-recipe-ingredients ul {
    list-style: none;
    padding: 0;
}

.nds-recipe-ingredients li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    padding-left: 1.5rem;
}

.nds-recipe-ingredients li:before {
    content: "•";
    color: var(--primary-color, #007cba);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.nds-recipe-steps ol {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
}

.nds-recipe-steps li {
    counter-increment: step-counter;
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    padding-left: 3rem;
}

.nds-recipe-steps li:before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 1rem;
    background: var(--primary-color, #007cba);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

/* ========================================
   OWL CAROUSEL STYLES
   ======================================== */

.nds-recipe-carousel {
    margin: 2rem 0;
    position: relative;
}

/* Owl Carousel container */
.nds-recipe-carousel .owl-carousel {
    position: relative;
}

/* Recipe items in carousel */
.nds-recipe-carousel .owl-item {
    padding: 0 10px;
}

.nds-recipe-carousel .item {
    height: 100%;
}

/* Ensure recipe cards maintain consistent height in carousel */
.nds-recipe-carousel .nds-recipe-card {
    height: 100%;
    margin: 0;
}

/* Owl Carousel navigation */
.nds-recipe-carousel .owl-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    pointer-events: none;
    z-index: 10;
}

.nds-recipe-carousel .owl-nav button {
    position: absolute;
    background: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nds-recipe-carousel .owl-nav button:hover {
    background: #fff !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.nds-recipe-carousel .owl-nav button.owl-prev {
    left: -20px;
}

.nds-recipe-carousel .owl-nav button.owl-next {
    right: -20px;
}

.nds-recipe-carousel .owl-nav button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Owl Carousel dots */
.nds-recipe-carousel .owl-dots {
    text-align: center;
    margin-top: 1rem;
}

.nds-recipe-carousel .owl-dot {
    display: inline-block;
    margin: 0 5px;
}

.nds-recipe-carousel .owl-dot span {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: background 0.3s ease;
}

.nds-recipe-carousel .owl-dot.active span {
    background: var(--primary-color, #007cba);
}

/* Responsive adjustments for Owl Carousel */
@media (max-width: 768px) {
    .nds-recipe-carousel .owl-nav button {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .nds-recipe-carousel .owl-nav button.owl-prev {
        left: -10px;
    }
    
    .nds-recipe-carousel .owl-nav button.owl-next {
        right: -10px;
    }
}

.nds-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    color: #333;
    z-index: 10;
    transition: all 0.3s ease;
}

.nds-carousel-arrow:hover {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.nds-carousel-prev {
    left: 10px;
}

.nds-carousel-next {
    right: 10px;
}

.nds-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.nds-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: background 0.3s ease;
}

.nds-carousel-dot.active {
    background: var(--primary-color, #007cba);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.nds-no-recipes {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-style: italic;
}

.nds-error {
    background: #fee;
    color: #c33;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #c33;
}

/* ========================================
   OWL CAROUSEL OVERRIDES
   ======================================== */

/* Ensure Owl Carousel doesn't conflict with our styles */
.owl-carousel {
    display: block;
}

.owl-carousel .owl-stage {
    display: flex;
}

.owl-carousel .owl-item {
    display: flex;
    flex: 1;
}

/* Fix for recipe cards in carousel */
.nds-recipe-carousel .owl-item .nds-recipe-card {
    width: 100%;
    height: 100%;
}

/* ========================================
   ELEMENTOR COMPATIBILITY
   ======================================== */

/* Ensure compatibility with Elementor containers */
.elementor-widget-container .nds-recipes-container {
    width: 100%;
}

.elementor-section .nds-recipes-container {
    margin: 0;
}

/* Elementor responsive breakpoints */
@media (max-width: 1024px) {
    .elementor-container .nds-recipes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .elementor-container .nds-recipes-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus styles for keyboard navigation */
.nds-recipe-title a:focus {
    outline: 2px solid var(--primary-color, #007cba);
    outline-offset: 2px;
}

.nds-carousel-arrow:focus {
    outline: 2px solid var(--primary-color, #007cba);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .nds-recipe-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .nds-carousel-arrow,
    .nds-carousel-dots {
        display: none;
    }
    
    .nds-recipe-single-content {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
