/*
 * BlueArk CORPOMEDGUA — Brand Catalog Frontend Styles
 * © 2024 Blue Ark Solutions
 */

:root {
    --ba-blue-1   : #2BA8E2;
    --ba-blue-2   : #202988;
    --ba-grad     : linear-gradient(135deg, #2BA8E2 0%, #202988 100%);
    --ba-radius   : 10px;
    --ba-shadow   : 0 2px 10px rgba(32,41,136,.10);
    --ba-shadow-h : 0 6px 20px rgba(32,41,136,.18);
    --ba-text     : #1a2a3a;
    --ba-muted    : #6b7a8d;
    --ba-border   : #e2e8f0;
    --ba-bg       : #f8faff;
}

/* ── Wrapper ──────────────────────────────────────────────────── */
.ba-sc-wrap {
    font-family: inherit;
    color: var(--ba-text);
}

/* ══════════════════════════════════════════════════════════════
   BRAND CARDS GRID (View A)
══════════════════════════════════════════════════════════════ */

/*
 * Centrado: usamos flexbox en lugar de grid para que las cards
 * se centren cuando no llenan el ancho completo del contenedor.
 * max-width por card: 220px — ajustable.
 */
.ba-brands-grid {
    display        : flex;
    flex-wrap      : wrap;
    justify-content: center;
    gap            : 20px;
    padding        : 4px 0;
}

.ba-brand-card {
    display        : flex;
    flex-direction : column;
    width          : 200px;          /* ancho fijo → cards uniformes */
    flex-shrink    : 0;
    background     : #fff;
    border         : 1px solid var(--ba-border);
    border-radius  : var(--ba-radius);
    overflow       : hidden;
    text-decoration: none;
    color          : var(--ba-text);
    box-shadow     : var(--ba-shadow);
    transition     : transform .22s ease, box-shadow .22s ease;
}

/* Tablet: 2 cards por fila (481px – 900px) */
@media (max-width: 900px) and (min-width: 481px) {
    .ba-brand-card { width: calc(50% - 10px); }
}

/* Móvil: 2 cards por fila también, más compactas */
@media (max-width: 480px) {
    .ba-brand-card { width: calc(50% - 10px); }
}

.ba-brand-card:hover {
    transform      : translateY(-4px);
    box-shadow     : var(--ba-shadow-h);
    text-decoration: none;
    color          : var(--ba-text);
}

.ba-brand-card-img-wrap {
    background     : #f5f7fa;
    display        : flex;
    align-items    : center;
    justify-content: center;
    min-height     : 140px;
    padding        : 20px;
    border-bottom  : 1px solid var(--ba-border);
}

.ba-brand-card-img {
    max-width : 100%;
    max-height: 100px;
    object-fit: contain;
}

.ba-brand-card-placeholder {
    font-size: 48px;
    opacity  : .4;
}

.ba-brand-card-body {
    padding        : 14px 16px 16px;
    display        : flex;
    flex-direction : column;
    align-items    : center;   /* centrar contenido horizontalmente */
    text-align     : center;
    gap            : 4px;
    flex           : 1;
}

.ba-brand-card-name {
    font-size  : 15px;
    font-weight: 700;
    color      : var(--ba-text);
    line-height: 1.3;
}

.ba-brand-card-count {
    font-size: 12px;
    color    : var(--ba-muted);
}

.ba-brand-card-btn {
    display    : inline-block;
    margin-top : 10px;
    font-size  : 12px;
    font-weight: 700;
    background: var(--ba-grad);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    align-self: flex-start;
    transition: opacity .2s;
}

.ba-brand-card:hover .ba-brand-card-btn {
    opacity: .88;
}

/* ══════════════════════════════════════════════════════════════
   PRODUCT VIEW (View B)
══════════════════════════════════════════════════════════════ */

/* Breadcrumb */
.ba-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.ba-bc-link {
    color: var(--ba-blue-1);
    text-decoration: none;
    font-weight: 600;
    transition: color .15s;
}

.ba-bc-link:hover { color: var(--ba-blue-2); text-decoration: underline; }

.ba-bc-sep    { color: #bbb; }
.ba-bc-current{ color: var(--ba-muted); font-weight: 500; }

/* Layout */
.ba-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 768px) {
    .ba-layout { grid-template-columns: 1fr; }
    .ba-sidebar { order: 2; }
    .ba-main    { order: 1; }
}

/* Sidebar */
.ba-sidebar {
    background: #fff;
    border: 1px solid var(--ba-border);
    border-radius: var(--ba-radius);
    overflow: hidden;
    box-shadow: var(--ba-shadow);
}

.ba-sidebar-title {
    margin: 0;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: #fff;
    background: var(--ba-grad);
}

.ba-cat-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.ba-cat-list li { margin: 0; }

.ba-cat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ba-text);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, border-color .15s, color .15s;
}

