/**
 * Catálogo EcoTienda PRODECO - Estilos de Frontend
 */

:root {
    --ecotienda-primary: #164b32;
    --ecotienda-primary-hover: #0f3624;
    --ecotienda-primary-light: #eef7f2;
    --ecotienda-cols: 4;
    --ecotienda-cols-tablet: 2;
    --ecotienda-cols-mobile: 1;
    --ecotienda-img-radius: 12px;
    --ecotienda-pag-radius: 8px;
    --ecotienda-pag-active-bg: var(--ecotienda-primary);
    --ecotienda-pag-active-color: #ffffff;
    --ecotienda-pag-btn-bg: #ffffff;
    --ecotienda-pag-btn-color: #374151;
    --ecotienda-pag-btn-border: #d1d5db;
}

.ecotienda-catalogo-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    color: #1f2937;
    margin: 0 auto;
    position: relative;
}

.ecotienda-catalogo-wrapper *,
.ecotienda-catalogo-wrapper *::before,
.ecotienda-catalogo-wrapper *::after {
    box-sizing: border-box;
}

/* =========================================================================
   BARRA DE FILTROS SUPERIOR
   ========================================================================= */
.ecotienda-filters-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    width: 100%;
}

.ecotienda-filter-group {
    flex: 1;
    min-width: 220px;
}

.ecotienda-filter-search {
    flex: 1.5;
    min-width: 280px;
}

/* SELECTS */
.ecotienda-select-wrapper {
    position: relative;
    width: 100%;
}

.ecotienda-select {
    width: 100%;
    height: 48px;
    padding: 0 40px 0 16px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ecotienda-select:focus {
    border-color: var(--ecotienda-primary);
    box-shadow: 0 0 0 3px rgba(22, 75, 50, 0.12);
}

.ecotienda-select-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* BUSCADOR */
.ecotienda-search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.ecotienda-search-input {
    width: 100%;
    height: 48px;
    padding: 0 54px 0 16px;
    font-size: 14px;
    color: #1f2937;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ecotienda-search-input::placeholder {
    color: #9ca3af;
}

.ecotienda-search-input:focus {
    border-color: var(--ecotienda-primary);
    box-shadow: 0 0 0 3px rgba(22, 75, 50, 0.12);
}

.ecotienda-search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    height: 38px;
    width: 42px;
    background-color: var(--ecotienda-primary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.ecotienda-search-btn:hover {
    background-color: var(--ecotienda-primary-hover);
}

.ecotienda-search-btn:active {
    transform: translateY(-50%) scale(0.96);
}

/* =========================================================================
   SUB-BARRA: CONTADOR Y ORDENAMIENTO
   ========================================================================= */
.ecotienda-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 8px;
}

.ecotienda-counter-text {
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
}

.ecotienda-sort-wrapper {
    min-width: 220px;
}

.ecotienda-sort-select {
    height: 40px;
    font-size: 13.5px;
    padding: 0 36px 0 14px;
    border-radius: 8px;
}

/* =========================================================================
   GRILLA DE PRODUCTOS
   ========================================================================= */
.ecotienda-grid-container {
    position: relative;
    min-height: 250px;
}

.ecotienda-grid {
    display: grid;
    grid-template-columns: repeat(var(--ecotienda-cols, 4), minmax(0, 1fr));
    gap: 24px;
    width: 100%;
    transition: opacity 0.25s ease;
}

/* =========================================================================
   TARJETA INDIVIDUAL (CARD)
   ========================================================================= */
.ecotienda-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    height: 100%;
}

.ecotienda-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.03);
    border-color: #d1d5db;
}

/* ÁREA DE IMAGEN */
.ecotienda-card-thumb-wrap {
    position: relative;
    width: 100%;
    height: 210px;
    min-height: 210px;
    background-color: #e2ece9;
    overflow: hidden;
    border-radius: var(--ecotienda-img-radius, 12px);
    display: block;
}

/* BADGE DEL POST TYPE */
.ecotienda-card-badge-wrap {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    pointer-events: none;
}

