/**
 * Xcel Peptides Elementor Addons — Product Grid
 * v1.5.0 — Fronteras.io
 */

.xcel-pg-wrapper { width: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif; }

/* ═══ FILTERS ═══ */

/* Outer container */
.xcel-pg-filters {
    margin-bottom: 30px;
    padding: 4px 0;
    overflow: visible;
}

/* Inner: flexbox for button layout, alignment controlled by Elementor */
.xcel-pg-filters-scroll {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.xcel-pg-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .3px;
    line-height: 1.4;
    color: #fff;
    background: #1B3A5C;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all .3s ease;
    white-space: nowrap;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.xcel-pg-filter-btn:hover { background: #2E8B57; transform: translateY(-1px); }
.xcel-pg-filter-btn.active { background: #2E8B57; color: #fff; }
.xcel-pg-filter-btn:focus-visible { box-shadow: 0 0 0 3px rgba(46,139,87,.3); }

/* ═══ TOOLBAR ═══ */
.xcel-pg-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; flex-wrap: wrap; gap: 12px; }
.xcel-pg-result-count { font-size: 14px; color: #666; margin: 0; }
.xcel-pg-sort-wrapper { display: flex; align-items: center; gap: 8px; }
.xcel-pg-sort-label { font-size: 14px; color: #333; font-weight: 500; white-space: nowrap; }
.xcel-pg-sort-select { font-size: 14px; color: #333; background: #fff; border: 1px solid #D1D5DB; border-radius: 6px; padding: 6px 32px 6px 12px; cursor: pointer; outline: none; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; min-width: 140px; }
.xcel-pg-sort-select:focus { border-color: #1B3A5C; box-shadow: 0 0 0 2px rgba(27,58,92,.15); }

/* ═══ GRID ═══ */
.xcel-pg-products-container { position: relative; }
.xcel-pg-products-grid { display: grid; gap: 30px 24px; }
.xcel-pg-products-grid.xcel-pg-cols-2 { grid-template-columns: repeat(2,1fr); }
.xcel-pg-products-grid.xcel-pg-cols-3 { grid-template-columns: repeat(3,1fr); }
.xcel-pg-products-grid.xcel-pg-cols-4 { grid-template-columns: repeat(4,1fr); }
.xcel-pg-products-grid.xcel-pg-cols-5 { grid-template-columns: repeat(5,1fr); }
.xcel-pg-products-grid.xcel-pg-cols-6 { grid-template-columns: repeat(6,1fr); }

/* ═══ PRODUCT CARD ═══ */
.xcel-pg-product-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
    transition: opacity .4s ease, transform .4s ease, box-shadow .3s ease;
    padding: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    contain: layout style;
    content-visibility: auto;
    contain-intrinsic-size: auto 350px;
}
.xcel-pg-product-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,.08); transform: translateY(-2px); will-change: transform; }
.xcel-pg-product-card.is-featured { background: #E8F5E9; border-color: #2E8B57; }
.xcel-pg-product-card.out-of-stock { opacity: .6; }

.xcel-pg-product-link { text-decoration: none; color: inherit; display: block; }
.xcel-pg-info-link { text-decoration: none; color: inherit; display: block; }

/* ═══ PRODUCT IMAGE ═══ */
.xcel-pg-product-image {
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #F3F4F6;
    border-radius: 8px;
    padding: 12px;
    position: relative;
}

.xcel-pg-product-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform .4s ease;
    display: block;
}

.xcel-pg-product-card:hover .xcel-pg-product-image img { transform: scale(1.05); }

/* ═══ PRODUCT INFO ═══ */
.xcel-pg-product-info { padding: 16px 4px 4px 4px; display: flex; flex-direction: column; flex-grow: 1; }
.xcel-pg-product-category { font-size: 11px; font-weight: 500; color: #999; text-transform: capitalize; letter-spacing: .3px; margin-bottom: 4px; line-height: 1.3; }
.xcel-pg-product-title { font-size: 15px; font-weight: 700; color: #1a1a1a; margin: 0 0 12px 0; line-height: 1.35; transition: color .2s ease; flex-grow: 1; }
.xcel-pg-product-card:hover .xcel-pg-product-title { color: #1B3A5C; }

/* ═══ BOTTOM: Price + QTY + ATC ═══ */
.xcel-pg-product-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: auto; gap: 8px; }
.xcel-pg-product-price { font-size: 22px; font-weight: 800; color: #1a1a1a; line-height: 1; white-space: nowrap; }
.xcel-pg-product-price sup { font-size: 12px; font-weight: 600; vertical-align: super; position: relative; top: -2px; }

.xcel-pg-atc-area { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ═══ QUANTITY SELECTOR ═══ */
.xcel-pg-qty-wrap {
    display: inline-flex;
    align-items: center;
    background: #F3F4F6;
    border-radius: 6px;
    overflow: hidden;
    height: 32px;
    border: 1px solid #E5E7EB;
}

.xcel-pg-qty-btn {
    width: 28px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: background .15s ease;
    padding: 0;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
}

.xcel-pg-qty-btn:hover { background: #E5E7EB; }

.xcel-pg-qty-input {
    width: 32px;
    height: 100%;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    outline: none;
    -moz-appearance: textfield;
    padding: 0;
}
.xcel-pg-qty-input::-webkit-outer-spin-button,
.xcel-pg-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ═══ HEXAGONAL ATC ═══ */
.xcel-pg-atc-hexagon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    flex-shrink: 0;
    transition: transform .25s ease;
    z-index: 1;
}
.xcel-pg-atc-hexagon:hover { transform: scale(1.12); }
.xcel-pg-atc-hexagon:active { transform: scale(.95); }
.xcel-pg-atc-hexagon[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }

.xcel-pg-hex-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.xcel-pg-hex-bg polygon { fill: #1B3A5C; transition: fill .25s ease; }
.xcel-pg-atc-hexagon:hover .xcel-pg-hex-bg polygon { fill: #2E8B57; }
.xcel-pg-atc-hexagon.added .xcel-pg-hex-bg polygon { fill: #2E8B57; }

.xcel-pg-hex-icon { position: relative; z-index: 1; width: 16px; height: 16px; color: #fff; stroke: #fff; }

.xcel-pg-atc-hexagon.adding { pointer-events: none; animation: xcel-pulse .6s ease infinite; }
@keyframes xcel-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* ═══ TEXT ATC BUTTON ═══ */
.xcel-pg-atc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #1B3A5C;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all .25s ease;
    white-space: nowrap;
    outline: none;
    letter-spacing: .3px;
    line-height: 1.4;
    flex-shrink: 0;
}
.xcel-pg-atc-btn:hover { background: #2E8B57; transform: translateY(-1px); }
.xcel-pg-atc-btn:active { transform: scale(.97); }
.xcel-pg-atc-btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }
.xcel-pg-atc-btn.adding { pointer-events: none; opacity: .7; }
.xcel-pg-atc-btn.added { background: #2E8B57; }

.xcel-pg-atc-btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ═══ SELECT OPTIONS (variable products) ═══ */
.xcel-pg-atc-btn.xcel-pg-select-options { background: #2E8B57; }
.xcel-pg-atc-btn.xcel-pg-select-options:hover { background: #247048; }
.xcel-pg-atc-hexagon.xcel-pg-select-options .xcel-pg-hex-bg polygon { fill: #2E8B57; }
.xcel-pg-atc-hexagon.xcel-pg-select-options:hover .xcel-pg-hex-bg polygon { fill: #247048; }

/* ═══ SHOW MORE ═══ */
.xcel-pg-load-more-wrap { display: flex; justify-content: center; margin-top: 30px; }
.xcel-pg-load-more-btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 40px; font-size: 14px; font-weight: 600; color: #fff; background: #1B3A5C; border: none; border-radius: 6px; cursor: pointer; transition: all .3s ease; letter-spacing: .3px; outline: none; }
.xcel-pg-load-more-btn:hover { background: #2E8B57; transform: translateY(-1px); }
.xcel-pg-load-more-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.xcel-pg-load-more-link { text-decoration: none; }

/* ═══ LOADING ═══ */
.xcel-pg-loading-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,.7); z-index: 10; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.xcel-pg-spinner { width: 40px; height: 40px; border: 3px solid #E5E7EB; border-top-color: #1B3A5C; border-radius: 50%; animation: xcel-spin .8s linear infinite; }
@keyframes xcel-spin { to { transform: rotate(360deg); } }

.xcel-pg-no-products { text-align: center; padding: 60px 20px; color: #999; font-size: 16px; grid-column: 1 / -1; }

/* AJAX animations */
.xcel-pg-products-grid.is-loading { opacity: .4; pointer-events: none; transition: opacity .2s ease; }
.xcel-pg-products-grid.is-loaded { animation: xcel-fadeIn .4s ease forwards; }
@keyframes xcel-fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Load more card enter animation */
.xcel-pg-product-card.xcel-pg-card-enter { opacity: 0; transform: translateY(10px); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1024px) {
    .xcel-pg-products-grid.xcel-pg-cols-4,
    .xcel-pg-products-grid.xcel-pg-cols-5,
    .xcel-pg-products-grid.xcel-pg-cols-6 { grid-template-columns: repeat(3,1fr); }
    .xcel-pg-products-grid[data-cols-tablet="1"] { grid-template-columns: 1fr; }
    .xcel-pg-products-grid[data-cols-tablet="2"] { grid-template-columns: repeat(2,1fr); }
    .xcel-pg-products-grid[data-cols-tablet="3"] { grid-template-columns: repeat(3,1fr); }
    .xcel-pg-products-grid[data-cols-tablet="4"] { grid-template-columns: repeat(4,1fr); }
    .xcel-pg-product-image { height: 180px; }

    .xcel-pg-filters-scroll { gap: 6px; }
    .xcel-pg-filter-btn { padding: 7px 18px; font-size: 12px; }
}

@media (max-width: 767px) {
    .xcel-pg-products-grid { grid-template-columns: repeat(2,1fr) !important; gap: 20px 12px; }
    .xcel-pg-products-grid[data-cols-mobile="1"] { grid-template-columns: 1fr !important; }
    .xcel-pg-product-card { padding: 10px; transition: none; }
    .xcel-pg-product-card:hover { transform: none; box-shadow: none; }
    .xcel-pg-product-image { height: 150px; padding: 8px; }
    .xcel-pg-product-image img { transition: none; }
    .xcel-pg-product-card:hover .xcel-pg-product-image img { transform: none; }
    .xcel-pg-product-title { font-size: 13px; }
    .xcel-pg-product-price { font-size: 18px; }
    .xcel-pg-atc-hexagon { width: 34px; height: 34px; }
    .xcel-pg-hex-icon { width: 13px; height: 13px; }
    .xcel-pg-qty-wrap { display: none; }
    .xcel-pg-atc-btn { font-size: 11px; padding: 6px 10px; }
    .xcel-pg-atc-btn-icon { width: 13px; height: 13px; }

    .xcel-pg-filters-scroll { gap: 6px; justify-content: center; }
    .xcel-pg-filter-btn { padding: 6px 14px; font-size: 11px; transition: background .2s ease; }

    .xcel-pg-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
    .xcel-pg-sort-wrapper { width: 100%; }
    .xcel-pg-sort-select { flex: 1; }
    .xcel-pg-load-more-btn { width: 100%; }
}

@media (max-width: 480px) {
    .xcel-pg-product-image { height: 130px; }
}
