/* ==========================================================================
   GentsTime — WooCommerce Product Cards
   ========================================================================== */

/* ══════════════════════════════════════════════════════════════════
   RESET WC DEFAULT FLOATS & WIDTHS ON THE LOOP
   ══════════════════════════════════════════════════════════════════ */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after {
    display: none !important;
}

.woocommerce ul.products,
.woocommerce-page ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px !important;
    list-style: none !important;
    padding: 0 !important;
    float: none !important;
    clear: both;
}

/* ══════════════════════════════════════════════════════════════════
   CARD SHELL
   ══════════════════════════════════════════════════════════════════ */
li.gt-product-card {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--bg-body) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    overflow: hidden !important;
    width: auto !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: border-color 0.28s ease;
}

li.gt-product-card:hover {
    border-color: var(--border-dark);
}

/* ══════════════════════════════════════════════════════════════════
   IMAGE AREA
   ══════════════════════════════════════════════════════════════════ */
.gt-card-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    background: var(--bg-section);
    flex-shrink: 0;
}

.gt-card-img-link {
    display: block;
    width: 100%;
    height: 100%;
    line-height: 0;
}

.gt-card-media .gt-card-img,
.gt-card-media img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    transition: transform 0.5s ease, opacity 0.4s ease;
}

.gt-card-img--hover {
    position: absolute !important;
    inset: 0;
    opacity: 0;
    transition: 0.5s;
}

li.gt-product-card:hover .gt-card-img--primary {
    opacity: 0;
    transform: scale(1.06);
}

li.gt-product-card:hover .gt-card-img--hover {
    opacity: 1;
    transform: scale(1.2);
}

/* ── Badge ───────────────────────────────────────────────────────── */
.gt-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1;
    pointer-events: none;
}

.gt-badge--sale {
    background: #ef4444;
    color: #fff;
}

.gt-badge--new {
    background: var(--brand);
    color: #fff;
}

.gt-badge--hot {
    background: #f97316;
    color: #fff;
}

/* ── Add-to-cart tray ────────────────────────────────────────────── */
.gt-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.gt-card-actions .add_to_cart_button {
    width: 58px !important;
    flex: none;
}

.gt-card-actions .gt-buy-btn {
    flex: 1 !important;
}

/* shared button base */
.gt-atc-btn,
.gt-buy-btn,
.gt-view-btn {
    flex: 1;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 40px;
    padding: 12px 10px;
    border: none !important;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background 0.2s ease, opacity 0.2s ease, transform 0.15s ease !important;
    line-height: 1;
    /* reset native button styles */
    -webkit-appearance: none;
    appearance: none;
    background-clip: padding-box;
    font-family: inherit;
}

.gt-atc-btn svg,
.gt-buy-btn svg {
    flex-shrink: 0;
    fill: currentColor;
}

/* Add to Cart — outlined green */
.gt-atc-btn {
    background: var(--bg-brand) !important;
    color: var(--brand) !important;
    border: 1.5px solid var(--brand) !important;
}

.gt-atc-btn:hover {
    background: var(--text-primary) !important;
    color: #fff !important;
    border-color: var(--text-primary);
}

.gt-atc-btn:hover svg {
    fill: #fff;
}

/* Buy Now — solid green */
.gt-buy-btn {
    background: var(--brand) !important;
    color: #fff !important;
    box-shadow: var(--shadow-md);
}

.gt-buy-btn:hover {
    background: var(--brand-hover) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

/* View Product (for variable/out-of-stock) */
.gt-card-actions--single .gt-view-btn {
    background: var(--brand) !important;
    color: #fff !important;
}

/* Loading state */
.gt-atc-btn.gt-loading,
.gt-buy-btn.gt-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* In Cart state */
.gt-atc-btn.gt-in-cart {
    background: var(--bg-brand) !important;
    color: var(--brand) !important;
    border: 1.5px solid var(--brand) !important;
    pointer-events: not-allowed;
    cursor: not-allowed;
}
.gt-atc-btn.gt-in-cart:hover{
    color: var(--brand) !important;
    fill: var(--brand);
}

/* Suppress WC's injected view-cart link */
.gt-card-actions .added_to_cart {
    display: none !important;
}

/* ══════════════════════════════════════════════════════════════════
   CARD BODY
   ══════════════════════════════════════════════════════════════════ */
.gt-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 14px 14px;
    flex: 1;
}

.gt-card-cat {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--brand);
    line-height: 1;
}