.ecotienda-card-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(4px);
    transition: transform 0.2s ease;
}

.ecotienda-badge-ecotienda {
    background-color: #164b32;
    color: #ffffff;
}

.ecotienda-badge-noticias {
    background-color: #0284c7;
    color: #ffffff;
}

.ecotienda-badge-publicaciones {
    background-color: #7c3aed;
    color: #ffffff;
}

.ecotienda-badge-proyectos {
    background-color: #d97706;
    color: #ffffff;
}

.ecotienda-badge-post {
    background-color: #475569;
    color: #ffffff;
}

.ecotienda-card-thumb-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.ecotienda-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
    border-radius: inherit;
}

.ecotienda-card:hover .ecotienda-card-img {
    transform: scale(1.04);
}

.ecotienda-card-img-placeholder {
    width: 100%;
    height: 100%;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.ecotienda-ph-ecotienda {
    background-color: #e2ece9;
}
.ecotienda-ph-noticias {
    background-color: #e0f2fe;
}
.ecotienda-ph-publicaciones {
    background-color: #f3e8ff;
}
.ecotienda-ph-proyectos {
    background-color: #fef3c7;
}

.ecotienda-ph-svg {
    stroke: #64748b;
    opacity: 0.75;
}
.ecotienda-ph-ecotienda .ecotienda-ph-svg {
    stroke: #164b32;
}
.ecotienda-ph-noticias .ecotienda-ph-svg {
    stroke: #0284c7;
}
.ecotienda-ph-publicaciones .ecotienda-ph-svg {
    stroke: #7c3aed;
}
.ecotienda-ph-proyectos .ecotienda-ph-svg {
    stroke: #d97706;
}

/* CUERPO DE LA TARJETA */
.ecotienda-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.ecotienda-card-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 8px 0;
    color: #111827;
}

.ecotienda-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.ecotienda-card-desc {
    font-size: 13.5px;
    line-height: 1.5;
    color: #6b7280;
    margin: 0 0 16px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* LISTA DE METADATOS (COMUNIDAD Y TERRITORIO) */
.ecotienda-card-meta-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.ecotienda-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    line-height: 1.35;
    color: #4b5563;
}

.ecotienda-meta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--ecotienda-primary);
}

.ecotienda-meta-icon svg {
    stroke: var(--ecotienda-primary);
}

.ecotienda-meta-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
}

/* BOTÓN PILL OUTLINE */
.ecotienda-card-footer {
    margin-top: auto;
}

.ecotienda-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 42px;
    padding: 0 20px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ecotienda-primary);
    background-color: transparent;
    border: 1.5px solid var(--ecotienda-primary);
    border-radius: 9999px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ecotienda-btn-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.ecotienda-btn-arrow svg {
    stroke: currentColor;
}

.ecotienda-card-btn:hover {
    background-color: var(--ecotienda-primary);
    color: #ffffff;
    border-color: var(--ecotienda-primary);
}

.ecotienda-card-btn:hover .ecotienda-btn-arrow {
    transform: translateX(4px);
}

/* =========================================================================
   OVERLAY Y SPINNER DE CARGA AJAX
   ========================================================================= */
.ecotienda-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 10;
    border-radius: 12px;
}

.ecotienda-catalogo-wrapper.is-loading .ecotienda-loading-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ecotienda-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(22, 75, 50, 0.15);
    border-top-color: var(--ecotienda-primary);
    border-radius: 50%;
    animation: ecotienda-spin 0.75s infinite linear;
}

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

/* =========================================================================
   ESTADO SIN RESULTADOS
   ========================================================================= */
.ecotienda-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 24px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
}

.ecotienda-no-results-icon {
    color: #9ca3af;
    margin-bottom: 12px;
}

.ecotienda-no-results h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.ecotienda-no-results p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 16px 0;
}

