/* =============================================
   BASE / LAYOUT
   ============================================= */
body {
    overflow-y: scroll;
    font-family: var(--font-body-family), sans-serif;
    font-size: var(--body-txt-font-size);
    background: var(--body-bg);
}

body .bs-main {
    padding: 0;
}

.bs-main.bs-main {
    padding-top: 0;
    padding-bottom: 3rem;
}

main {
    flex: 1;
}

.container-xxl, .container {
    max-width: 1320px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-right: 15px;
    padding-left: 15px;
}


/* =============================================
   ACCESIBILIDAD - Focus visible global
   ============================================= */
*:focus-visible {
  outline: 2px solid #66a9f7 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 2px rgba(0, 95, 204, 0.15) !important;
  transition: box-shadow 0.15s ease, outline-color 0.15s ease;
}

/* Quitar en click de mouse (funciona para links, botones, etc.) */
*:focus:not(:focus-visible) {
  outline: none !important;
  box-shadow: none !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):focus-visible,
textarea:focus-visible,
select:focus-visible,
[contenteditable]:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}
/* =============================================
   TÍTULOS
   ============================================= */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-title-family);
}

.bs-title-home {
    font-size: var(--home-title-size);
    color: var(--home-title-color);
    text-transform: var(--home-title-transform);
    font-weight: var(--home-title-weight);
    display: flex;
    align-items: center;
    text-align: center;
    justify-content: center;
    padding: 2rem 0 1rem;
    white-space: nowrap;
}

.bs-title-home::before,
.bs-title-home::after,
.bs-cart-related__title::before,
.bs-cart-related__title::after,
.bs-product-suggestions__title::before,
.bs-product-suggestions__title::after {
    content: " ";
    display: block;
    height: 1px;
    width: 100%;
    background: linear-gradient(90deg, #fff 0%, var(--home-title-decoration-color) 50%, #fff 100%);
}

.bs-title,
.bs-title:hover {
    color: var(--home-title-color);
    text-transform: var(--title-transform);
    font-weight: var(--title-weight);
    font-family: var(--font-title-info2-home);
    display: flex;
    align-items: center;
    text-align: center;
    justify-content: center;
    padding: 2rem 0 1rem;
    white-space: nowrap; /* texto en 1 linea */
}

/* =============================================
   INPUTS / FORMULARIOS
   ============================================= */
.form-control {
    border-radius: var(--default-border-radius);
    border-color: var(--input-border-color);
    color: var(--input-txt-color);
    background: var(--input-bg-color);
}

.form-control option:hover {
    background: var(--primary-color);
}

.custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--primary-contrast);
    box-shadow: none;
}

.custom-control-input.is-invalid ~ .custom-control-label,
.was-validated .custom-control-input:invalid ~ .custom-control-label {
    font-weight: var(--font-bold);
}

.custom-control-input.is-invalid ~ .custom-control-label::before,
.was-validated .custom-control-input:invalid ~ .custom-control-label::before {
    border-width: 2px;
}

.custom-control-input.is-invalid ~ .custom-control-label a,
.was-validated .custom-control-input:invalid ~ .custom-control-label a {
    text-decoration: underline;
    color: #dc3545;
}

/* =============================================
   FILTER
   ============================================= */
.bs-collection-filter .panel-collapse {
    max-height: 200px;
    overflow-y: auto;
}

/* =============================================
   PAGINATION
   ============================================= */
.page-link {
    border: 0px none;
    border-radius: var(--default-border-radius);
    margin: 0 .25rem;
    color: var(--pagination-color);
    background: var(--pagination-bg);
}

.page-link:hover {
    color: var(--pagination-hover-color);
    background: var(--pagination-hover-bg);
}

.page-item.active .page-link {
    color: var(--pagination-active-color);
    background: var(--pagination-active-bg);
}

/* =============================================
   PAGINACIÓN 2.0 / SIDEBAR / INFINITE SCROLL
   ============================================= */

/* Sidebar sticky */
.sidebar-filters {
    position: relative;
}

.sidebar-filters__inner {
    position: sticky;
    top: 70px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding-bottom: 20px;
}

.sidebar-filters__inner::-webkit-scrollbar {
    width: 4px;
}

.sidebar-filters__inner::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-filters__inner::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

@media (max-width: 991.98px) {
    .sidebar-filters__inner {
        position: relative;
        top: 0;
        max-height: none;
        overflow-y: visible;
    }
}

/* Loader */
#infinite-scroll-loader {
    display: none;
    width: 20px;
    height: 20px;
    margin: 2rem auto;
    border: 2px solid #e0e0e0;
    border-top-color: #999;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