.gt-card-title {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.45;
    text-decoration: none !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.gt-card-title:hover {
    color: var(--brand-hover);
}

/* Stars */
.gt-card-rating {
    display: flex;
    align-items: center;
    gap: 2px;
}

.gt-star {
    width: 16px;
    height: 16px;
    fill: #d1d5db;
    flex-shrink: 0;
}

.gt-star--on {
    fill: #f59e0b;
}

.gt-card-rating-count {
    font-size: 14px;
    color: var(--text-secondary);
    margin-left: 3px;
}

/* Price */
.gt-card-price {
    margin-top: auto;
}

.gt-card-price .price {
    display: flex !important;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1;
}

.gt-card-price .woocommerce-Price-amount {
    font-size: 15.5px;
    font-weight: 800;
    color: var(--text-primary);
}

.gt-card-price del {
    opacity: 0.6;
}

.gt-card-price del .woocommerce-Price-amount {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.gt-card-price ins {
    text-decoration: none;
}

.gt-card-price ins .woocommerce-Price-amount {
    color: #ef4444;
}

/* ══════════════════════════════════════════════════════════════════
   SUPPRESS DEFAULT WC OUTPUT rendered outside our markup
   ══════════════════════════════════════════════════════════════════ */
li.gt-product-card>a.woocommerce-LoopProduct-link,
li.gt-product-card>.onsale,
li.gt-product-card>h2.woocommerce-loop-product__title,
li.gt-product-card>.star-rating,
li.gt-product-card>.price {
    display: none !important;
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 1080px) {

    .woocommerce ul.products,
    .woocommerce-page ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 640px) {

    .woocommerce ul.products,
    .woocommerce-page ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .gt-card-body {
        padding: 10px 10px 12px;
        gap: 4px;
    }

    .gt-card-title {
        font-size: 13px;
    }

    .gt-card-price .woocommerce-Price-amount {
        font-size: 13.5px;
    }

    .gt-atc-btn,
    .gt-buy-btn,
    .gt-view-btn {
        height: 36px;
        font-size: 11px;
        padding: 0 8px;
    }
}

@media (max-width: 368px) {

    .woocommerce ul.products,
    .woocommerce-page ul.products {
        grid-template-columns: 1fr !important;
    }
}

/* ══════════════════════════════════════════════════════════════════
   VARIABLE PRODUCT POPUP
   ══════════════════════════════════════════════════════════════════ */
#gt-var-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
}

#gt-var-popup.is-open {
    display: block;
}

.gt-var-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

.gt-var-modal {
    position: absolute;
    top: 47%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-body);
    border-radius: var(--radius);
    width: min(520px, 95vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.gt-var-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-secondary);
    z-index: 1;
    padding: 4px 8px;
}

.gt-var-close:hover {
    color: var(--text-primary);
}

.gt-var-body {
    display: flex;
    gap: 20px;
    padding: 24px;
}

.gt-var-img {
    width: 160px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 3/4;
    background: var(--bg-section);
}

.gt-var-img img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
}

.gt-var-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.gt-var-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

.gt-var-price {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

.gt-var-price del {
    opacity: 0.55;
    font-size: 14px;
    font-weight: 500;
    margin-right: 4px;
}

.gt-var-price ins {
    text-decoration: none;
    color: #ef4444;
}

.gt-var-attr {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gt-var-attr-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.gt-var-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gt-swatch {
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.gt-swatch:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.gt-swatch.active {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.gt-swatch--unavailable {
    position: relative;
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    color: var(--text-secondary);
}

/* .gt-swatch--unavailable::before,
.gt-swatch--unavailable::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110%;
    height: 1.5px;
    background: currentColor;
    transform-origin: center;
} */

/* .gt-swatch--unavailable::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.gt-swatch--unavailable::after {
    transform: translate(-50%, -50%) rotate(-45deg);
} */

.gt-var-confirm {
    margin-top: auto;
    width: 100%;
    height: 44px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.gt-var-confirm:hover:not(:disabled) {
    background: var(--brand-hover);
}

.gt-var-confirm:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Loading spinner */
.gt-var-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 60px 0;
}

.gt-var-loading span {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: gt-spin 0.7s linear infinite;
}

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

.gt-var-err {
    padding: 30px 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

.gt-var-err a {
    color: var(--brand);
}

.gt-popup-notice {
    display: none;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

.gt-popup-notice[data-type="error"] {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.gt-popup-notice[data-type="success"] {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

@media (max-width: 480px) {
    .gt-var-body {
        flex-direction: column;
        padding: 15px;
    }

    .gt-var-img {
        width: 100%;
        height: 400px;
        aspect-ratio: 16/9;
    }
}