.ecotienda-btn-reset-filters {
    padding: 10px 22px;
    background-color: var(--ecotienda-primary);
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ecotienda-btn-reset-filters:hover {
    background-color: var(--ecotienda-primary-hover);
}

/* =========================================================================
   PAGINACIÓN PERSONALIZABLE
   ========================================================================= */
.ecotienda-pagination-wrapper {
    margin-top: 36px;
    display: flex;
    width: 100%;
}

.ecotienda-pagination-wrapper.align-center {
    justify-content: center;
}

.ecotienda-pagination-wrapper.align-left {
    justify-content: flex-start;
}

.ecotienda-pagination-wrapper.align-right {
    justify-content: flex-end;
}

.ecotienda-pagination-wrapper.align-space-between {
    justify-content: space-between;
}

.ecotienda-pagination-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: inherit;
    width: 100%;
}

.ecotienda-pag-info {
    font-size: 13.5px;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
}

.ecotienda-pagination {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ecotienda-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--ecotienda-pag-btn-border, #d1d5db);
    background-color: var(--ecotienda-pag-btn-bg, #ffffff);
    color: var(--ecotienda-pag-btn-color, #374151);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--ecotienda-pag-radius, 8px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ecotienda-page-btn:hover {
    border-color: var(--ecotienda-pag-active-bg, var(--ecotienda-primary));
    color: var(--ecotienda-pag-active-bg, var(--ecotienda-primary));
    background-color: rgba(22, 75, 50, 0.06);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}

.ecotienda-page-btn.active {
    background-color: var(--ecotienda-pag-active-bg, var(--ecotienda-primary));
    color: var(--ecotienda-pag-active-color, #ffffff);
    border-color: var(--ecotienda-pag-active-bg, var(--ecotienda-primary));
    box-shadow: 0 2px 8px rgba(22, 75, 50, 0.25);
    cursor: default;
    transform: none;
}

.ecotienda-page-dots {
    color: #9ca3af;
    padding: 0 4px;
    font-weight: 600;
}

/* ESTILO PÍLDORA (OVALADO) */
.ecotienda-pag-pill .ecotienda-page-btn {
    border-radius: 9999px;
    padding: 0 16px;
}

/* ESTILO CUADRADO MODERNO */
.ecotienda-pag-square .ecotienda-page-btn {
    border-radius: 0px;
}

/* ESTILO MINIMALISTA */
.ecotienda-pag-minimal .ecotienda-page-btn {
    background-color: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    border-bottom: 2px solid transparent;
}

.ecotienda-pag-minimal .ecotienda-page-btn:hover {
    background-color: transparent;
    border-bottom-color: var(--ecotienda-pag-active-bg, var(--ecotienda-primary));
    transform: none;
}

.ecotienda-pag-minimal .ecotienda-page-btn.active {
    background-color: transparent;
    color: var(--ecotienda-pag-active-bg, var(--ecotienda-primary));
    border-bottom-color: var(--ecotienda-pag-active-bg, var(--ecotienda-primary));
    box-shadow: none;
}

/* SELECTOR DE ITEMS POR PÁGINA */
.ecotienda-per-page-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: #4b5563;
    font-weight: 500;
    margin-left: auto;
}

.ecotienda-per-page-label {
    white-space: nowrap;
}

.ecotienda-per-page-select {
    height: 38px;
    padding: 0 28px 0 12px;
    font-size: 13.5px;
    font-weight: 500;
    color: #374151;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.ecotienda-per-page-select:focus {
    border-color: var(--ecotienda-primary);
}

/* =========================================================================
   RESPONSIVE DESIGN (TABLET Y MÓVIL)
   ========================================================================= */
@media (max-width: 1024px) {
    .ecotienda-grid {
        grid-template-columns: repeat(var(--ecotienda-cols-tablet, 2), minmax(0, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .ecotienda-filters-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .ecotienda-filter-group,
    .ecotienda-filter-search {
        width: 100%;
        min-width: 100%;
    }

    .ecotienda-subbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .ecotienda-sort-wrapper {
        width: 100%;
    }

    .ecotienda-grid {
        grid-template-columns: repeat(var(--ecotienda-cols-mobile, 1), minmax(0, 1fr));
        gap: 16px;
    }
}
