/**
 * PM Quick Cart - Styles
 *
 * Three states:
 *   1. Add button (green circle with +)
 *   2. Quantity controls (trash/minus | qty | plus)
 *   3. Badge (green outlined circle with quantity)
 */

/* ========================================
   Base wrapper
   ======================================== */

.pm-qc-wrap {
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 2;
}

.pm-qc-hidden {
    display: none !important;
}

/* ========================================
   State 1: Add button (green circle + icon)
   ======================================== */

.pm-qc-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #2D5F2D;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
    padding: 0;
    line-height: 1;
}

.pm-qc-add-btn:hover {
    background-color: #245024;
    transform: scale(1.05);
}

.pm-qc-add-btn:active {
    transform: scale(0.95);
}

/* Variable product: arrow button */
.pm-qc-add-btn--variable {
    text-decoration: none;
    background-color: #2D5F2D;
    color: #fff;
}

.pm-qc-add-btn--variable:hover {
    background-color: #245024;
    color: #fff;
}

/* ========================================
   State 2: Quantity controls
   ======================================== */

.pm-qc-controls {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #2D5F2D;
    border-radius: 24px;
    overflow: hidden;
    height: 40px;
    gap: 12px;
    transition: opacity 0.2s ease;
}

/* Decrease / increase buttons */
.pm-qc-decrease,
.pm-qc-increase {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    color: #2D5F2D;
    padding: 0;
    transition: background-color 0.15s ease;
}

.pm-qc-decrease:hover,
.pm-qc-increase:hover {
    background-color: rgba(45, 95, 45, 0.08);
}

.pm-qc-decrease:active,
.pm-qc-increase:active {
    background-color: rgba(45, 95, 45, 0.15);
}

/* Quantity number */
.pm-qc-qty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 100%;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    user-select: none;
    text-align: center;
}

/* ========================================
   State 3: Badge (green outlined circle)
   ======================================== */

.pm-qc-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #2D5F2D;
    color: #2D5F2D;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.pm-qc-badge:hover {
    background-color: rgba(45, 95, 45, 0.06);
    transform: scale(1.05);
}

.pm-qc-badge:active {
    transform: scale(0.95);
}

.pm-qc-badge-qty {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

/* ========================================
   Product card dim effect when editing
   Gebruik ::before overlay i.p.v. opacity op
   de parent — zo erven children het niet.
   ======================================== */

.product-card,
.product,
.wc-block-grid__product {
    position: relative;
}

/* Overlay altijd aanwezig maar transparant — zodat fade-in én fade-out werken */
.product-card::before,
.product::before,
.wc-block-grid__product::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    z-index: 1;
    border-radius: inherit;
    pointer-events: none;
    transition: background 0.25s ease;
}

.product-card.pm-qc-editing::before,
.product.pm-qc-editing::before,
.wc-block-grid__product.pm-qc-editing::before {
    background: rgba(255, 255, 255, 0.55);
}

/* Quick-cart zweeft boven de overlay */
.product-card.pm-qc-editing .quick-cart,
.product.pm-qc-editing .quick-cart,
.wc-block-grid__product.pm-qc-editing .quick-cart {
    position: relative;
    z-index: 2;
}

/* ========================================
   Animations
   ======================================== */

@keyframes pm-qc-pop-in {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.pm-qc-badge:not(.pm-qc-hidden) {
    animation: pm-qc-pop-in 0.25s ease-out;
}

@keyframes pm-qc-slide-in {
    0% { transform: scaleX(0.5); opacity: 0; }
    100% { transform: scaleX(1); opacity: 1; }
}

.pm-qc-controls:not(.pm-qc-hidden) {
    animation: pm-qc-slide-in 0.2s ease-out;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 480px) {
    .pm-qc-add-btn,
    .pm-qc-badge {
        width: 36px;
        height: 36px;
    }

    .pm-qc-controls {
        height: 36px;
    }

    .pm-qc-decrease,
    .pm-qc-increase {
        width: 32px;
        height: 32px;
    }
}

/* ========================================
   Checkmark flash na AJAX success
   ======================================== */

@keyframes pm-qc-check-in {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1);   opacity: 1; }
}

.pm-qc-check-flash {
    animation: pm-qc-check-in 0.25s ease-out forwards;
}
