/*
 * Smart Art - pixel-matched product card.
 * Presentation layer only. Brand colours are read from the existing
 * --primary / --soft-primary CSS variables; no backend or JS library changes.
 */

@font-face {
    font-family: 'GE SS Two';
    src: url('../fonts/ge-ss-two/GESSTwo-Light.otf') format('opentype');
    font-style: normal;
    font-weight: 300;
    font-display: swap;
}

@font-face {
    font-family: 'GE SS Two';
    src: url('../fonts/ge-ss-two/GESSTwo-Medium.otf') format('opentype');
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: 'GE SS Two';
    src: url('../fonts/ge-ss-two/GESSTwo-Bold.otf') format('opentype');
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

body {
    font-family: 'GE SS Two', 'Cairo', sans-serif;
}

/* ---------- Products section: space below the cards ---------- */
.smart-products-section {
    padding-bottom: 25px;
    border-radius: 12px;
}

.smart-products-section .carousel-box {
    visibility: visible !important;
}

/* ---------- Card shell ---------- */
.smart-product-card {
    --smart-card-radius: 12px;
    --smart-card-border: #e0e0e0;
    --smart-card-muted: #7a7f87;
    --smart-card-text: #292933;

    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 460px;
    padding: 10px;
    margin: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--smart-card-border);
    border-radius: var(--smart-card-radius);
    font-family: 'GE SS Two', 'Cairo', sans-serif;
    visibility: visible !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.smart-product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.smart-product-card a:focus-visible,
.smart-product-card button:focus-visible,
.smart-product-card input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ---------- 1. Header: brand + discount ---------- */
.smart-pc__header {
    box-sizing: border-box;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    direction: rtl;
    min-height: 22px;
    margin-bottom: 6px;
    line-height: 1;
}

.smart-pc__brand {
    color: var(--smart-card-muted);
    font-family: 'GE SS Two', 'Cairo', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.smart-pc__badges {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
}

.smart-pc__discount {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    min-width: 48px;
    padding: 0 7px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-family: 'GE SS Two', 'Cairo', sans-serif;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.smart-pc__label {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 5px;
    font-family: 'GE SS Two', 'Cairo', sans-serif;
    font-size: 9px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

/* ---------- 2. Product image ---------- */
.smart-pc__media {
    position: relative;
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #fff;
    border-radius: 14px;
}

.smart-pc__media > a {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
}

.smart-pc__media img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    padding: 0;
    margin: 0;
    object-fit: contain;
    object-position: center;
}

.smart-pc__media .product-hover-image {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.smart-product-card:hover .product-main-image,
.smart-product-card:hover .product-hover-image {
    transform: scale(1.04);
}

.smart-product-card:hover .product-hover-image {
    opacity: 1;
}

/* ---------- 3-5. Title, price and stock notice ---------- */
.smart-pc__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    box-sizing: border-box;
    padding: 10px 2px 0;
    text-align: right;
    direction: rtl;
}

.smart-pc__title {
    display: -webkit-box;
    box-sizing: border-box;
    min-height: 46px;
    max-height: 46px;
    margin: 0;
    overflow: hidden;
    color: var(--smart-card-text);
    font-family: 'GE SS Two', 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.65;
    text-align: right;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.smart-pc__title a {
    color: inherit;
    text-decoration: none;
}

.smart-pc__price {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    box-sizing: border-box;
    min-height: 24px;
    margin-top: 7px;
    text-align: right;
}

.smart-pc__price > div {
    line-height: 1.3;
}

.smart-pc__price > div:only-child {
    margin-inline-start: auto;
}

.smart-pc__price .smart-pc__current {
    color: var(--primary);
    font-family: 'GE SS Two', 'Cairo', sans-serif;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
}

.smart-pc__price del {
    color: var(--smart-card-muted);
    font-family: 'GE SS Two', 'Cairo', sans-serif;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
}

/* Aiz hides the old price until hover; real price data must stay visible. */
.smart-product-card .disc-amount {
    margin-right: 0;
    margin-left: 0;
    opacity: 1 !important;
}

.smart-pc__stock {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    box-sizing: border-box;
    min-height: 34px;
    margin-top: 8px;
    padding: 5px 9px;
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    background: var(--soft-primary);
    color: var(--smart-card-text);
    direction: rtl;
    font-family: 'GE SS Two', 'Cairo', sans-serif;
}

.smart-pc__stock i {
    flex: 0 0 auto;
    color: var(--primary);
    font-size: 15px;
    line-height: 1;
    order: 1;
}

.smart-pc__stock-copy {
    flex: 1 1 auto;
    min-width: 0;
    order: 2;
    text-align: right;
}

.smart-pc__stock strong {
    display: block;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.smart-pc__stock small {
    display: block;
    color: var(--smart-card-muted);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
}

/* ---------- 6. Footer: quantity, wishlist and cart ---------- */
/* By Fatehi — 2026-11-27: Footer order is wishlist → quantity → cart; wishlist is the first inline item before the stepper. */
.smart-pc__footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    box-sizing: border-box;
    margin-top: auto;
    padding-top: 10px;
    direction: ltr;
}

.smart-pc__qty {
    display: grid;
    grid-template-columns: 18px 24px;
    grid-template-rows: 18px 18px;
    align-items: center;
    justify-items: center;
    flex: 0 0 46px;
    box-sizing: border-box;
    width: 46px;
    height: 36px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--smart-card-border);
    border-radius: 5px;
    direction: rtl;
}

.smart-pc__qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 18px;
    height: 18px;
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--smart-card-muted);
    font-family: 'GE SS Two', 'Cairo', sans-serif;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.smart-pc__qty-btn[data-type="plus"] {
    grid-column: 1;
    grid-row: 1;
}

.smart-pc__qty-btn[data-type="minus"] {
    grid-column: 1;
    grid-row: 2;
}

.smart-pc__qty-btn:hover {
    color: var(--primary);
}

.smart-pc__qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.smart-pc__qty-input {
    grid-column: 2;
    grid-row: 1 / span 2;
    box-sizing: border-box;
    width: 24px;
    height: 34px;
    padding: 0;
    background: transparent;
    border: 0;
    border-right: 1px solid var(--smart-card-border);
    color: var(--smart-card-text);
    font-family: 'GE SS Two', 'Cairo', sans-serif;
    font-size: 11px;
    font-weight: 500;
    line-height: 34px;
    text-align: center;
    -moz-appearance: textfield;
}

.smart-pc__qty-input::-webkit-outer-spin-button,
.smart-pc__qty-input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

/* By Fatehi — 2026-11-27: Smaller add-to-cart pill (32px high, capped width, 12px text) so it no longer fills the footer row. */
.smart-product-card .smart-pc__cart {
    position: relative;
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-sizing: border-box;
    min-width: 0;
    max-width: 170px;
    height: 32px;
    padding: 0 10px;
    overflow: hidden;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 30px;
    color: #fff;
    font-family: 'GE SS Two', 'Cairo', sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    opacity: 1;
    visibility: visible !important;
    transform: none;
    white-space: nowrap;
    transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.smart-product-card .smart-pc__cart:hover,
.smart-product-card .smart-pc__cart:focus-visible {
    color: #fff;
    filter: brightness(0.92);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.smart-product-card .smart-pc__cart.is-options {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.smart-product-card .smart-pc__cart.is-options:hover,
.smart-product-card .smart-pc__cart.is-options:focus-visible {
    background: var(--soft-primary);
    color: var(--primary);
    filter: none;
}

.smart-product-card .cart-btn,
.smart-product-card .cart-btn.active,
.smart-product-card .aiz-card-box:hover .cart-btn {
    opacity: 1;
    transform: none;
}

.smart-product-card .cart-btn .cart-btn-text,
.smart-product-card .cart-btn:hover .cart-btn-text {
    margin: 0;
}

.smart-product-card .cart-btn i {
    font-size: 15px;
}

/* By Fatehi — 2026-11-27: Compare remains the only hover tool beside the image; wishlist moved into the footer. */
.smart-pc__tools {
    position: absolute;
    top: 38px;
    right: 8px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    direction: rtl;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.smart-product-card:hover .smart-pc__tools,
.smart-product-card:focus-within .smart-pc__tools {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* By Fatehi — 2026-11-27: Compare button reduced to 24×24px to match the smaller SVG arrows. */
.smart-product-card .smart-pc__compare {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 1px solid var(--smart-card-border);
    border-radius: 50%;
    color: var(--primary);
    line-height: 1;
    opacity: 1;
    transform: none;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

/* By Fatehi — 2026-11-27: Inline wishlist icon is first in the footer, before the quantity; original addToWishList hook is unchanged. */
.smart-product-card .smart-pc__wishlist {
    display: flex;
    flex: 0 0 26px;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 26px;
    height: 26px;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 1px solid var(--smart-card-border);
    border-radius: 50%;
    color: var(--primary);
    line-height: 1;
    opacity: 1;
    visibility: visible !important;
    transform: none;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.smart-product-card .smart-pc__wishlist:hover,
.smart-product-card .smart-pc__wishlist.is-wishlisted,
.smart-product-card .smart-pc__compare:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

@media (hover: none), (pointer: coarse) {
    .smart-pc__tools {
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
    }
}

/* By Fatehi — 2026-11-27: Icons reduced to 12×12px; compare SVG viewBox widened so both arrows are fully visible. */
.smart-product-card .smart-pc__wishlist svg,
.smart-product-card .smart-pc__compare svg {
    display: block;
    width: 12px;
    height: 12px;
}

.smart-product-card .smart-pc__wishlist svg path,
.smart-product-card .smart-pc__compare svg path {
    fill: currentColor;
}

/* ---------- Responsive ---------- */
@media (min-width: 1200px) {
    .smart-product-card {
        min-height: 468px;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .smart-product-card {
        min-height: 430px;
    }
}

@media (max-width: 767px) {
    .smart-product-card {
        min-height: 392px;
        padding: 8px;
    }

    .smart-pc__header {
        margin-bottom: 4px;
    }

    .smart-pc__title {
        min-height: 40px;
        max-height: 40px;
        font-size: 13px;
        line-height: 1.55;
    }

    .smart-pc__price {
        margin-top: 5px;
    }

    .smart-pc__price .smart-pc__current {
        font-size: 14px;
    }

    .smart-pc__stock {
        min-height: 32px;
        margin-top: 6px;
        padding: 4px 7px;
    }

    .smart-pc__stock strong {
        font-size: 11px;
    }

    .smart-pc__stock small {
        font-size: 10px;
    }

    .smart-pc__footer {
        gap: 4px;
        padding-top: 8px;
    }

    .smart-products-section {
        padding-bottom: 25px;
    }

    .smart-pc__tools {
        top: 34px;
        right: 6px;
        gap: 4px;
    }

    /* By Fatehi — 2026-11-27: Mobile cart shrunk to a 30×30px icon-only pill with a 14px icon. */
    .smart-product-card .smart-pc__cart {
        flex: 0 0 30px;
        width: 30px;
        min-width: 30px;
        max-width: 30px;
        height: 30px;
        padding: 0;
        font-size: 0;
    }

    .smart-product-card .smart-pc__cart .cart-btn-text {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    /* By Fatehi — 2026-11-27: Mobile cart icon reduced from 16px to 14px to match the smaller pill. */
    .smart-product-card .smart-pc__cart i {
        font-size: 14px;
    }

    .smart-pc__qty {
        grid-template-columns: 17px 22px;
        grid-template-rows: 15px 15px;
        flex-basis: 42px;
        width: 42px;
        height: 32px;
    }

    .smart-pc__qty-btn {
        width: 17px;
        height: 15px;
        font-size: 11px;
    }

    .smart-pc__qty-input {
        width: 22px;
        height: 30px;
        line-height: 30px;
    }

    /* By Fatehi — 2026-11-27: Inline wishlist and compare icons reduced on mobile while staying tappable. */
    .smart-product-card .smart-pc__wishlist {
        flex-basis: 24px;
        width: 24px;
        height: 24px;
    }

    .smart-product-card .smart-pc__compare {
        width: 22px;
        height: 22px;
    }
}
