/**
 * Product Card Design 1
 * Matches Reference 1 (Normal State) and Reference 2 (Hover State)
 * Responsive, accessible, and supports Theme Primary Color
 */

:root {
    --nt-d1-primary: var(--color-primary, #eb5e28);
    --nt-d1-primary-hover: #d85415;
    --nt-d1-text-dark: #111827;
    --nt-d1-text-muted: #4b5563;
    --nt-d1-border: #f0f0f0;
    --nt-d1-bg: #ffffff;
    --nt-d1-radius: 12px;
    --nt-d1-btn-radius: 9999px;
    --nt-d1-img-fit: contain;

    /* 15 Product Card Design 1 Spacing & Layout Controls */
    --nt-d1-card-padding: 0 18px 20px 18px;
    --nt-d1-img-area-height: 165px;
    --nt-d1-img-offset-y: -82px;
    --nt-d1-img-title-gap: 14px;
    --nt-d1-title-margin-bottom: 6px;
    --nt-d1-title-line-height: 1.35;
    --nt-d1-title-desc-gap: 0px;
    --nt-d1-desc-line-height: 1.42;
    --nt-d1-desc-margin-bottom: 10px;
    --nt-d1-desc-var-gap: 0px;
    --nt-d1-var-rating-gap: 8px;
    --nt-d1-rating-price-gap: 6px;
    --nt-d1-price-gap: 8px;
    --nt-d1-price-btn-gap: 14px;
    --nt-d1-btn-padding: 10px 14px 10px 20px;
    --nt-d1-btn-height: 44px;
    --nt-d1-card-bottom-padding: 20px;
    --nt-d1-grid-gap: 24px;
}

/* Card Root Container */
/* Card Root Container (Floating Shoe 50% above White Card Info Area matching Reference) */
.nt-card-d1 {
    position: relative;
    background: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 14px;
    padding: var(--nt-d1-card-padding, 0 18px 20px 18px);
    padding-bottom: var(--nt-d1-card-bottom-padding, 20px);
    display: flex;
    flex-direction: column;
    height: var(--nt-d1-card-height, auto);
    min-height: var(--nt-d1-card-min-height, 0);
    max-height: var(--nt-d1-card-max-height, none);
    margin-top: 85px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    overflow: visible;
    box-sizing: border-box;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
}

.productItem.nt-card-d1 {
    height: var(--nt-d1-card-height, auto);
    min-height: var(--nt-d1-card-min-height, 0);
    max-height: var(--nt-d1-card-max-height, none);
}

/* Flex Column Containers (Ensure equal heights across row without double-counting top margin) */
.nt-bestsellers-section .row > [class*="col-"],
.row > [class*="col-"]:has(> .nt-card-d1) {
    display: flex;
    flex-direction: column;
}

[class*="col-"] > .nt-card-d1,
.nt-carousel-item > .nt-card-d1 {
    flex: var(--nt-d1-card-flex, 1 1 auto);
    height: var(--nt-d1-card-height, auto);
    min-height: var(--nt-d1-card-min-height, 0);
    max-height: var(--nt-d1-card-max-height, none);
}

/* Responsive Card Heights for Tablet & Mobile when configured */
@media (max-width: 991px) and (min-width: 577px) {
    .nt-card-d1,
    .productItem.nt-card-d1,
    [class*="col-"] > .nt-card-d1,
    .nt-carousel-item > .nt-card-d1 {
        height: var(--nt-d1-card-height-tablet, var(--nt-d1-card-height, auto));
    }
}

@media (max-width: 576px) {
    .nt-card-d1,
    .productItem.nt-card-d1,
    [class*="col-"] > .nt-card-d1,
    .nt-carousel-item > .nt-card-d1 {
        height: var(--nt-d1-card-height-mobile, var(--nt-d1-card-height, auto));
    }
}

.nt-card-d1:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    border-color: #e2e8f0;
}

/* Card Typography & Controls inside White Info Area */
.nt-card-d1 .nt-d1-title a {
    color: #111827 !important;
}

.nt-card-d1 .nt-d1-price {
    color: #111827 !important;
}

.nt-card-d1 .nt-d1-desc {
    color: #4b5563 !important;
}

.nt-card-d1 .nt-d1-var-label {
    color: #111827 !important;
}

.nt-card-d1 .nt-d1-size-box:not(.active) {
    background: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #111827 !important;
}

/* Section headroom helper for floating card images (prevents collision with headers) */
.nt-bestsellers-section .row,
.nt-carousel-track,
.product-slider-wrapper,
.nt-products-grid {
    padding-top: 35px;
}

/* ==================== THUMBNAIL AREA (50% FLOATING SHOE) ==================== */
.nt-d1-thumb-wrap {
    position: relative;
    width: 100%;
    height: var(--nt-d1-img-area-height, 165px);
    margin-top: var(--nt-d1-img-offset-y, -82px);
    background: transparent !important;
    border: none !important;
    border-radius: 0;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--nt-d1-img-title-gap, 14px);
    z-index: 3;
}