.ba-cat-link:hover {
    background: var(--ba-bg);
    color: var(--ba-blue-2);
    text-decoration: none;
}

.ba-cat-link--active {
    border-left-color: var(--ba-blue-1);
    background: #eef5ff;
    color: var(--ba-blue-2);
    font-weight: 700;
}

.ba-cat-count {
    font-size: 11px;
    background: #e8eef5;
    color: var(--ba-muted);
    border-radius: 10px;
    padding: 1px 7px;
    font-weight: 600;
    flex-shrink: 0;
}

.ba-cat-link--active .ba-cat-count {
    background: #d0e4ff;
    color: var(--ba-blue-2);
}

/* Topbar */
.ba-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.ba-results-count {
    font-size: 13px;
    color: var(--ba-muted);
    font-weight: 500;
}

/* Product grid */
.ba-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.ba-product-card {
    background: #fff;
    border: 1px solid var(--ba-border);
    border-radius: var(--ba-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--ba-shadow);
    transition: transform .2s ease, box-shadow .2s ease;
}

.ba-product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ba-shadow-h);
}

.ba-card-img-link { display: block; text-decoration: none; }

.ba-card-img-wrap {
    background: #f5f7fa;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--ba-border);
}

.ba-card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .25s ease;
}

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

.ba-card-body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ba-card-cat {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--ba-blue-1);
    background: #eef8ff;
    border-radius: 4px;
    padding: 1px 6px;
    align-self: flex-start;
}

.ba-card-title {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
}

.ba-card-title a {
    color: var(--ba-text);
    text-decoration: none;
    transition: color .15s;
}

.ba-card-title a:hover { color: var(--ba-blue-2); }

.ba-card-price {
    margin-top: 4px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ba-blue-2);
}

.ba-card-price .woocommerce-Price-currencySymbol { font-size: 12px; }

/* ── Card footer — layout ──────────────────────────────────── */
.ba-card-footer {
    padding    : 10px 12px 12px;
    border-top : 1px solid var(--ba-border);
}

/* Dual-button: dos botones en columna */
.ba-card-footer--dual {
    display        : flex;
    flex-direction : column;
    gap            : 7px;
}

/* Base para todos los botones de card */
.ba-card-btn {
    display         : block;
    width           : 100%;
    text-align      : center;
    border-radius   : 8px;
    padding         : 8px 0;
    font-size       : 12px;
    font-weight     : 700;
    text-decoration : none;
    cursor          : pointer;
    border          : none;
    transition      : opacity .2s ease, background .2s ease;
    line-height     : 1.3;
    box-sizing      : border-box;
}

/* Primario (gradiente) — "Añadir al carrito" */
.ba-card-btn--add {
    background  : linear-gradient(135deg, #2BA8E2 0%, #202988 100%) !important;
    color       : #ffffff !important;
    text-shadow : none;
    box-shadow  : 0 2px 6px rgba(32,41,136,.18);
}
.ba-card-btn--add:hover,
.ba-card-btn--add:focus,
.ba-card-btn--add:active,
.ba-card-btn--add:visited {
    background  : linear-gradient(135deg, #2BA8E2 0%, #202988 100%) !important;
    color       : #ffffff !important;
    opacity     : .88;
    text-decoration: none;
}

/* Estado loading del botón añadir */
.ba-card-btn--add.ba-card-add-btn--loading {
    opacity : .65;
    cursor  : wait;
}

/* Secundario (outline) — "Ver producto" */
.ba-card-btn--outline {
    background  : transparent !important;
    color       : #202988 !important;
    border      : 2px solid #2BA8E2 !important;
    text-shadow : none;
}
.ba-card-btn--outline:hover,
.ba-card-btn--outline:focus,
.ba-card-btn--outline:active,
.ba-card-btn--outline:visited {
    background      : #eef5ff !important;
    color           : #202988 !important;
    text-decoration : none;
    opacity         : 1;
}

/* Sin stock */
.ba-card-outofstock {
    display     : block;
    text-align  : center;
    font-size   : 11px;
    font-weight : 600;
    color       : #999;
    padding     : 6px 0;
    border      : 1px dashed #ccc;
    border-radius: 8px;
}

/* Empty state */
.ba-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--ba-muted);
}