#infinite-scroll-loader.active {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Sentinel */
#scroll-sentinel {
    height: 1px;
    visibility: hidden;
}

/* Indicador de scroll */
#scroll-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 1.5rem 0;
    color: #999;
    font-size: 0.85rem;
}

#scroll-indicator svg {
    width: 24px;
    height: 24px;
    animation: bounceDown 1.5s ease-in-out infinite;
}

#scroll-indicator.active {
    display: flex;
}

#scroll-indicator.hidden {
    display: none !important;
}

@keyframes bounceDown {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    50% {
        transform: translateY(8px);
        opacity: 1;
    }
}

/* Botón cargar más */
#load-more-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 200px;
    margin: 2rem auto;
    padding: 12px 24px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 30px;
    color: #666;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#load-more-btn:hover {
    border-color: #999;
    color: #333;
    transform: translateY(2px);
}

#load-more-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

#load-more-btn:hover svg {
    transform: translateY(3px);
}

#load-more-btn.active {
    display: flex;
}

#load-more-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

#load-more-btn.loading svg {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

/* =============================================
   BADGE
   ============================================= */
.badge-primary {
    background: var(--primary-color);
    color: var(--primary-txt-color);
}

.badge-secondary {
    background: var(--secondary-color);
    color: var(--secondary-contrast);
}

.badge-warning {
    color: var(--secondary-contrast);
    background-color: var(--secondary-color);
    font-weight: var(--font-light);
}

/* =============================================
   DISCOUNT
   ============================================= */
.bs-discount {
    font-weight: var(--font-bold);
    font-size: 1rem;
}

/* =============================================
   PARCHE IMAGEN PRODUCTO
   ============================================= */
.drift-zoom-pane {
    background: white;
}

/* =============================================
   SUCURSALES
   ============================================= */
.bs-table {
    display: flex;
    flex-wrap: wrap;
}

.bs-table table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
}

.bs-table table td {
    vertical-align: top;
    border-top: 1px solid var(--gray-500);
}

.bs-table div {
    width: 50%;
}

/* =============================================
   SUCURSALES - TABLA
   ============================================= */

/* Estilos para la tabla estática */
.bs-table-sucursal-static table {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    text-align: left;
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Estilos para la tabla en el acordeón */
.bs-table-sucursal-accordion table {
    width: 100%;
    margin: 1px auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    text-align: left;
    background-color: #ffffff;
    border: 1px solid rgb(248 249 250);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Encabezado de la tabla */
.bs-table-sucursal-static thead,
.bs-table-sucursal-accordion thead {
    background-color: #f8f9fa;
    color: #333;
}

.bs-table-sucursal-static th,
.bs-table-sucursal-accordion th {
    padding: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    text-transform: capitalize;
    font-weight: bold;
}

/* Filas de la tabla */
.bs-table-sucursal-static td,
.bs-table-sucursal-accordion td {
    padding: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05); /* Borde sutil */
}

.bs-table-sucursal-static tbody tr:last-child td,
.bs-table-sucursal-accordion tbody tr:last-child td {
    border-bottom: none;
}

.bs-table-sucursal-static tbody tr:hover,
.bs-table-sucursal-accordion tbody tr:hover {
    background-color: #f5f5f5; /* Efecto hover */
    transition: background-color 0.3s ease;
}

/* Estilos para el acordeón */
.stock-accordion .stock-card {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 7px;
    margin: 8px 0;
    width: 70%;
}

.stock-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: bold;
    color: #333;
}

.stock-accordion-title {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.stock-accordion-btn {
    background-color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    color: var(--primary-contrast);
    font-size: 18px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.stock-accordion-btn:hover {
    background-color: var(--primary-hover-color);
    border-color: var(--primary-hover-color);
    color: white;
}

.stock-toggle-icon {
    font-size: 18px;
}

.collapse.show + .stock-card-header .stock-accordion-btn .stock-toggle-icon {
    content: "-";
}

.stock-card-body {
    flex: 1 1 auto;
    min-height: 1px;
    padding: 0px;
}

.stock-accordion-body {
    padding: 10px 20px;
    font-size: 14px;
    background-color: #ffffff;
    color: #333;
}

/* =============================================
   MEDIA QUERIES
   ============================================= */
@media screen and (min-width: 768px) {
    .bs-article-title::before,
    .bs-article-title::after,
    .bs-home-title::before,
    .bs-home-title::after {
        max-width: 100px;
        min-width: 40px;
    }
}

@media screen and (min-width: 1200px) {
    .container-xxl,
    .container {
        max-width: 1320px;
    }
}