/*
Theme Name: Blocksy Child
Template: blocksy
*/

.ofertas-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1100px; /* Constrain width */
    margin: 0 auto; /* Center container */
}

/* NEW CARD LAYOUT */
.offer-card {
    background-color: #fff;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: row; /* Horizontal layout */
    align-items: center; /* Center items vertically */
    gap: 15px;
    padding: 10px;
    transition: box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.offer-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.offer-card-image {
    flex: 0 0 100px; /* Fixed width for image container */
    text-align: center;
    height: 100px; /* Give image a fixed height */
}

.offer-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensure image covers the area */
    border-radius: 5px;
}

.offer-card-info {
    padding: 0; /* Remove padding, handled by card gap */
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.offer-title {
    font-weight: bold;
    font-size: 1.0em;
    margin: 0 0 5px 0;
}

.offer-title a {
    text-decoration: none;
    color: inherit;
}

.offer-price {
    font-size: 1.1em;
    font-weight: bold;
    color: #e67e22;
    margin: 0 0 10px 0;
}

.offer-card .wp-block-buttons {
    justify-content: flex-start; /* Align button to the left */
    margin-top: 0;
}

.offer-card .wp-block-button {
    margin-bottom: 0; /* Remove bottom margin from button container */
}

.offer-card .wp-block-button__link {
    padding: 4px 12px !important; /* Smaller padding for a smaller button */
    font-size: 0.8em !important; /* Override inline style if needed */
    height: auto;
    line-height: normal;
}

@media (max-width: 600px) {
    .ofertas-container {
        padding: 20px 15px;
        gap: 15px;
    }

    .offer-card-image {
        flex: 0 0 80px;
        height: 80px;
    }

    .offer-title {
        font-size: 0.95em;
    }

    .offer-price {
        font-size: 1em;
        margin-bottom: 8px;
    }
}
/* Ajustes para el botón */
:root {
    --action-orange: #ff6600;
    --trust-blue: #0A4D68;
}

.offer-card .wp-block-button__link:hover {
    background-color: #e65c00 !important; /* Un poco más oscuro al pasar el mouse */
}

/* --- Sticky Navigation (Clone Method) --- */

/* 1. Estilos para el contenedor del clon */
#cloned-nav-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transform: translateY(-100%);
    transition: transform 0.4s ease;
}

/* 2. Clase que activa la visibilidad del clon */
body.cloned-nav-active #cloned-nav-container {
    transform: translateY(0);
}

/* 3. Estilos para el contenido del clon (diseño compacto) */
#cloned-nav-container .ct-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 15px; /* Padding más compacto */
}

/* 5. Placeholder para evitar el salto de contenido */
.nav-placeholder {
    display: none; /* Oculto por defecto */
}

body.cloned-nav-active .nav-placeholder {
    display: block; /* Se muestra cuando el nav es sticky */
}

.bcat-side-item:hover {
    background-color: rgba(125, 163, 180, 0.2);
}

.bcat-side-item:hover .bcat-side-title a {
    color: #0A4D68;
    text-decoration: underline;
}

/* Barra de búsqueda principal - Estilo Mejorado */
.barra-busqueda-principal-container {
    position: relative; /* Needed for absolute positioning of results */
    width: 100%;
    max-width: 750px;
    margin: 40px auto;
}

.barra-busqueda-principal-container .search-form {
    display: flex;
    width: 100%;
    border-radius: 50px; /* Fully rounded ends */
    border: 1px solid #e0e0e0;
    background-color: #fff;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.07);
    transition: box-shadow 0.3s ease, border-color 0.3s ease; /* Added border-color transition */
}

.barra-busqueda-principal-container .search-form:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.barra-busqueda-principal-container .search-form:focus-within {
    border-color: var(--trust-blue, #0A4D68);
    box-shadow: 0 8px 25px rgba(10, 77, 104, 0.2); /* Shadow with a hint of the focus color */
}

.barra-busqueda-principal-container .search-field {
    flex-grow: 1;
    padding: 18px 25px;
    border: none;
    outline: none;
    font-size: 1.1em;
    color: #333;
    background-color: transparent;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>');
    background-repeat: no-repeat;
    background-position: 20px center;
    padding-left: 55px; /* More space for the icon */
}

.barra-busqueda-principal-container .search-field::placeholder {
    color: #999;
    opacity: 1;
}

.barra-busqueda-principal-container .search-submit {
    padding: 0 35px;
    border: none;
    background-color: var(--trust-blue, #0A4D68);
    color: white;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 600;
    transition: background-color 0.3s;
    border-radius: 0; /* No radius here, the parent has it */
}

.barra-busqueda-principal-container .search-submit:hover {
    background-color: #7DA3B4 !important;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .barra-busqueda-principal-container {
        margin: 25px 15px; /* Add horizontal margin/padding */
        width: auto; /* Allow it to shrink */
    }
    .barra-busqueda-principal-container .search-form {
        flex-direction: row !important; /* Ensure it stays in a single row */
        border-radius: 50px; /* Keep it rounded */
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }
 
    .barra-busqueda-principal-container .search-field {
        padding: 14px 15px;
        padding-left: 45px;
        background-position: 15px center;
        text-align: left; /* Align left for better usability */
    }

    .barra-busqueda-principal-container .search-submit {
        padding: 0 25px;
        border-radius: 0;
        border-top: none;
    }
}

/* Live Search Results */
.live-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 24px; /* Consistent, softer rounding */
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.15); /* More professional shadow */
    z-index: 99999;
    margin-top: 4px; /* Reduced gap */
    display: none; /* Hidden by default */
    overflow: hidden; /* Ensure child elements respect the border-radius */
}