.ba-empty-btn {
    display: inline-block;
    margin-top: 12px;
    background: var(--ba-grad);
    color: #fff;
    border-radius: var(--ba-radius);
    padding: 10px 22px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    transition: opacity .2s;
}

.ba-empty-btn:hover { opacity: .88; color: #fff; text-decoration: none; }

/* Pagination */
.ba-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--ba-border);
}

.ba-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--ba-border);
    background: #fff;
    color: var(--ba-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}

.ba-pagination .page-numbers:hover {
    background: var(--ba-bg);
    color: var(--ba-blue-2);
    border-color: var(--ba-blue-1);
    text-decoration: none;
}

.ba-pagination .page-numbers.current {
    background: var(--ba-grad);
    color: #fff;
    border-color: transparent;
}

.ba-pagination .page-numbers.dots {
    border: none;
    background: none;
    cursor: default;
}

.ba-pagination .page-numbers.prev,
.ba-pagination .page-numbers.next {
    padding: 0 14px;
    font-size: 12px;
}

/* ══════════════════════════════════════════════════════════════
   AJAX LOADER OVERLAY
══════════════════════════════════════════════════════════════ */
.ba-ajax-loader {
    position   : absolute;
    inset      : 0;
    z-index    : 99;
    background : rgba(255, 255, 255, 0.72);
    display    : flex;
    align-items    : center;
    justify-content: center;
    border-radius  : var(--ba-radius);
    backdrop-filter: blur(2px);
}

.ba-ajax-spinner {
    width  : 38px;
    height : 38px;
    border : 4px solid #e0eaf5;
    border-top-color : #2BA8E2;
    border-radius    : 50%;
    animation: ba-spin 0.7s linear infinite;
}

@keyframes ba-spin {
    to { transform: rotate(360deg); }
}

/* Wrap needs position relative for loader to anchor */
.ba-sc-wrap {
    position: relative;
    min-height: 120px;
}

/* ══════════════════════════════════════════════════════════════════
   MINI-CART DRAWER  (v5)
   Overlay + panel lateral derecho con gradiente CORPOMEDGUA
══════════════════════════════════════════════════════════════════ */

/* ── Overlay ──────────────────────────────────────────────────── */
.ba-mc-overlay {
    display    : none;
    position   : fixed;
    inset      : 0;
    z-index    : 99998;
    background : rgba(10, 20, 50, 0.45);
    backdrop-filter: blur(2px);
    transition : opacity .28s ease;
    opacity    : 0;
}
.ba-mc-overlay.ba-mc-open {
    display : block;
    opacity : 1;
}

/* ── Drawer panel ─────────────────────────────────────────────── */
.ba-mc-drawer {
    position   : fixed;
    top        : 0;
    right      : 0;
    bottom     : 0;
    z-index    : 99999;
    width      : 380px;
    max-width  : 100vw;
    background : #ffffff;
    display    : flex;
    flex-direction : column;
    box-shadow : -6px 0 32px rgba(32,41,136,.18);
    transform  : translateX(100%);
    transition : transform .3s cubic-bezier(.4,0,.2,1);
}
.ba-mc-drawer.ba-mc-open {
    transform : translateX(0);
}

