/* ============================================================================
   The shop product card.

   One stylesheet for one card. The markup lives in
   theme-views/partials/_shop-product-card.blade.php and is rendered by three
   callers: the shop page, the seller shop page, and pages/shop-products.blade.php
   (what AJAX filtering returns). Those pages each used to carry their own copy of
   these rules; they drifted, and the AJAX partial's copy was written into the
   document after the page's, so it won on source order and a filtered grid did
   not look like the grid the page first drew.

   Page chrome - the grid, the sidebar, the list view - stays on the page. Only
   what draws the card itself belongs here.
   ============================================================================ */

/* =============================================
   PRODUCT CARD STYLES (Inline)
   ============================================= */

/* Product Card */
.product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e8e8e8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100% !important;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    border-color: var(--primary-dark);
    box-shadow: 0 8px 24px rgba(var(--bs-primary-rgb), 0.15);
    transform: translateY(-4px);
}

/* Product Image */
.product-image {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    aspect-ratio: 1 / 1;
}

.product-image a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* Discount Badge */
.product__discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff4b2b;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    z-index: 2;
    display: flex;
    align-items: center;
}

.product__discount-badge i {
    font-size: 0.7rem;
}

/* Product Actions - with 360 rotation */
.product-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.3s ease;
}

.product-card:hover .product-actions {
    opacity: 1;
    transform: translateX(0);
}

.product__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Active state for wishlist and compare */
.action-btn.wishlist_icon_active,
.action-btn.compare_list_icon_active {
    background: var(--primary-dark);
}

.action-btn.wishlist_icon_active i,
.action-btn.compare_list_icon_active i {
    color: #fff;
}

/* Card Body */
.product-card .card-body {
    padding: 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Product Title */
.product-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title a {
    transition: color 0.2s ease;
}

.product-title a:hover {
    color: var(--primary-dark) !important;
}

/* Product Price */
.product-price {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Inline Rating (beside price) */
.product-rating-inline {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    font-size: 0.7rem;
    color: #ffc107;
    line-height: 1;
    /* Keep the stars and their count together. On a card that also shows an
       original price the row runs out of width, and without this the group
       broke mid-way, leaving one star and the count on a line of their own. */
    white-space: nowrap;
}

.product-rating-inline .bi-star-fill,
.product-rating-inline .bi-star-half {
    color: #ffc107;
}

.product-rating-inline .bi-star {
    color: #dee2e6;
}

.product-review-count {
    font-size: 0.7rem;
    color: #6c757d;
    font-weight: 500;
    margin-left: 3px;
    white-space: nowrap;
}

.current-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.original-price {
    font-size: 0.8rem;
    color: #6c757d;
    text-decoration: line-through;
}

/* Color Swatches */
.color-options {
    margin: 0.4rem 0;
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.color-swatch:hover {
    transform: scale(1.15);
    border-color: #9ca3af;
}

.color-swatch.active {
    border-color: #111;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #111;
}

/* Choice Options */
.choice-options {
    margin: 0.4rem 0;
}

.choice-label {
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}

.choice-label i {
    color: var(--primary-dark);
    font-size: 0.75rem;
}

.choice-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.choice-option {
    padding: 3px 10px;
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #495057;
}

.choice-option:hover {
    border-color: var(--primary-dark);
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.choice-option.active {
    border-color: var(--primary-dark);
    background: var(--primary-dark);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--bs-primary-rgb), 0.25);
}

.quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    width: fit-content;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
}

.quantity-button {
    width: 22px;
    height: 22px;
    border: none;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--primary-dark);
    padding: 0;
}

.quantity-button:hover {
    background: var(--primary-dark);
    color: #fff;
}

.quantity-button i {
    font-size: 0.7rem;
}

.quantity-input {
    width: 28px;
    height: 22px;
    border: none;
    border-left: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: #212529;
    background: #fff;
}

.quantity-input:focus {
    outline: none;
    background: #f8f9fa;
}

/* Remove spinner arrows from number input */
.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-input[type=number] {
    -moz-appearance: textfield;
}

/* Main Actions */
.main-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 0.35rem;
}

