/**
 * Quantity Discounts - Frontend Styles
 * 
 * Professional horizontal layout with radio buttons
 * Match design from reference image
 * 
 * @package OSO
 * @since 1.3.0
 */

/* ===========================
   Main Container
   =========================== */
.oso-qty-discounts-wrapper {
    margin: 25px 0;
    padding: 0;
    background: transparent;
}

.oso-qty-discounts-title {
    margin: 0 0 18px 0;
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    justify-content: var(--oso-qty-discounts-title-align, center);
    gap: 8px;
}

.oso-qty-discounts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ===========================
   Discount Card — base (layout set by --ltr / --rtl wrapper class)
   =========================== */
.oso-qty-discount-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "content prices";
    align-items: center;
    column-gap: 20px;
    padding: 22px 20px 18px;
    background: #ffffff;
    border: 2px solid #ffb74d;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.15);
    direction: ltr;
}

.oso-qty-discount-card:hover {
    border-color: #ff9800;
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.25);
    transform: translateY(-2px) scale(1.01);
    background: #fffbf5;
}

.oso-qty-discount-card.oso-qty-discount-selected {
    border-color: #ff6b35;
    border-width: 3px;
    background: #fff8f0;
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.3);
    transform: scale(1.02);
}

/* Spacer — legacy node, hidden in grid layout */
.oso-qty-discount-spacer {
    display: none;
}

/* ===========================
   Radio Button (Custom Style)
   =========================== */
.oso-qty-discount-radio {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.oso-qty-discount-radio-input {
    width: 22px;
    height: 22px;
    cursor: pointer;
    margin: 0;
    accent-color: #ff6b35;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid #ffb74d;
    border-radius: 50%;
    background: #fff;
    position: relative;
    transition: all 0.2s ease;
}

.oso-qty-discount-radio-input:hover {
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.1);
}

.oso-qty-discount-radio-input:checked {
    border-color: #ff6b35;
    border-width: 6px;
    background: #fff;
}

.oso-qty-discount-radio-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

/* Content: radio + tier text */
.oso-qty-discount-content {
    grid-area: content;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
    width: 100%;
}

/* Badge — default LTR: top-right */
.oso-qty-discount-badge {
    position: absolute;
    top: -17px;
    right: 20px;
    left: auto;
    padding: 7px 16px;
    background: linear-gradient(135deg, #e53935 0%, #ff5722 100%);
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    border-radius: 20px;
    letter-spacing: 0.6px;
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.5);
    border: 2px solid #ffffff;
    white-space: nowrap;
}

.oso-qty-discount-card:hover .oso-qty-discount-badge {
    box-shadow: 0 6px 16px rgba(229, 57, 53, 0.6);
    transform: scale(1.05);
}

/* Left Group (Text + Savings) */
.oso-qty-discount-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 250px;
}

/* Text (Main description) */
.oso-qty-discount-text {
    font-size: 18px;
    font-weight: 700;
    color: #bf360c;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(191, 54, 12, 0.1);
    text-align: left;
}

/* Prices — default LTR: right column, below badge */
.oso-qty-discount-prices {
    grid-area: prices;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    align-self: start;
    gap: 8px;
    margin-top: 6px;
    white-space: nowrap;
}

.oso-qty-discount-price-new {
    font-size: 20px;
    font-weight: 900;
    color: #d84315;
    line-height: 1;
    padding: 0;
    background: transparent;
}

.oso-qty-discount-price-old {
    font-size: 16px;
    font-weight: 600;
    color: #9e9e9e;
    text-decoration: line-through;
    line-height: 1;
    padding: 0;
    background: transparent;
}

/* Savings (Below main text) */
.oso-qty-discount-savings {
    font-size: 14px;
    color: #d84315;
    font-weight: 700;
}

.oso-qty-discount-savings strong {
    color: #bf360c;
    font-weight: 800;
}

/* ===========================
   LTR layout (default) — Image 1
   Radio + text LEFT | Badge + prices RIGHT
   =========================== */
.oso-qty-discounts--ltr .oso-qty-discount-card {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "content prices";
}

.oso-qty-discounts--ltr .oso-qty-discount-badge {
    right: 20px;
    left: auto;
}

.oso-qty-discounts--ltr .oso-qty-discount-content {
    flex-direction: row;
    justify-content: flex-start;
}

.oso-qty-discounts--ltr .oso-qty-discount-text {
    text-align: left;
}

.oso-qty-discounts--ltr .oso-qty-discount-prices {
    justify-content: flex-end;
    align-self: start;
}

/* ===========================
   RTL layout — Image 2
   Badge + prices LEFT | Radio + text RIGHT
   =========================== */
.oso-qty-discounts--rtl .oso-qty-discount-card {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "prices content";
}

.oso-qty-discounts--rtl .oso-qty-discount-badge {
    left: 20px;
    right: auto;
}

.oso-qty-discounts--rtl .oso-qty-discount-prices {
    justify-content: flex-start;
    align-self: start;
}

.oso-qty-discounts--rtl .oso-qty-discount-content {
    flex-direction: row-reverse;
    justify-content: flex-start; /* flex-start = right edge in row-reverse */
}

.oso-qty-discounts--rtl .oso-qty-discount-text {
    text-align: right;
}

/* ===========================
   Large Desktop (max-width: 1400px)
   =========================== */
