/**
 * LM Product Card Styles
 * Modern, responsive product cards with grid/list views
 */

/* ========================================
   Product Grid Container - Dynamic Sizing
   ======================================== */

.lm-product-loop {
    width: 100%;
    margin: 0;
}

/* SMALL GRID: Tight spacing, more products (8-12 on desktop) */
.lm-product-loop--grid-small {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

/* BIG GRID: Comfortable spacing, fewer products (4-6 on desktop) */
.lm-product-loop--grid-big {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
}

/* LIST VIEW: One product per row, horizontal layout */
.lm-product-loop--list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Responsive adjustments for small grid */
@media (max-width: 768px) {
    .lm-product-loop--grid-small {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.75rem;
    }
}

/* Responsive adjustments for big grid */
@media (max-width: 768px) {
    .lm-product-loop--grid-big {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 1rem;
    }
}

/* ========================================
   Product Card Base
   ======================================== */

.lm-product-card {
    background: #fff;
    border: 1px solid #E6E6E6;
    border-radius: 5px;
    padding: 0;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.lm-product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* ========================================
   Product Card Image
   ======================================== */

.lm-product-card__image-wrapper {
    position: relative;
    overflow: visible;
    border-radius: 5px 5px 0 0;
    background: #F6F9FC;
    aspect-ratio: 1 / 1;
}

.lm-product-card__link {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 5px 5px 0 0;
    position: relative;
}

.lm-product-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Hover effect: smooth scale */
.lm-product-card:hover .lm-product-card__image {
    transform: scale(1.1);
}

/* "New" Badge - PNG overlay */
.lm-product-card__badge-new {
    position: absolute;
    top: 0;
    left: 0;
    width: 30%;
    height: auto;
    z-index: 5;
    pointer-events: none;
    transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: 0 0;
}

.lm-product-card:hover .lm-product-card__badge-new {
    transform: scale(1.1);
}

/* ========================================
   Quick Actions - Corner Icons
   Positioned at top-right of image, half outside
   ======================================== */

.lm-product-card__quick-actions {
    position: absolute;
    top: -6px;
    right: -6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lm-product-card:hover .lm-product-card__quick-actions {
    opacity: 1;
    visibility: visible;
}

/* Always show if any action is active (in wishlist or added to cart) */
.lm-product-card__quick-actions:has(.is-in-wishlist),
.lm-product-card__quick-actions:has(.is-added-to-cart) {
    opacity: 1;
    visibility: visible;
}

/* Mobile: Always show actions */
@media (max-width: 767px) {
    .lm-product-card__quick-actions {
        opacity: 1;
        visibility: visible;
    }
}

/* ========================================
   Quick Action Buttons (.lm-quick-action)
   No background, no border — just the icon
   ======================================== */

.lm-quick-action {
    width: 24px;
    height: 24px;
    background-color: transparent !important; /* CLAUDE: keep this line */ 
    border-style: none !important; /* CLAUDE: keep this line */ 
    padding: 0px !important; /* CLAUDE: keep this line */; 
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333;
    transition: color 0.3s ease;
    text-decoration: none;
}


.lm-quick-action:hover svg * {
  stroke: #A28573;
}

.lm-quick-action svg {
    stroke: #00000047;
    width: 22px;
    height: 22px;
    display: block;
    flex-shrink: 0;
    transition: color 0.3s ease, fill 0.3s ease, stroke 0.3s ease;
}

/* ========================================
   Wishlist Icon States
   ======================================== */

.lm-quick-action--wishlist .lm-icon--wishlist-filled {
    display: none;
}

.lm-quick-action--wishlist.is-in-wishlist .lm-icon--wishlist-empty {
    display: none;
}

.lm-quick-action--wishlist.is-in-wishlist .lm-icon--wishlist-filled {
    display: block;
    fill: #A28573;
    stroke: #A28573;
}

.lm-quick-action--wishlist.is-in-wishlist {
    color: #A28573;
    opacity: 1;
    visibility: visible;
}

/* ========================================
   Cart Icon States
   ======================================== */

.lm-quick-action--cart.is-added-to-cart {
    color: #A28573;
    opacity: 1;
    visibility: visible;
}

.lm-quick-action--cart.is-added-to-cart svg {
    fill: #A28573;
}

/* ========================================
   Badges
   ======================================== */

.lm-product-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
    z-index: 5;
}

/* Hide WooCommerce default sale badge */
.lm-product-card .onsale {
    display: none !important;
}

.lm-product-card__badge--out-of-stock {
    background-color: #696969;
    color: white;
    top: auto;
    bottom: 10px;
}

/* ========================================
   Product Card Content
   ======================================== */

.lm-product-card__content {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lm-product-card__title {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
}

.lm-product-card__title a {
    color: #201712;
    text-decoration: none;
    transition: color 0.3s ease;
}

.lm-product-card__title a:hover {
    color: #A28573;
}

.lm-product-card__price {
    font-size: 15px;
    font-weight: 600;
    color: #A28573;
    margin: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lm-product-card__price-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lm-product-card__price del {
    color: #c0333396;
    font-weight: 400;
    font-size: 13px;
}

/* Discount Badge - SVG next to price */
.lm-product-card__price .lm-discount-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.lm-product-card__price .lm-discount-badge svg {
    width: 100%;
    height: 100%;
}

.lm-product-card__price .lm-discount-badge__text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Adjust for big grid */
.lm-product-loop--grid-big .lm-product-card__content {
    padding: 16px;
    gap: 8px;
}

.lm-product-loop--grid-big .lm-product-card__title {
    font-size: 16px;
    min-height: 42px;
}

.lm-product-loop--grid-big .lm-product-card__price {
    font-size: 18px;
}

.lm-product-loop--grid-big .lm-discount-badge {
    width: 48px !important;
    height: 48px !important;
}

.lm-product-loop--grid-big .lm-discount-badge__text {
    font-size: 11px !important;
}

/* Small grid: Stack prices vertically with badge centered on the right */
.lm-product-loop--grid-small .lm-product-card__price {
    align-items: center;
}

.lm-product-loop--grid-small .lm-product-card__price-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.lm-product-loop--grid-small .lm-product-card__price del {
    margin-bottom: -3px;
    line-height: 1.2;
}

/* Small grid: Price ranges — compact "From $min" format */
.lm-product-loop--grid-small .lm-product-card__price-text.is-range {
    flex-direction: row;
    align-items: baseline;
    font-size: 14px;
}

.lm-product-loop--grid-small .lm-product-card__price-text.is-range::before {
    content: 'From ';
    font-size: 11px;
    font-weight: 400;
    color: #888;
    margin-right: 3px;
    white-space: nowrap;
}

/* Hide dash separator (span without price class) and second price */
.lm-product-loop--grid-small .lm-product-card__price-text.is-range > span:not(.woocommerce-Price-amount):not(.screen-reader-text),
.lm-product-loop--grid-small .lm-product-card__price-text.is-range > .woocommerce-Price-amount ~ .woocommerce-Price-amount {
    display: none;
}

/* ========================================
   Hover Info Overlay
   ======================================== */

.lm-product-card__hover-info {
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Only show on hover for BIG GRID */
.lm-product-loop--grid-big .lm-product-card:hover .lm-product-card__hover-info {
    opacity: 1;
    visibility: visible;
    max-height: 200px;
}

.lm-product-card__short-desc {
    font-size: 12px;
    color: #696969;
    line-height: 1.4;
    margin: 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lm-product-loop--grid-big .lm-product-card__short-desc {
    font-size: 13px;
    -webkit-line-clamp: 3;
}

.lm-product-card__rating {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
}

.lm-product-card__rating .star-rating {
    font-size: 11px;
}

.lm-product-card__rating-count {
    color: #696969;
}

/* ========================================
   View-Specific Visibility
   Description, rating, list-actions hidden in grid; shown in list
   Quick-actions overlay hidden in list; shown in grid
   ======================================== */

/* GRID views: hide list-only elements */
.lm-product-card__description,
.lm-product-card__rating {
    display: none;
}

/* BIG GRID: show description on hover */
.lm-product-loop--grid-big .lm-product-card__description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 0;
    max-height: 0;
    transition: all 0.3s ease;
    font-size: 13px;
    color: #696969;
    line-height: 1.4;
    margin: 6px 0;
}

.lm-product-loop--grid-big .lm-product-card:hover .lm-product-card__description {
    opacity: 1;
    max-height: 100px;
}

/* ========================================
   LIST VIEW - Horizontal layout via parent class
   ======================================== */

/* List: show description, rating */
.lm-product-loop--list .lm-product-card__description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    overflow: hidden;
    font-size: 14px;
    color: #696969;
    line-height: 1.6;
    margin: 8px 0;
}

.lm-product-loop--list .lm-product-card__rating {
    display: flex;
    font-size: 12px;
    margin-top: 8px;
}

/* List: show quick actions at image corner */
.lm-product-loop--list .lm-product-card__quick-actions {
    top: -6px;
    right: -6px;
}

/* List: horizontal card layout */
.lm-product-loop--list .lm-product-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    padding: 1.5rem;
    flex-direction: row;
}

.lm-product-loop--list .lm-product-card__image-wrapper {
    border-radius: 5px;
    height: 200px;
    width: 200px;
    aspect-ratio: auto;
    overflow: visible;
}

.lm-product-loop--list .lm-product-card__link {
    border-radius: 5px;
}

.lm-product-loop--list .lm-product-card__title {
    font-size: 18px;
    min-height: auto;
    display: block;
    -webkit-line-clamp: unset;
}

.lm-product-loop--list .lm-product-card__price {
    font-size: 20px;
    font-weight: 700;
}

/* List view tablet */
@media (max-width: 1024px) {
    .lm-product-loop--list .lm-product-card {
        grid-template-columns: 160px 1fr;
        gap: 1.5rem;
    }

    .lm-product-loop--list .lm-product-card__image-wrapper {
        height: 160px;
        width: 160px;
    }
}

/* List view mobile */
@media (max-width: 767px) {
    .lm-product-loop--list .lm-product-card {
        grid-template-columns: 100px 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    .lm-product-loop--list .lm-product-card__image-wrapper {
        height: 100px;
        width: 100px;
    }

    .lm-product-loop--list .lm-product-card__title {
        font-size: 15px;
    }

    .lm-product-loop--list .lm-product-card__description {
        font-size: 13px;
        margin: 8px 0;
    }

    .lm-product-loop--list .lm-product-card__price {
        font-size: 16px;
    }

}

/* ========================================
   Loading State
   ======================================== */

.lm-product-card.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.lm-product-card.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #A28573;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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