/**
 * Product Card Modular - Akila Florist
 * Status: Optimized for Standard & Simple Grid
 */

/* 1. Base Card Structure */
.st-product-card {
    background: var(--white, #ffffff);
    border: 1px solid var(--border-color, #f0f0f0);
    border-radius: var(--border-radius, 8px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s ease;
    position: relative;
}

.product-card-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
}

/* 2. Media Area - Dinamis mengikuti CSS Variable dari PHP */
.product-thumb-area {
    position: relative;
    width: 100%;
    /* Gunakan variabel dari PHP, fallback ke 1/1 jika tidak terdefinisi */
    aspect-ratio: var(--card-aspect-ratio, 1 / 1);
    overflow: hidden;
    background: var(--bg-light, #f5f5f5);
    /* Fix untuk Safari agar border-radius tidak 'leak' saat zoom */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    isolation: isolate;
}

.product-thumb-area img {
    width: 100%;
    height: 100%; /* Wajib 100% agar mengikuti parent aspect-ratio */
    object-fit: cover; /* Menghindari gambar gepeng */
    object-position: center;
    display: block;
    /* Optimasi Animasi */
    will-change: transform;
    backface-visibility: hidden;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* 3. Content Area (Judul & Harga) */
.product-card-content {
    padding: 15px;
    display: grid;
    grid-template-rows: 1fr auto; 
    row-gap: 8px; 
    flex-grow: 1;
}

.product-card-title {
    /* 1. Reset Display ke Block (WAJIB agar ellipsis bekerja) */
    display: block !important;
    width: 100%;
    
    /* 2. Ukuran Font Fluid */
    font-size: var(--p-card-title-size, 0.95rem) !important;
    font-weight: 600;
    color: var(--primary-color, #333333);
    margin: 0 0 8px 0 !important;
    line-height: var(--p-card-title-line-height, 1.4);
    transition: color 0.3s ease;

    /* 3. Logic Ellipsis (Titik-titik) */
    white-space: nowrap !important;   /* Memaksa teks satu baris */
    overflow: hidden !important;      /* Sembunyikan teks yang meluap */
    text-overflow: ellipsis !important; /* Munculkan titik-titik (...) */

    /* 4. Menjaga Kesejajaran Grid */
    min-height: calc(var(--p-card-title-size) * var(--p-card-title-line-height));
}

/* 4. Price Area */
.product-card-price {
    display: flex;
    flex-wrap: wrap; 
    align-items: center;
    gap: 4px 10px; 
    margin-top: auto;
    align-self: end;
}

.price-actual {
    font-family: var(--font-body, inherit);
    font-weight: 700;
    color: var(--accent-color);
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    line-height: 1;
    white-space: nowrap;
}

.price-old {
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    color: var(--text-muted, #aaaaaa);
    text-decoration: line-through;
    line-height: 1;
}

/* 5. Badge & Overlay */
.product-badge-promo {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-color, var(--primary-color));
    color: var(--white, #ffffff);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 2px;
    z-index: 2;
    text-transform: uppercase;
}

.product-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25); 
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3;
}

.btn-product-view {
    background: var(--primary-color);
    color: var(--white, #ffffff);
    padding: 10px 20px;
    border-radius: var(--border-radius, 4px);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: var(--btn-text-transform, none);
    transform: translateY(15px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 6. Hover States */
.st-product-card:hover .product-card-overlay { opacity: 1; }
.st-product-card:hover .btn-product-view { transform: translateY(0); }
.btn-product-view:hover { background: var(--primary-hover); transform: scale(1.05); }

.hover-zoom:hover .product-thumb-area img { transform: scale(1.1); }
.hover-shadow:hover { 
    transform: translateY(-5px); 
    box-shadow: var(--card-shadow, 0 10px 20px rgba(0,0,0,0.1)); 
}

/* ============================================================
    VARIANT: SIMPLE MODE (Luxury & Modern)
   ============================================================ */

.st-grid-simple .product-card-overlay { display: none !important; }

.st-grid-simple .st-product-card {
    border: none;
    background: transparent;
    box-shadow: none;
}

.st-grid-simple .product-card-content {
    text-align: center;
    padding: 15px 0;
}

.st-grid-simple .product-card-price { justify-content: center; }

/* Custom Skin Behavior in Simple Mode */
.skin-luxury .st-grid-simple .product-card-title {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.1rem;
}
.skin-luxury .st-grid-simple .price-actual { color: var(--accent-color); }

.skin-modern .st-grid-simple .product-thumb-area {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

/* 7. Responsivitas Mobile */
@media (max-width: 576px) {
    .product-card-content { padding: 10px 5px; }
}

@media (max-width: 380px) {
    .product-card-price {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .st-grid-simple .product-card-price { align-items: center; }
}