@media (max-width: 1400px) {
    .oso-qty-discount-card {
        padding: 17px 19px;
        gap: 9px 14px;
    }
    
    .oso-qty-discount-badge {
        font-size: 11px;
        padding: 6px 15px;
        top: -16px;
    }
    
    .oso-qty-discount-text {
        font-size: 17px;
    }
    
    .oso-qty-discount-prices {
        gap: 8px;
    }
    
    .oso-qty-discount-price-new {
        font-size: 19px;
    }
    
    .oso-qty-discount-price-old {
        font-size: 16px;
    }
    
    .oso-qty-discount-radio-input {
        width: 21px;
        height: 21px;
    }
}

/* ===========================
   Medium Desktop (max-width: 1200px)
   Product page = half screen (~600px)
   =========================== */
@media (max-width: 1200px) {
    .oso-qty-discount-card {
        padding: 15px 17px;
        gap: 8px 12px;
    }
    
    .oso-qty-discount-badge {
        font-size: 10px;
        padding: 5px 13px;
        top: -15px;
    }
    
    .oso-qty-discount-content {
        gap: 10px;
    }
    
    .oso-qty-discount-text {
        font-size: 16px;
    }
    
    .oso-qty-discount-prices {
        gap: 8px;
    }
    
    .oso-qty-discount-price-new {
        font-size: 18px;
    }
    
    .oso-qty-discount-price-old {
        font-size: 15px;
    }
    
    .oso-qty-discount-radio-input {
        width: 20px;
        height: 20px;
    }
}

/* ===========================
   DEAD ZONE - Critical! (max-width: 1024px)
   Product page = half screen (~512px)
   =========================== */
@media (max-width: 1024px) {
    .oso-qty-discount-card {
        padding: 13px 15px;
        gap: 7px 10px;
    }
    
    .oso-qty-discount-badge {
        font-size: 10px;
        padding: 5px 12px;
        top: -14px;
    }
    
    .oso-qty-discount-content {
        gap: 9px;
    }
    
    .oso-qty-discount-text {
        font-size: 15px;
    }
    
    .oso-qty-discount-prices {
        gap: 7px;
    }
    
    .oso-qty-discount-price-new {
        font-size: 16px;
    }
    
    .oso-qty-discount-price-old {
        font-size: 13px;
    }
    
    .oso-qty-discount-radio-input {
        width: 19px;
        height: 19px;
    }
}

/* ===========================
   Small Dead Zone (max-width: 900px)
   Product page = half screen (~450px)
   =========================== */
@media (max-width: 900px) {
    .oso-qty-discount-card {
        padding: 12px 14px;
        gap: 6px 9px;
    }
    
    .oso-qty-discount-badge {
        font-size: 9px;
        padding: 4px 11px;
        top: -13px;
    }
    
    .oso-qty-discount-content {
        gap: 8px;
    }
    
    .oso-qty-discount-text {
        font-size: 14px;
    }
    
    .oso-qty-discount-prices {
        gap: 6px;
    }
    
    .oso-qty-discount-price-new {
        font-size: 15px;
    }
    
    .oso-qty-discount-price-old {
        font-size: 12px;
    }
    
    .oso-qty-discount-radio-input {
        width: 18px;
        height: 18px;
    }
}

/* ===========================
   Tablet Portrait (max-width: 768px)
   Still horizontal layout, more compact
   =========================== */
@media (max-width: 768px) {
    .oso-qty-discount-card {
        padding: 12px 14px;
        gap: 6px 9px;
    }
    
    .oso-qty-discount-badge {
        font-size: 9px;
        padding: 4px 11px;
        top: -13px;
    }
    
    .oso-qty-discount-content {
        gap: 8px;
    }
    
    .oso-qty-discount-text {
        font-size: 14px;
    }
    
    .oso-qty-discount-prices {
        gap: 6px;
    }
    
    .oso-qty-discount-price-new {
        font-size: 15px;
    }
    
    .oso-qty-discount-price-old {
        font-size: 12px;
    }
    
    .oso-qty-discount-radio-input {
        width: 18px;
        height: 18px;
    }
}

/* ===========================
   Small screens — keep same LTR/RTL grid, tighter spacing
   =========================== */
@media (max-width: 480px) {
    .oso-qty-discount-card {
        column-gap: 12px;
        padding: 22px 14px 14px;
    }

    .oso-qty-discount-text {
        font-size: 15px;
    }

    .oso-qty-discount-price-new {
        font-size: 17px;
    }

    .oso-qty-discount-price-old {
        font-size: 13px;
    }

    .oso-qty-discount-badge {
        font-size: 10px;
        padding: 5px 12px;
    }

    .oso-qty-discounts--ltr .oso-qty-discount-badge {
        right: 14px;
        left: auto;
    }

    .oso-qty-discounts--rtl .oso-qty-discount-badge {
        left: 14px;
        right: auto;
    }
}

/* ===========================
   Integration: Faded Upsells
   =========================== */
.oso-upsells-wrapper.oso-faded {
    opacity: 0.5;
    pointer-events: none;
}

/* ===========================
   Loading State (Optional)
   =========================== */
.oso-qty-discounts-loading {
    opacity: 0.6;
    pointer-events: none;
}

.oso-qty-discounts-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #46b450;
    border-radius: 50%;
    animation: oso-qty-spin 0.8s linear infinite;
}

@keyframes oso-qty-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}