.btn-whatsapp,
.btn-add-cart {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-whatsapp i,
.btn-add-cart i {
    font-size: 1.1rem;
}

.btn-whatsapp {
    background: #25d366;
    color: #fff;
}

.btn-whatsapp:hover {
    background: #1ebe57;
    transform: translateY(-1px);
}

.btn-add-cart {
    background: var(--primary-dark);
    color: #fff;
}

.btn-add-cart:hover {
    background: var(--bs-primary);
    transform: translateY(-1px);
}

.btn-add-cart .spin {
    animation: btn-spin 0.6s linear infinite;
}

/* Dark mode - Product Card */
[theme="dark"] .product-card {
    background: #1a1a1a;
}

[theme="dark"] .product-title a {
    color: #fff !important;
}

[theme="dark"] .product-title a:hover {
    color: var(--primary-dark) !important;
}

[theme="dark"] .choice-option {
    background: #2a2a2a;
    border-color: #404040;
    color: #e0e0e0;
}

[theme="dark"] .choice-option:hover {
    background: var(--primary-light);
}

[theme="dark"] .choice-option.active {
    background: var(--primary-dark);
    color: #fff;
}

[theme="dark"] .quantity-wrapper,
[data-bs-theme="dark"] .quantity-wrapper,
body[theme="dark"] .quantity-wrapper {
    border-color: rgba(255, 255, 255, 0.2) !important;
}

[theme="dark"] .quantity-button,
[data-bs-theme="dark"] .quantity-button,
body[theme="dark"] .quantity-button {
    background: #2a2d3e !important;
    color: #f8f9fa !important;
}

[theme="dark"] .quantity-button i,
[data-bs-theme="dark"] .quantity-button i,
body[theme="dark"] .quantity-button i {
    color: #f8f9fa !important;
}

[theme="dark"] .quantity-button:hover,
[data-bs-theme="dark"] .quantity-button:hover,
body[theme="dark"] .quantity-button:hover {
    background: var(--primary-dark) !important;
    color: #fff !important;
}

[theme="dark"] .quantity-button:hover i,
[data-bs-theme="dark"] .quantity-button:hover i,
body[theme="dark"] .quantity-button:hover i {
    color: #fff !important;
}

[theme="dark"] .quantity-input,
[data-bs-theme="dark"] .quantity-input,
body[theme="dark"] .quantity-input {
    background: #1a1d29 !important;
    color: #f8f9fa !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

[theme="dark"] .product-review-count,
[data-bs-theme="dark"] .product-review-count,
body[theme="dark"] .product-review-count {
    color: #d1d5db !important;
}

[theme="dark"] .product-rating-inline .bi-star,
[data-bs-theme="dark"] .product-rating-inline .bi-star,
body[theme="dark"] .product-rating-inline .bi-star {
    color: #6b7280 !important;
}

[theme="dark"] .current-price,
[data-bs-theme="dark"] .current-price,
body[theme="dark"] .current-price {
    color: #f8f9fa !important;
}

[theme="dark"] .original-price,
[data-bs-theme="dark"] .original-price,
body[theme="dark"] .original-price {
    color: #8b90a0 !important;
}

/* Product name (shop cards) */
[theme="dark"] .product-name,
[theme="dark"] .product-title,
[data-bs-theme="dark"] .product-name,
[data-bs-theme="dark"] .product-title,
body[theme="dark"] .product-name,
body[theme="dark"] .product-title {
    color: #f8f9fa !important;
}

/* Per-product flash deal mini countdown timer */
.product-image { position: relative; overflow: hidden; }

.fd-mini-timer { position: absolute; bottom: 0; left: 0; right: 0; z-index: 3; pointer-events: none; background: rgba(0,0,0,0.75); display: flex; align-items: center; justify-content: center; gap: 0.3rem; padding: 0.45rem 0.4rem; }

.fd-mini-unit { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); border-radius: 0.2rem; text-align: center; padding: 0.15rem 0.3rem; min-width: 2rem; }

.fd-mini-num { display: block; font-size: 0.8rem; font-weight: 700; color: #fff; line-height: 1.2; }

.fd-mini-label { display: block; font-size: 0.5rem; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.04em; }

@media (max-width: 767px) {
    .product-actions {
        opacity: 1;
        transform: translateX(0);
    }

    .action-btn {
        width: 26px !important;
        height: 26px !important;
    }

    .main-actions {
        flex-direction: row;
    }
}
