/**
 * Medical Trust Promotions - Quantity Picker Frontend Styles
 * Version: 3.4.0
 * Styl: A5 - Z checkmark w rogu (poziomy layout)
 */

/* Container */
/* Domyślnie ukryty na desktopie - widoczny tylko na mobile */
.mtp-quantity-picker {
    display: none;
    margin: 20px 0 25px;
    padding: 16px;
    background: #fff;
    border-radius: 12px;
}

/* Pokaż picker tylko na urządzeniach mobilnych (szerokość <= 768px) */
@media (max-width: 768px) {
    .mtp-quantity-picker {
        display: block;
    }
}

.mtp-picker-title {
    margin: 0 0 12px;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-transform: none;
    letter-spacing: 0;
}

/* Options container - POZIOMY LAYOUT */
.mtp-picker-options {
    display: flex;
    gap: 8px;
}

/* Single option - kafelek */
/* Specyficzny selektor dla uniknięcia konfliktów */
.mtp-quantity-picker .mtp-picker-options .mtp-picker-option {
    flex: 1;
    position: relative !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    padding: 14px 6px;
    background: #fff;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    overflow: visible;
}

.mtp-quantity-picker .mtp-picker-options .mtp-picker-option:hover {
    border-color: #52ac71;
    box-shadow: 0 2px 8px rgba(82, 172, 113, 0.15);
}

/* Aktywny kafelek - styl A5 */
.mtp-quantity-picker .mtp-picker-options .mtp-picker-option.selected {
    border-color: #52ac71;
    background: #fff;
    box-shadow: 0 4px 12px rgba(82, 172, 113, 0.15);
}

/* Badge */
.mtp-badge {
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 8px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-radius: 10px;
    color: #fff;
    white-space: nowrap;
    z-index: 1;
}

.mtp-badge.popular {
    background: #52ac71;
}

.mtp-badge.best-value {
    background: #1a1a1a;
}

/* Radio input hidden */
.mtp-picker-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Checkmark w rogu - styl A5 */
/* WAŻNE: Specyficzne selektory z !important zapobiegają konfliktom z innymi stylami */
.mtp-quantity-picker .mtp-picker-options .mtp-picker-option .mtp-option-checkmark {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    background: #52ac71;
    border-radius: 50%;
    border: 2px solid #fff;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 10;
    pointer-events: none;
}

/* Checkmark widoczny TYLKO dla wybranej opcji */
.mtp-quantity-picker .mtp-picker-options .mtp-picker-option.selected .mtp-option-checkmark {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Duza liczba (qty) */
.mtp-option-qty {
    font-size: 32px;
    font-weight: 800;
    color: #333;
    line-height: 1;
    transition: color 0.2s ease;
}

.mtp-quantity-picker .mtp-picker-options .mtp-picker-option.selected .mtp-option-qty {
    color: #52ac71;
}

/* Jednostka (szt.) */
.mtp-option-unit {
    font-size: 11px;
    color: #999;
    margin-bottom: 6px;
}

/* Cena */
.mtp-option-price {
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

.mtp-option-price .woocommerce-Price-amount {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

/* Oszczednosc */
.mtp-option-save {
    font-size: 10px;
    color: #52ac71;
    font-weight: 600;
    margin-top: 2px;
}

/* Responsive - mobile */
@media (max-width: 600px) {
    .mtp-quantity-picker {
        padding: 12px;
        margin: 15px 0 20px;
    }

    .mtp-picker-options {
        gap: 6px;
    }

    .mtp-picker-option {
        padding: 12px 4px;
    }

    .mtp-option-qty {
        font-size: 28px;
    }

    .mtp-option-unit {
        font-size: 10px;
    }

    .mtp-option-price {
        font-size: 13px;
    }

    .mtp-option-save {
        font-size: 9px;
    }

    .mtp-badge {
        font-size: 8px;
        padding: 2px 6px;
    }

    .mtp-quantity-picker .mtp-picker-options .mtp-picker-option .mtp-option-checkmark {
        width: 20px;
        height: 20px;
        top: 4px;
        right: 4px;
        font-size: 10px;
    }
}

/* Loading state */
.mtp-quantity-picker.loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.mtp-quantity-picker.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #52ac71;
    border-top-color: transparent;
    border-radius: 50%;
    animation: mtp-spin 0.8s linear infinite;
}

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

/* Animation for option selection */
.mtp-quantity-picker .mtp-picker-options .mtp-picker-option.selected {
    animation: mtp-pulse 0.3s ease;
}

@keyframes mtp-pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}