.nt-d1-thumb-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    text-decoration: none;
    overflow: visible;
}

.nt-d1-thumb-img {
    width: 100%;
    max-width: 96%;
    height: 160px;
    object-fit: contain;
    object-position: center;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.14));
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform-origin: center center;
    will-change: transform;
}

.nt-card-d1:hover .nt-d1-thumb-img {
    transform: scale(1.05) translateY(-2px);
}

/* "New" Badge (Floating at top-left relative to floating shoe, matching Reference) */
.nt-d1-badge {
    position: absolute;
    top: 6px;
    left: 8px;
    background: var(--nt-d1-primary);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    padding: 3px 8px;
    border-radius: 6px;
    z-index: 5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    text-transform: capitalize;
    letter-spacing: normal;
    pointer-events: none;
}

/* ==================== HOVER & MOBILE ACTION BUTTONS ==================== */
/* Only 2 actions: Wishlist & Quick View (Compare completely removed) */
.nt-d1-actions {
    position: absolute;
    top: 6px;
    right: 8px;
    display: flex;
    z-index: 10;
}

.nt-d1-action-btn {
    border-radius: 50%;
    background: #d0d3d8;
    color: #333333;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
}

/* Desktop: Vertical Stack, Smooth Right-to-Left Slide on Hover & Focus */
@media (min-width: 768px) {
    .nt-d1-actions {
        flex-direction: column;
        gap: 8px;
        pointer-events: none;
    }

    /* Normal / Hidden State: Shifted to the right (+14px), 0 opacity, pointer-events: none */
    /* When mouse leaves, reverse animation slides left to right with ease-in (200-250ms) */
    .nt-d1-action-btn {
        width: 34px;
        height: 34px;
        font-size: 16px;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateX(14px);
        transition: opacity 0.22s ease-in, transform 0.22s ease-in, background-color 0.2s ease, color 0.2s ease;
    }

    /* Stagger on exit (mouse leave): Quick View exits first, Wishlist follows */
    .nt-d1-action-btn:nth-child(1) { transition-delay: 0.04s; }
    .nt-d1-action-btn:nth-child(2) { transition-delay: 0.00s; }

    /* Hover State: Slide in from right to left (translateX(0)), ease-out, staggered */
    /* Focus-within removed so clicking wishlist doesn't permanently leave buttons open */
    .nt-card-d1:hover .nt-d1-actions {
        pointer-events: auto;
    }

    .nt-card-d1:hover .nt-d1-action-btn,
    .nt-card-d1 .nt-d1-action-btn:focus-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0);
        transition: opacity 0.25s ease-out, transform 0.25s ease-out, background-color 0.2s ease, color 0.2s ease;
    }

    /* Stagger on enter (hover active): Wishlist enters first at 0s, Quick View follows at 0.05s */
    .nt-card-d1:hover .nt-d1-action-btn:nth-child(1),
    .nt-card-d1 .nt-d1-action-btn:nth-child(1):focus-visible {
        transition-delay: 0.00s;
    }
    .nt-card-d1:hover .nt-d1-action-btn:nth-child(2),
    .nt-card-d1 .nt-d1-action-btn:nth-child(2):focus-visible {
        transition-delay: 0.05s;
    }

    .nt-d1-action-btn:hover {
        background: var(--nt-d1-primary);
        color: #ffffff;
        transform: scale(1.08);
    }
}

/* Mobile & Touch (<768px): Always visible by default, single horizontal row in upper right corner */
@media (max-width: 767px) {
    .nt-d1-actions {
        top: 6px !important;
        right: 6px !important;
        flex-direction: row !important;
        gap: 6px !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: none !important;
    }

    .nt-d1-action-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 15px !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: none !important;
        background: rgba(208, 211, 216, 0.95) !important;
        color: #333333 !important;
        transition: background-color 0.15s ease, color 0.15s ease !important;
    }

    .nt-d1-action-btn:active,
    .nt-d1-action-btn:hover {
        background: var(--nt-d1-primary) !important;
        color: #ffffff !important;
    }
}

/* Active Wishlist State */
.nt-d1-action-btn.active-wishlist {
    color: #ffffff !important;
    background: #ef4444 !important;
}
.nt-d1-action-btn.active-wishlist:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
}

/* ==================== CARD BODY ==================== */
.nt-d1-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    height: var(--nt-d1-body-height, auto);
    min-height: 0;
    overflow: visible;
}

/* Product Title (Truncated cleanly) */
.nt-d1-title {
    font-size: 16px;
    font-weight: 700;
    line-height: var(--nt-d1-title-line-height, 1.35);
    margin: 0 0 var(--nt-d1-title-margin-bottom, 6px) 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 42px;
}

