/* ═══════════════════════════════════════════════════
 * Quantity Discount — front.css v5.0
 *
 * Kolory: --qd-accent, --qd-accent-bg, --qd-accent-badge-bg
 * ustawiane dynamicznie przez front.js z hex koloru akcentu.
 * CSS NIE definiuje fallbacków — JS zawsze odpala init().
 * ═══════════════════════════════════════════════════ */

.qd-block {
    --qd-accent: #D84A1B;
    --qd-accent-bg: transparent;
    --qd-accent-badge-bg: transparent;
    --qd-border: #e5e7eb;
    --qd-disabled-bg: #f3f4f6;
    --qd-disabled-text: #9ca3af;
    --qd-oos-bg: #fee2e2;
    --qd-oos-text: #991b1b;
    --qd-radius: 10px;
    --qd-transition: 0.15s ease;

    margin: 0.75rem 0 1.25rem;
    font-family: inherit;
    box-sizing: border-box;
}

/* ── Etykieta ── */
.qd-label {
    margin: 0 0 8px;
    padding: 0;
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.4;
}

/* ── Lista ── */
.qd-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
}

/* ── Opcja ── */
.qd-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--qd-border);
    border-radius: var(--qd-radius);
    cursor: pointer;
    user-select: none;
    transition: border-color var(--qd-transition), background-color var(--qd-transition);
    box-sizing: border-box;
}

.qd-option:hover:not(.qd-option--disabled) {
    border-color: var(--qd-accent);
    background-color: var(--qd-accent-bg);
}

.qd-option--selected {
    border-color: var(--qd-accent) !important;
    background-color: var(--qd-accent-bg) !important;
}

.qd-option--disabled {
    background: var(--qd-disabled-bg) !important;
    border-color: var(--qd-border) !important;
    cursor: not-allowed;
    opacity: 0.65;
}

/* ── Radio ── */
.qd-radio {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--qd-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--qd-transition);
    flex-shrink: 0;
}

.qd-option--selected .qd-radio {
    border-color: var(--qd-accent);
}

.qd-option--disabled .qd-radio {
    border-color: var(--qd-disabled-text);
}

.qd-radio__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--qd-accent);
    transform: scale(0);
    transition: transform var(--qd-transition);
}

.qd-option--selected .qd-radio__dot {
    transform: scale(1);
}

/* ── Info (nazwa + oszczędność) ── */
.qd-option__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.qd-option__name {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    line-height: 1.3;
}

.qd-option--disabled .qd-option__name {
    color: var(--qd-disabled-text);
}

.qd-option__save {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.3;
}

/* ── Cena — kolor akcentu ── */
.qd-option__price {
    font-size: 14px;
    font-weight: 500;
    color: var(--qd-accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.qd-option--disabled .qd-option__price {
    color: var(--qd-disabled-text);
}

/* ── Badge oszczędności — kolor akcentu ── */
.qd-badge {
    font-size: 11px;
    font-weight: 500;
    background: var(--qd-accent-badge-bg);
    color: var(--qd-accent);
    border-radius: 20px;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.5;
}

/* ── Badge niedostępny ── */
.qd-out-of-stock {
    font-size: 11px;
    font-weight: 500;
    background: var(--qd-oos-bg);
    color: var(--qd-oos-text);
    border-radius: 20px;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Przycisk "Do koszyka" ── */
.qd-cart-btn {
    background: var(--qd-accent);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity var(--qd-transition), transform var(--qd-transition);
    line-height: 1.4;
}

.qd-cart-btn:hover {
    opacity: 0.85;
}

.qd-cart-btn:active {
    transform: scale(0.97);
}

.qd-cart-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ── Spinner ── */
.qd-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: qd-spin 0.6s linear infinite;
}

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

/* ── Łączna cena ── */
.qd-total {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 0;
    font-size: 13px;
    color: #6b7280;
    padding: 0;
    line-height: 1.5;
}

.qd-total__value {
    font-size: 17px;
    font-weight: 700;
    color: var(--qd-accent);
}

/* ── Responsywność ── */
@media (max-width: 480px) {
    .qd-option {
        padding: 10px 11px;
        gap: 8px;
        flex-wrap: wrap;
    }
    .qd-option__name { font-size: 13px; }
    .qd-option__price { font-size: 13px; }
    .qd-option__save { font-size: 11px; }
    .qd-badge { font-size: 10px; padding: 1px 6px; }
    .qd-cart-btn { font-size: 11px; padding: 6px 10px; }
    .qd-total__value { font-size: 15px; }
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
    .qd-block {
        --qd-border: #374151;
        --qd-disabled-bg: #1f2937;
        --qd-disabled-text: #6b7280;
        --qd-oos-bg: #450a0a;
        --qd-oos-text: #fca5a5;
    }
    .qd-option { background: #111827; }
    .qd-option__name { color: #f9fafb; }
    .qd-option__save { color: #9ca3af; }
}