/**
 * AZCA Brands Manager — Estilos del plugin
 * Version: 1.0.0
 */

/* =============================================================================
   Variables CSS (sobreescribibles por el usuario)
   ============================================================================= */

:root {
    --azca-brands-gap: 10px;
    --azca-brands-min-width: 150px;
    --azca-brands-min-height: 150px;
    --azca-brands-bg: #fff;
    --azca-brands-border: #eee;
    --azca-brands-border-hover: #ccc;
    --azca-brands-img-max-height: 120px;
    --azca-brands-radius: 4px;
}


/* =============================================================================
   1. LOOP DE PRODUCTOS — Badge de marca
   ============================================================================= */

/* Especificidad alta para ganar a Astra + ShopEngine + Elementor resets */
.woocommerce ul.products li.product .producto-marca,
.shopengine-widget .producto-marca,
li.product .producto-marca,
span.producto-marca,
.producto-marca {
    display: flex !important;
    justify-content: center !important;
    text-align: center !important;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0 6px;
    font-size: 0.8em;
}

.woocommerce ul.products li.product .producto-marca .marca-tag,
.shopengine-widget .producto-marca .marca-tag,
.producto-marca .marca-tag,
.marca-tag {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
    text-align: center !important;
}

.marca-tag:hover {
    text-decoration: underline;
}


/* =============================================================================
   2. GRID DE MARCAS [brands_grid]
   ============================================================================= */

.brands-grid-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--azca-brands-min-width), 1fr));
    gap: var(--azca-brands-gap);
    margin: 0;
    padding: 0;
    width: 100%;
}

/* --- Estilo: card (defecto) --- */

.brands-grid-gallery.azca-brands-style-card a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--azca-brands-min-height);
    background: var(--azca-brands-bg);
    border: 1px solid var(--azca-brands-border);
    border-radius: var(--azca-brands-radius);
    padding: 15px;
    box-sizing: border-box;
    text-decoration: none;
    transition: border-color 0.2s ease;
}

.brands-grid-gallery.azca-brands-style-card a:hover {
    border-color: var(--azca-brands-border-hover);
}

/* --- Estilo: clean --- */

.brands-grid-gallery.azca-brands-style-clean a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--azca-brands-min-height);
    background: none;
    border: none;
    padding: 15px;
    box-sizing: border-box;
    text-decoration: none;
}

/* --- Estilo: shadow --- */

.brands-grid-gallery.azca-brands-style-shadow a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--azca-brands-min-height);
    background: var(--azca-brands-bg);
    border: none;
    border-radius: var(--azca-brands-radius);
    padding: 15px;
    box-sizing: border-box;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.brands-grid-gallery.azca-brands-style-shadow a:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* --- Imagen dentro de la grid --- */

.brands-grid-gallery a img {
    max-width: 100%;
    max-height: var(--azca-brands-img-max-height);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* --- Nombre de marca (opcional) --- */

.azca-brand-name {
    display: block;
    margin-top: 8px;
    font-size: 0.85em;
    color: #374151;
    text-align: center;
    text-decoration: none;
}


/* =============================================================================
   3. IMAGEN DE MARCA EN ARCHIVE [brand_image]
   ============================================================================= */

.current-brand-image-wrapper {
    display: block;
}

.current-brand-image {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}


/* =============================================================================
   4. IMAGEN DE MARCA EN SINGLE PRODUCT [single_product_brand]
   ============================================================================= */

.single-product-brand-wrapper {
    margin: 15px 0;
}

.single-brand-link {
    display: inline-block;
}

.single-brand-link img,
.single-brand-image {
    max-width: 160px;
    height: auto;
    object-fit: contain;
    display: block;
}

.azca-single-brand-name {
    display: block;
    margin-top: 6px;
    font-size: 0.9em;
    color: #374151;
}


/* =============================================================================
   5. LISTADO A-Z [brands_az]
   ============================================================================= */

.azca-brands-az-wrapper {
    margin: 40px 0;
    font-family: inherit;
}

/* Índice de letras navegable */
.azca-brands-az-index {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
    justify-content: center;
}

.azca-brands-az-index a,
.azca-brands-az-index span {
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 18px;
    line-height: 32px;
    text-align: center;
    box-sizing: border-box;
}

.azca-brands-az-index a {
    text-decoration: none;
    background: #f3f4f6;
    color: #111827;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.azca-brands-az-index a:hover {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.azca-brands-az-index span {
    background: #f9fafb;
    color: #9ca3af;
    border: 1px dashed #e5e7eb;
}

/* Grupo por letra */
.azca-brands-az-group {
    padding: 24px 0;
    border-bottom: 1px solid #e5e7eb;
}

.azca-brands-az-group:last-child {
    border-bottom: none;
}

.azca-brands-az-letter {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #111827;
    margin-bottom: 12px;
}

/* Lista de marcas dentro de cada letra */
.azca-brands-az-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 30px;
    padding-left: 4px;
}

.azca-brands-az-list a {
    position: relative;
    text-decoration: none;
    color: #374151;
    font-size: 15px;
    padding: 4px 0;
    transition: color 0.15s ease;
}

.azca-brands-az-list a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 1px;
    background: #111827;
    transition: width 0.2s ease;
}

.azca-brands-az-list a:hover {
    color: #111827;
}

.azca-brands-az-list a:hover::after {
    width: 100%;
}


/* =============================================================================
   6. FILTRO DE BÚSQUEDA
   ============================================================================= */

.azca-brands-search-wrapper {
    margin-bottom: 20px;
}

.azca-brands-search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid #e5e7eb;
    border-radius: var(--azca-brands-radius);
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.azca-brands-search-input:focus {
    border-color: #111827;
}

.azca-brands-no-results {
    padding: 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    display: none;
}


/* =============================================================================
   7. RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
    .azca-brands-az-group {
        padding: 18px 0;
    }
    .azca-brands-az-letter {
        font-size: 22px;
        margin-bottom: 10px;
    }
    .azca-brands-az-list {
        gap: 8px 18px;
    }
}
