/*
Theme Name: viveaip child
Theme URI: 
Author: Marta Torre
Author URI: 
Description: 
Requires at least: 6.7
Tested up to: 6.7
Requires PHP: 5.7
Version: 
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Template: twentytwentyfive
Text Domain: viveaip-child
Tags: 
*/

body, html{
	overflow-x:hidden;

}

body:not(.page-template-wp-custom-template-account-area):not(.post-type-archive-miembro):not(.page-id-319):not(.post-type-archive-articulo):not(.post-type-archive-post-premium):not(.post-type-archive-webinar-masterclass):not(.page-id-763):not(.post-type-archive-receta)
{
	background-image: none !important;
	background: #eef3e0 !important;
}


div.easyrecipe{
	border: 1px dashed #000;
    padding-left: 10px;
    text-align: left;
    background: #f7f7f7;
    padding-top: 10px;
    padding-right: 10px;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
    clear: both;
    font: 13px Arial, Helvetica, sans-serif;
}

.easyrecipe .ERSName {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 20px;
}

.va-home-ch{
	align-items:flex-start;	
	padding:64px 0;
}

.gform_required_legend{
	font-size:14px;
}


/* Home Hero Title*/ 
.va-home-hero-title{
	width:80%;
	
}
.va-home-six-section{
	position:relative;
}
.va-white-bg-transparency{
	position:absolute;
	background-color: rgba(255,255,255,0.3);
	top:0;
	left:0;
	width:100%;
	margin:0;
	padding:0;
	height:100%;
}


.va-about-hero-image img{
		width:400px;
		object-fit: cover;
}

.va-account-menu-bars{
	 margin-right:auto !important;
}

#va-account-close{
    display:none;
    position: absolute;
    right: 0px;
    top: 5px;
}

.menu-account-bars{
    font-size: 36px;
    margin-top: -7px;
}

.va-account-sidebar-wrapper svg.custom-logo{
    width:100%;
    height:auto;
}



@media (max-width:768px){
	.va-about-hero-image-col{
		margin-top:2rem !important;
	}
	.va-members-search{
	    max-width:50%;
	}
}

@media (max-width:999px){
    .va-account-sidebar-wrapper svg.custom-logo{
        min-width:232px;
        min-height:92px;
    }

	.va-home-hero-title{
		width:65%;
		max-width:700px;
	}
	
    .va-account-sidebar-wrapper.active{
        visibility:visible;
        display:flex;
        -moz-animation: showHide 200ms ease-out; /* Firefox */
        -webkit-animation: showHide 200ms ease-out  ; /* Safari and Chrome */
        -ms-animation: showHide 200ms ease-out; /* IE10 */
        -o-animation: showHide 200ms ease-out; /* Opera */
        animation: showHide 200ms ease-out;
    }
    
    .va-account-sidebar-wrapper{
        visibility:hidden;
        display:none;
        position:fixed;
        top:0;
        left:0;
        background-color:white;
        overflow-x:hidden;
        overflow-y:auto;
        z-index:999;
        height: 100vh;
        box-sizing: border-box;
        flex-wrap: nowrap;
        -moz-animation: showHide 200ms ease-in; /* Firefox */
        -webkit-animation: showHide 200ms ease-in  ; /* Safari and Chrome */
        -ms-animation: showHide 200ms ease-in; /* IE10 */
        -o-animation: showHide 200ms ease-in; /* Opera */
        animation: showHide 200ms ease-in;
    }
    
    #va-account-close{
        display:block;
        margin-left:auto;
    }
}
   



@media ( min-width: 600px ) {
    .wp-block-navigation__responsive-container-open:not(.always-shown) {
      display: flex;
    }
    .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
      display: none;
    }
	.va-home-hero-title{
		width:70%;
		max-width:750px;
	}
}

@media ( min-width:768px ){
	
	
	.va-header{
	align-items: flex-end;
	}
	.va-header > nav{
		padding-bottom:0.7rem;
	}
	.va-header > div:last-of-type{
		padding-bottom:0.4rem;
	}
	
	.va-about-quotes-col h2{
		margin-left:15%;
	}
	
	.va-about-hero-image img{
		width:auto;
		min-height: 100vh;
		object-fit: cover;
	}
}



@media ( min-width: 1000px ) {
    
    .va-account-menu-bars{
        visibility:hidden;
    }

	.va-home-hero-title{
		width:65%;
		max-width:650px;
	}
	
    .wp-block-navigation__responsive-container-open:not(.always-shown) {
      display: none !important;
    }
    .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
      display: block !important;
    }
}

@media ( min-width: 1200px ) {
		
	.va-home-hero-title{
		width:60%;
		max-width:650px;
	}
	
	
	
}


@-webkit-keyframes showHide { /* Chrome, Safari */
    0% {left:-50vw;display:flex;}
    100% {left:0;overflow-y: scroll;}
}
@-moz-keyframes showHide { /* FF */
    0% {left:-50vw;display:flex;}
    100% {left:0;overflow-y: scroll;}
}

@-o-keyframes showHide { /* Opera */
    0% {left:-50vw;display:flex;}
    100% {left:0;overflow-y: scroll;}
}
@keyframes showHide {
    0% {left:-50vw;display:flex;}
    100% {left:0;overflow-y: scroll;}
}

add_action('acf/init', function() {
    if( function_exists('acf_register_block_type') ) {
        acf_register_block_type([
            'name'              => 'categorias_recetas',
            'title'             => __('Categorías de Recetas'),
            'description'       => __('Muestra las categorías del CPT Recetas con imagen, título y descripción'),
            'render_callback'   => 'render_bloque_categorias_recetas',
            'category'          => 'widgets',
            'icon'              => 'images-alt2',
            'keywords'          => ['recetas', 'categorías', 'comida'],
            'supports'          => [
                'align' => false,
            ]
        ]);
    }
});

function render_bloque_categorias_recetas($block) {
    // Obtener todas las categorías de la taxonomía
    $categorias = get_terms([
        'taxonomy'   => 'categoria_recetas', // Cambia por el slug real de tu taxonomía
        'hide_empty' => false
    ]);

    if (!empty($categorias) && !is_wp_error($categorias)) {
        echo '<div class="categorias-recetas-grid" style="display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:20px;">';

        foreach ($categorias as $categoria) {
            $imagen = get_field('imagen_categoria', 'term_' . $categoria->term_id);

            echo '<div class="categoria-receta-card" style="border:1px solid #ddd;padding:15px;border-radius:8px;text-align:center;">';

            if ($imagen && isset($imagen['url'])) {
                echo '<img src="' . esc_url($imagen['url']) . '" alt="' . esc_attr($imagen['alt']) . '" style="max-width:100%;height:auto;border-radius:6px;">';
            }

            echo '<h3 style="margin:10px 0;">' . esc_html($categoria->name) . '</h3>';
            if (!empty($categoria->description)) {
                echo '<p style="font-size:14px;color:#555;">' . esc_html($categoria->description) . '</p>';
            }

            echo '</div>';
        }

        echo '</div>';
    } else {
        echo '<p>No hay categorías disponibles.</p>';
    }
}