/* ── Header ───────────────────────────────────────────────────── */
.ba-mc-header {
    display         : flex;
    align-items     : center;
    justify-content : space-between;
    padding         : 18px 20px 16px;
    background      : linear-gradient(135deg, #2BA8E2 0%, #202988 100%);
    color           : #ffffff;
    flex-shrink     : 0;
}
.ba-mc-title {
    font-size   : 16px;
    font-weight : 700;
    color       : #ffffff;
    letter-spacing: .3px;
}
.ba-mc-close {
    background  : rgba(255,255,255,.18);
    border      : none;
    color       : #ffffff;
    width       : 30px;
    height      : 30px;
    border-radius: 50%;
    cursor      : pointer;
    font-size   : 16px;
    line-height : 1;
    display     : flex;
    align-items : center;
    justify-content: center;
    transition  : background .15s;
    flex-shrink : 0;
}
.ba-mc-close:hover { background: rgba(255,255,255,.32); }

/* ── Progress bar ─────────────────────────────────────────────── */
.ba-mc-progress-wrap {
    padding     : 14px 20px 12px;
    background  : #f8faff;
    border-bottom: 1px solid #e8eef5;
    flex-shrink : 0;
}
.ba-mc-progress-msg {
    font-size   : 12px;
    font-weight : 600;
    color       : #1a2a3a;
    margin-bottom: 8px;
    line-height : 1.4;
}
.ba-mc-progress-msg em {
    font-style  : normal;
    color       : #2BA8E2;
    font-weight : 700;
}
.ba-mc-progress-msg.ba-mc-free {
    color       : #202988;
}
.ba-mc-progress-bar {
    height      : 8px;
    background  : #dde8f5;
    border-radius: 8px;
    overflow    : hidden;
}
.ba-mc-progress-fill {
    height      : 100%;
    border-radius: 8px;
    background  : linear-gradient(90deg, #2BA8E2 0%, #202988 100%);
    transition  : width .45s cubic-bezier(.4,0,.2,1);
    min-width   : 4px;
}

/* ── Items list ───────────────────────────────────────────────── */
.ba-mc-items {
    flex        : 1;
    overflow-y  : auto;
    padding     : 8px 0;
}
.ba-mc-empty {
    padding     : 40px 20px;
    text-align  : center;
    color       : #9aabbd;
    font-size   : 14px;
}

/* ── Single item ──────────────────────────────────────────────── */
.ba-mc-item {
    display     : flex;
    align-items : flex-start;
    gap         : 12px;
    padding     : 12px 20px;
    border-bottom: 1px solid #f0f5fa;
}
.ba-mc-item:last-child { border-bottom: none; }

.ba-mc-item-img {
    width       : 58px;
    height      : 58px;
    object-fit  : contain;
    border-radius: 6px;
    border      : 1px solid #e8eef5;
    background  : #f8faff;
    flex-shrink : 0;
}
.ba-mc-item-info {
    flex        : 1;
    min-width   : 0;
}
.ba-mc-item-name {
    font-size   : 13px;
    font-weight : 600;
    color       : #1a2a3a;
    line-height : 1.35;
    margin-bottom: 4px;
    display     : -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow    : hidden;
}
.ba-mc-item-meta {
    display     : flex;
    align-items : center;
    gap         : 8px;
    font-size   : 12px;
    color       : #6b7a8d;
}
.ba-mc-item-qty {
    background  : #eef3ff;
    color       : #202988;
    border-radius: 4px;
    padding     : 1px 7px;
    font-weight : 700;
    font-size   : 11px;
}
.ba-mc-item-price {
    font-size   : 13px;
    font-weight : 700;
    color       : #202988;
    text-align  : right;
    white-space : nowrap;
    flex-shrink : 0;
    margin-top  : 2px;
}

/* ── Footer ───────────────────────────────────────────────────── */
.ba-mc-footer {
    padding     : 16px 20px 20px;
    border-top  : 1px solid #e8eef5;
    background  : #fff;
    flex-shrink : 0;
    display     : flex;
    flex-direction: column;
    gap         : 10px;
}
.ba-mc-total-row {
    display     : flex;
    justify-content: space-between;
    align-items : center;
    font-size   : 14px;
    font-weight : 700;
    color       : #1a2a3a;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef3ff;
}
.ba-mc-total-val {
    font-size   : 16px;
    color       : #202988;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.ba-mc-btn {
    display     : block;
    width       : 100%;
    text-align  : center;
    padding     : 13px 20px;
    border-radius: 10px;
    font-size   : 14px;
    font-weight : 700;
    text-decoration: none !important;
    cursor      : pointer;
    transition  : opacity .18s ease, box-shadow .18s ease;
    border      : none;
    box-sizing  : border-box;
}
.ba-mc-btn--primary {
    background  : linear-gradient(135deg, #2BA8E2 0%, #202988 100%) !important;
    color       : #ffffff !important;
    box-shadow  : 0 3px 12px rgba(32,41,136,.25);
}
.ba-mc-btn--primary:hover,
.ba-mc-btn--primary:focus,
.ba-mc-btn--primary:active,
.ba-mc-btn--primary:visited {
    background  : linear-gradient(135deg, #2BA8E2 0%, #202988 100%) !important;
    color       : #ffffff !important;
    opacity     : .88 !important;
    text-decoration: none !important;
}
.ba-mc-btn--secondary {
    background  : transparent !important;
    color       : #2BA8E2 !important;
    border      : 2px solid #2BA8E2 !important;
}
.ba-mc-btn--secondary:hover,
.ba-mc-btn--secondary:focus,
.ba-mc-btn--secondary:active,
.ba-mc-btn--secondary:visited {
    background  : #eef8fd !important;
    color       : #202988 !important;
    border-color: #202988 !important;
    text-decoration: none !important;
}

/* ── "Añadiendo…" state on card button ───────────────────────── */
.ba-card-add-btn.ba-adding {
    opacity     : .65;
    pointer-events: none;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 480px) {
    .ba-mc-drawer { width: 100vw; }
}