.live-search-results ul {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
}

.live-search-results .search-result-item a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.2s ease;
}

.live-search-results .search-result-item:last-child a {
    border-bottom: none;
}

.live-search-results .search-result-item a:hover {
    background-color: #f9f9f9;
}

.live-search-results .search-result-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 15px;
    flex-shrink: 0;
}

.live-search-results .search-result-info {
    display: flex;
    flex-direction: column;
    flex: 1; /* Allow the container to grow and shrink */
    min-width: 0; /* Ensure it can shrink below its content's intrinsic width */
}

.live-search-results .search-result-title,
.live-search-results .search-result-excerpt {
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.live-search-results .search-result-title {
    font-weight: 600;
    font-size: 1em;
    line-height: 1.3;
}

.live-search-results .search-result-excerpt {
    font-size: 0.9em;
    color: #777;
}

.live-search-results .no-results,
.live-search-results .loading-spinner {
    padding: 20px;
    text-align: center;
    color: #888;
}
/* Simple CSS spinner */
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--trust-blue, #0A4D68);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Barra de Búsqueda Lateral --- */
.barra-busqueda-lateral-container {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.barra-busqueda-lateral-container .search-form {
    display: flex;
    width: 100%;
    border-radius: 25px;
    border: 1px solid #e0e0e0;
    background-color: #f5f5f5; /* Slightly different background for sidebars */
    overflow: hidden;
}

.barra-busqueda-lateral-container .search-form:focus-within {
    border-color: var(--trust-blue, #0A4D68);
}

.barra-busqueda-lateral-container .search-field {
    flex-grow: 1;
    padding: 10px 15px;
    border: none;
    outline: none;
    font-size: 0.95em;
    color: #333;
    background-color: transparent;
}

.barra-busqueda-lateral-container .search-submit {
    padding: 0 12px;
    border: none;
    background-color: transparent;
    color: #777;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.barra-busqueda-lateral-container .search-submit:hover {
    color: var(--trust-blue, #0A4D68);
}

/* Results for sidebar search */
.barra-busqueda-lateral-container .live-search-results {
    /* It will inherit most styles from the main one, just need to adjust as needed */
    border-radius: 15px;
    margin-top: 5px;
    box-shadow: 0 5px 20px -5px rgba(0,0,0,0.1);
}

.barra-busqueda-lateral-container .live-search-results .search-result-item a {
    padding: 10px 15px;
}

.barra-busqueda-lateral-container .live-search-results .search-result-thumbnail {
    width: 40px;
    height: 40px;
}

.barra-busqueda-lateral-container .live-search-results .search-result-title {
    font-size: 0.9em;
}

.barra-busqueda-lateral-container .live-search-results .search-result-excerpt {
    font-size: 0.8em;
}

/* Ocultar el título de archivo de categoría por defecto para evitar duplicados */
.category .ct-page-title-container {
    display: none !important;
}

/* --- Live Search for Mobile Header --- */
.header-search.live-search-wrapper {
    position: relative;
}

.header-search .live-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    /* Hereda la mayoría de los estilos de .live-search-results */
}

@media (max-width: 992px) {
    .header-search.is-active + .header-actions { z-index: 1001; }
}

/* --- Header Search Button Icon --- */
#custom-header-search .search-submit {
    border: none;
    background-color: var(--action-orange);
    color: #fff;
    cursor: pointer;
    border-radius: 0 5px 5px 0;
    padding: 0;
    width: 50px; /* Ancho fijo para el botón */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

#custom-header-search .search-submit:hover {
    filter: brightness(90%);
}

/* Cambiar el color del botón cuando el input está enfocado */
#custom-header-search .search-form:focus-within .search-submit {
    background-color: #f0f0f0; /* Gris claro */
    color: var(--trust-blue); /* Icono azul */
}

/* Ajuste para el botón de búsqueda en el header móvil */
@media (max-width: 992px) {
    .header-search .search-submit {
        width: 55px; /* Un poco más de ancho para el móvil */
    }
}

/*
--- Estilos para el Footer ---
*/

/* 1. Justificar y centrar contenido de widgets en Escritorio */
[data-id="footer"] [data-row*="widgets"] .widget {
    text-align: center;
}

[data-id="footer"] [data-row*="widgets"] .widget-title {
    text-align: center;
}

[data-id="footer"] [data-row*="widgets"] .widget ul {
    padding-left: 0; /* Remover padding por defecto para centrar correctamente */
    list-style: none;
}

/* 2. Compactar el footer en dispositivos móviles */
@media (max-width: 768px) {
    [data-id="footer"] [data-row*="widgets"] [class*="ct-grid"] > div {
        margin-bottom: 20px; /* Reduce el espacio entre widgets apilados */
    }
    [data-id="footer"] .widget-title {
        font-size: 1.1em; /* Títulos de widget más pequeños */
        margin-bottom: 10px; /* Menos espacio debajo del título */
    }
}

/* 3. Justificar y espaciar columnas de widgets en PC */
@media (min-width: 993px) {
    [data-id="footer"] [data-row*="widgets"] [class*="ct-grid"] {
        display: flex;
        justify-content: space-between;
        gap: 20px; /* Espacio mínimo entre columnas */
    }

    [data-id="footer"] [data-row*="widgets"] [class*="ct-grid"] > div {
        flex: 1; /* Asegura que todas las columnas tengan el mismo ancho */
    }
}