.nt-d1-title a {
    color: var(--nt-d1-text-dark);
    text-decoration: none;
    transition: color 0.2s ease;
}

.nt-d1-title a:hover {
    color: var(--nt-d1-primary);
}

/* Short Description (Clean 2-line truncation) */
.nt-d1-desc {
    font-size: 13px;
    line-height: var(--nt-d1-desc-line-height, 1.42);
    color: var(--nt-d1-text-muted);
    margin-top: var(--nt-d1-title-desc-gap, 0px);
    margin-bottom: var(--nt-d1-desc-margin-bottom, 10px);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 38px;
}

/* Variations (Size: [36] [34] from Reference 1) */
.nt-d1-variations {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: var(--nt-d1-desc-var-gap, 0px);
    margin-bottom: var(--nt-d1-var-rating-gap, 8px);
    flex-wrap: wrap;
    font-size: 12px;
}

.nt-d1-var-label {
    font-weight: 700;
    font-size: 13px;
    color: var(--nt-d1-text-dark);
    margin-right: 2px;
}

.bestsellers-dark-section .nt-d1-var-label,
.nt-theme-dark .nt-d1-var-label {
    color: #e4e4e7;
}

.nt-d1-size-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    min-width: 26px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #111827;
    cursor: default;
    transition: border-color 0.2s, background-color 0.2s;
}

.nt-d1-size-box:hover {
    border-color: var(--nt-d1-primary);
    color: var(--nt-d1-primary);
}

/* Rating Stars (5 grey/amber stars from Reference 1) */
.nt-d1-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: var(--nt-d1-rating-price-gap, 6px);
    color: #9ca3af;
    font-size: 14px;
}

.nt-d1-rating.is-rated {
    color: #f59e0b;
}

/* Price Wrap */
.nt-d1-price-wrap {
    display: flex;
    align-items: baseline;
    gap: var(--nt-d1-price-gap, 8px);
    margin-bottom: var(--nt-d1-price-btn-gap, 14px);
    /* Notice: margin-top: auto removed to close gap between stars and price */
}

.nt-d1-price {
    font-size: 20px;
    font-weight: 800;
    color: #000000;
    letter-spacing: -0.2px;
}

.nt-d1-price-del {
    font-size: 13px;
    font-weight: 500;
    color: #e53e3e !important; /* Red strikethrough matching Reference 2 */
    text-decoration: line-through;
    margin-left: 6px;
}

