/**
 * Caiser Theme Editor — Front-end Styles
 *
 * Self-contained product card and grid styles.
 * Uses .caiser-* prefixed classes and --caiser-* CSS variables only.
 * Does not depend on any theme-specific classes.
 */

/* ── Product Grid ─────────────────────────────────────────────────── */

.caiser-product-grid {
    display: grid;
    grid-template-columns: repeat(var(--caiser-products-per-row, 4), 1fr);
    gap: 1.5rem;
    padding: 0;
    list-style: none;
    margin: 0;
}

@media (max-width: 1024px) {
    .caiser-product-grid {
        grid-template-columns: repeat(var(--caiser-products-per-row-tablet, 3), 1fr);
        gap: 1rem;
    }
}

@media (max-width: 767px) {
    .caiser-product-grid {
        grid-template-columns: repeat(var(--caiser-products-per-row-mobile, 2), 1fr);
        gap: 0.75rem;
    }
}

/* ── Product Card ─────────────────────────────────────────────────── */

.caiser-product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    font-family: var(--caiser-font-family, sans-serif);
}

.caiser-product-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* ── Thumbnail Area ───────────────────────────────────────────────── */

.caiser-product-card__thumbnail {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #f8f8f8;
}

.caiser-product-card__thumbnail a {
    display: block;
    width: 100%;
    height: 100%;
}

.caiser-product-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Primary image */
.caiser-product-card__img--primary {
    position: relative;
    z-index: 1;
}

/* Hover image — positioned behind primary, revealed on hover */
.caiser-product-card__img--hover {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    opacity: 0;
}

/* ── Hover Image Transitions ─────────────────────────────────────── */

/* Fade (default) */
.caiser-product-card--hover-fade .caiser-product-card__img--primary {
    transition: opacity 0.4s ease;
}
.caiser-product-card--hover-fade:hover .caiser-product-card__img--primary {
    opacity: 0;
}
.caiser-product-card--hover-fade .caiser-product-card__img--hover {
    opacity: 1;
}

/* Slide */
.caiser-product-card--hover-slide .caiser-product-card__img--primary {
    transition: transform 0.4s ease;
}
.caiser-product-card--hover-slide .caiser-product-card__img--hover {
    opacity: 1;
    transform: translateX(100%);
    transition: transform 0.4s ease;
}
.caiser-product-card--hover-slide:hover .caiser-product-card__img--primary {
    transform: translateX(-100%);
}
.caiser-product-card--hover-slide:hover .caiser-product-card__img--hover {
    transform: translateX(0);
}

/* Zoom */
.caiser-product-card--hover-zoom .caiser-product-card__img--primary {
    transition: transform 0.4s ease, opacity 0.4s ease;
}
.caiser-product-card--hover-zoom:hover .caiser-product-card__img--primary {
    transform: scale(1.1);
    opacity: 0;
}
.caiser-product-card--hover-zoom .caiser-product-card__img--hover {
    opacity: 1;
    transition: transform 0.4s ease;
}
.caiser-product-card--hover-zoom:hover .caiser-product-card__img--hover {
    transform: scale(1.05);
}

/* ── Badges / Flags ───────────────────────────────────────────────── */

.caiser-product-card__flags {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.caiser-product-card__flag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #fff;
    border-radius: 0.25rem;
    line-height: 1.3;
}

.caiser-product-card__flag--new {
    background: #4caf50;
}

.caiser-product-card__flag--sale,
.caiser-product-card__flag--discount {
    background: #f44336;
}

.caiser-product-card__flag--pack {
    background: #2196f3;
}

.caiser-product-card__flag--online {
    background: #ff9800;
}

.caiser-product-card__flag--custom {
    background: var(--caiser-badge-color, #e5159b);
}

/* ── Quick View ───────────────────────────────────────────────────── */

.caiser-product-card__quick-view {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    text-align: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.caiser-product-card:hover .caiser-product-card__quick-view {
    opacity: 1;
    transform: translateY(0);
}

.caiser-product-card__quick-view a {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.caiser-product-card__quick-view a:hover {
    text-decoration: underline;
}

/* ── Card Body ────────────────────────────────────────────────────── */

.caiser-product-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0.75rem;
}

/* Title */
.caiser-product-card__title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 0.4rem;
    color: #333;
}

.caiser-product-card__title a {
    color: inherit;
    text-decoration: none;
}

.caiser-product-card__title a:hover {
    color: var(--caiser-primary, #e5159b);
}

/* Title line clamp — applied when --caiser-title-lines > 0 */
.caiser-product-card__title--clamped {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--caiser-title-lines, 2);
    overflow: hidden;
}

/* Price */
.caiser-product-card__price {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: #333;
}

.caiser-product-card__price--has-discount .caiser-product-card__price-regular {
    text-decoration: line-through;
    color: #999;
    font-size: 0.8rem;
    font-weight: 400;
    margin-right: 0.4rem;
}

.caiser-product-card__price-current {
    color: var(--caiser-primary, #e5159b);
}

/* ── Add to Cart ──────────────────────────────────────────────────── */

.caiser-product-card__add-to-cart {
    margin-top: auto;
    padding-top: 0.5rem;
}

.caiser-product-card__add-to-cart form {
    margin: 0;
}

.caiser-product-card__atc-btn {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--caiser-primary, #e5159b);
    border: none;
    border-radius: var(--caiser-btn-radius, 10rem);
    cursor: pointer;
    transition: background 0.25s ease;
    text-align: center;
    text-decoration: none;
    line-height: 1.4;
}

.caiser-product-card__atc-btn:hover {
    background: var(--caiser-primary-hover, #c8108a);
    color: #fff;
    text-decoration: none;
}

.caiser-product-card__atc-btn:disabled,
.caiser-product-card__atc-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Variant Indicator ────────────────────────────────────────────── */

.caiser-product-card__variants {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 0.3rem;
}