/* ==================== ADD TO CART BUTTON ==================== */
/* Matches Reference 1: Orange rounded pill button with circular white shopping cart icon */
.nt-d1-btn-cart {
    margin-top: auto;
    width: 100%;
    background: var(--nt-d1-primary);
    color: #ffffff !important;
    border: none;
    border-radius: var(--nt-d1-btn-radius, 9999px);
    padding: var(--nt-d1-btn-padding, 10px 14px 10px 20px);
    min-height: var(--nt-d1-btn-height, 44px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(235, 94, 40, 0.35);
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.nt-d1-btn-cart:hover {
    background: var(--nt-d1-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(235, 94, 40, 0.45);
    color: #ffffff !important;
}

.nt-d1-btn-cart-text {
    flex-grow: 1;
    text-align: center;
    padding-left: 10px;
    white-space: nowrap !important;
    line-height: 1.2;
}

.nt-d1-btn-cart-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 15px;
    flex-shrink: 0;
    transition: transform 0.2s ease, background 0.2s ease;
}

.nt-d1-btn-cart:hover .nt-d1-btn-cart-icon {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 0.42);
}

/* Out of Stock State */
.nt-d1-btn-cart.is-stock-out {
    background: #9ca3af !important;
    box-shadow: none !important;
    cursor: not-allowed;
    transform: none !important;
}

.nt-d1-btn-cart.is-stock-out .nt-d1-btn-cart-icon {
    background: rgba(255, 255, 255, 0.2);
}

/* Grid Alignment & Responsive Adjustments */
@media (max-width: 767px) {
    .nt-card-d1 {
        padding: 0 12px 14px 12px;
    }
    .nt-d1-btn-cart {
        padding: 6px 8px 6px 12px;
        min-height: 38px;
        font-size: 11.5px;
        letter-spacing: 0.3px;
        gap: 6px;
    }
    .nt-d1-btn-cart-text {
        padding-left: 0 !important;
        white-space: nowrap !important;
        font-size: 11.5px;
        letter-spacing: 0.3px;
        line-height: 1.2;
    }
    .nt-d1-btn-cart-icon {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .nt-card-d1 {
        padding: 0 10px 14px 10px;
        margin-top: 60px;
    }
    .nt-d1-thumb-wrap {
        height: 125px;
        margin-top: -60px;
        margin-bottom: 8px;
    }
    .nt-d1-thumb-img {
        height: 125px;
    }
    .nt-d1-title {
        font-size: 13px;
        min-height: 34px;
        line-height: 1.3;
        margin-bottom: 4px;
    }
    .nt-d1-desc {
        font-size: 11px;
        min-height: 28px;
        margin-bottom: 6px;
    }
    .nt-d1-price {
        font-size: 16px;
    }
    .nt-d1-price-wrap {
        margin-bottom: 8px;
    }
    .nt-d1-btn-cart {
        padding: 6px 6px 6px 10px;
        min-height: 36px;
        font-size: 11px;
        letter-spacing: 0.2px;
        justify-content: space-between;
        gap: 4px;
    }
    .nt-d1-btn-cart-text {
        padding-left: 0 !important;
        white-space: nowrap !important;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.2px;
        text-align: center;
        flex-grow: 1;
        line-height: 1.2;
    }
    .nt-d1-btn-cart-icon {
        width: 22px;
        height: 22px;
        font-size: 11px;
        margin-left: 2px;
    }
}

@media (max-width: 375px) {
    .nt-card-d1 {
        padding: 0 8px 12px 8px;
    }
    .nt-d1-btn-cart {
        padding: 5px 4px 5px 8px;
        min-height: 34px;
        gap: 2px;
    }
    .nt-d1-btn-cart-text {
        font-size: 10px;
        letter-spacing: 0;
    }
    .nt-d1-btn-cart-icon {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}


/* ==================== ELEMENT ORDER & VISIBILITY ==================== */
/* Enables drag-and-drop / ordering in Admin Settings to reorder all 10 card elements */
.nt-card-d1 {
    display: flex;
    flex-direction: column;
}

.nt-card-d1 .nt-d1-thumb-wrap {
    order: var(--nt-d1-order-image, 0);
}

.nt-card-d1 .nt-d1-body {
    display: flex;
    flex-direction: column;
    order: var(--nt-d1-order-body, 1);
}

.nt-card-d1 .nt-d1-title {
    order: var(--nt-d1-order-title, 1);
    display: var(--nt-d1-show-title, block);
}

.nt-card-d1 .nt-d1-desc {
    order: var(--nt-d1-order-description, 2);
    display: var(--nt-d1-show-description, -webkit-box);
}

.nt-card-d1 .nt-d1-variations {
    order: var(--nt-d1-order-variant, 3);
    display: var(--nt-d1-show-variant, flex);
}

.nt-card-d1 .nt-d1-rating {
    order: var(--nt-d1-order-rating, 4);
    display: var(--nt-d1-show-rating, flex);
}

.nt-card-d1 .nt-d1-price-wrap {
    order: var(--nt-d1-order-price, 5);
    display: var(--nt-d1-show-price, flex);
}

.nt-card-d1 .nt-d1-btn-cart,
.nt-card-d1 .nt-d1-cart-action {
    order: var(--nt-d1-order-add_to_cart, 6);
    display: var(--nt-d1-show-add_to_cart, flex);
    margin-top: auto !important;
}

.nt-card-d1 .nt-d1-cart-action {
    width: 100%;
    flex-direction: column;
}

.nt-card-d1 .nt-d1-cart-action .nt-d1-btn-cart {
    margin-top: 0;
    width: 100%;
}

/* Visibility rules for top badge and actions */
.nt-card-d1 .nt-d1-badge {
    display: var(--nt-d1-show-badge, inline-block);
}

.nt-card-d1 .nt-d1-action-btn[data-action="wishlist"],
.nt-card-d1 .nt-d1-action-wishlist {
    display: var(--nt-d1-show-wishlist, inline-flex);
}

.nt-card-d1 .nt-d1-action-btn[data-action="compare"],
.nt-card-d1 .nt-d1-action-compare {
    display: var(--nt-d1-show-compare, inline-flex);
}

/* Active Wishlist State */
.nt-card-d1 .nt-d1-action-btn.active-wishlist {
    background: #ef4444 !important;
    color: #ffffff !important;
}

/* Selection state for size pills */
.nt-card-d1 .nt-d1-size-box {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
.nt-card-d1 .nt-d1-size-box:not(.active):hover,
.nt-card-d1 .nt-d1-size-box:not(.active):focus-visible {
    border-color: var(--nt-d1-primary, #eb5e28) !important;
    color: var(--nt-d1-primary, #eb5e28) !important;
    background-color: #fff7ed !important;
    outline: none;
}
.nt-card-d1 .nt-d1-size-box.active,
.nt-d1-size-box.active {
    background-color: var(--theme-primary-color, var(--nt-d1-primary, #f26522)) !important;
    border-color: var(--theme-primary-color, var(--nt-d1-primary, #f26522)) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(242, 101, 34, 0.45) !important;
    font-weight: 700 !important;
}