

/* Tier Price Box - appears below form fields */
.tier-price-box {
    margin-top: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    position: relative;
}

.tier-price-box.loading {
    opacity: 0.6;
    pointer-events: none;
}

.tier-price-box.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #d70015;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.tier-price-box .tier-table-section {
    width: 100%;
}

.tier-price-box .tier-table-section > .label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: #333;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.tier-price-box .tier-prices {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
}

.tier-price-box .tier-prices td {
    padding: 10px 12px;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

.tier-price-box .tier-prices tr:last-child td {
    border-bottom: none;
}

.tier-price-box .tier-prices td:first-child {
    font-weight: 600;
    color: #333;
}

.tier-price-box .tier-prices td:last-child {
    text-align: right;
    font-weight: 600;
    color: #666;
}

.tier-price-box .tier-prices .current-tier-row {
    background: #fff5f5;
    box-shadow: inset 0 0 0 2px #d70015;
}

.tier-price-box .tier-prices .current-tier-row td {
    color: #d70015 !important;
    font-weight: 700 !important;
}

.tier-price-box .tier-prices .current-tier-row td:last-child::after {
    content: " ✓";
    color: #28a745;
}

.tier-price-hybrid-wrapper {
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.06);
    scroll-behavior: auto !important;
    border: 1px solid #f0f0f0;
}

/* Prevent scroll on input focus */
.manual-qty-input:focus {
    scroll-margin: 0 !important;
    scroll-padding: 0 !important;
}

/* Prevent parent containers from scrolling to tabs */
.field.qty .control {
    scroll-margin-top: 0 !important;
}

/* Force field.qty to stay open and disable collapsible behavior */
.field.qty[data-collapsible="true"],
.field.qty.active {
    pointer-events: none !important;
}

.field.qty .control.plus-minus-qty {
    pointer-events: auto !important;
}

.field.qty .qty-wrap {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
}

/* Prevent scroll on any input focus */
html {
    scroll-behavior: auto !important;
}

.tier-tabs-container {
    display: flex;
    border-bottom: 2px solid #d70015;
    background: #fafafa;
    margin-bottom: 0;
}

.tier-tab {
    flex: 1;
    padding: 12px 10px;
    text-align: center;
    cursor: pointer;
    border: none;
    background: #fafafa;
    color: #333;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    border-right: 1px solid #eee;
    position: relative;
}

.tier-tab:last-child {
    border-right: none;
}

.tier-tab:hover {
    background: #e5e5e5;
}

.tier-tab.active {
    background: white;
    color: #d70015;
}

.tier-tab.active::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: #d70015;
}

.tier-tab-qty {
    display: block;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #d70015;
}

.tier-tab-price {
    display: block;
    font-size: 13px;
    opacity: 0.85;
}

.tier-content-compact {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 12px;
    padding: 18px;
    align-items: end;
    background: #fff;
}

/* Quantity selector takes first column */
.tier-content-compact .manual-qty-compact {
    grid-column: 1;
    margin-bottom: 0;
}

/* Unit price, savings, subtotal each take one column */
.tier-content-compact .control.unit-price,
.tier-content-compact .control.savings,
.tier-content-compact .control.subtotal {
    border-radius: 8px;
    background: #f1f1f1;
    padding: 0;
}

.tier-content-compact .control.unit-price input,
.tier-content-compact .control.savings input,
.tier-content-compact .control.subtotal input {
    background: #f1f1f1;
    border: none;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
}

.tier-content-compact .control .label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #000;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}
table td,
table th {
    border-color: rgba(var(--base-color), var(--divider-alpha, .1));
    vertical-align: top;
    padding: 0.75rem 0.5rem !important;
}

/* Summary, template, notes span all 4 columns */
.tier-content-compact .summarydiv,
.tier-content-compact .templatediv,
.tier-content-compact .control.notes-main {
    grid-column: 1 / -1;
}

/* Tier info and table also span all columns */
.tier-content-compact .tier-info-compact,
.tier-content-compact .tier-table-compact {
    grid-column: 1 / -1;
}

.manual-qty-compact {
    background: transparent;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 0;
}

.manual-qty-compact .label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #000;
    margin-bottom: 10px;
    display: block;
    letter-spacing: 0.5px;
}

/* Quantity dropdown styling */
.qty-dropdown-selector,
.tier-content-compact select {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    font-weight: 400;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
}

.label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #333;
    margin-bottom: 12px;
    display: block;
    letter-spacing: 0.5px;
}

.qty-control-wrapper {
    display: flex;
    gap: 0;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.qty-btn {
    background: #3f4e57;
    border: none;
    width: 45px;
    height: 45px;
    font-size: 22px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0;
}

.qty-btn:hover {
    background: #d70015;
}

/* Simple quantity input field styling */
.manual-qty-compact .manual-qty-input,
.tier-price-hybrid-wrapper .manual-qty-input {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100px !important;
    height: 48px !important;
    padding: 12px 15px !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #333 !important;
    text-align: left !important;
    box-sizing: border-box !important;
    display: block !important;
    -moz-appearance: textfield;
}

.manual-qty-compact .manual-qty-input:focus,
.tier-price-hybrid-wrapper .manual-qty-input:focus {
    border-color: #3f4e57 !important;
    outline: none !important;
}

/* Hide number input spinners */
.manual-qty-input::-webkit-outer-spin-button,
.manual-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tier-info-compact {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.current-tier-badge {
    background: linear-gradient(135deg, #d70015 0%, #a80011 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.current-tier-badge::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0) 8%, rgba(255, 255, 255, 0.075) 10%, rgba(255, 255, 255, 0.15) 14%, rgba(255, 255, 255, 0) 30%);
    pointer-events: none;
}

.tier-status {
    position: relative;
    z-index: 1;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.tier-price-display {
    position: relative;
    z-index: 1;
    font-size: 20px;
    font-weight: 700;
}

.tier-upsell-box {
    background: #e8f4f8;
    border-left: 4px solid #28a745;
    padding: 14px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
}

.savings-highlight {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: 4px;
}

.tier-table-compact {
    background: #f1f1f1;
    border-radius: 8px;
    padding: 16px;
}

.tier-prices {
    width: 100%;
    border-collapse: collapse;
}

.tier-prices td {
    padding: 10px 8px;
    font-size: 13px;
    border-bottom: 1px solid #e0e0e0;
    line-height: 1.4;
}

.tier-prices tr:last-child td {
    border-bottom: none;
}

.tier-prices td:first-child {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.tier-prices td:last-child {
    color: #666;
    text-align: right;
    font-weight: 600;
}

.current-tier-row {
    background: white;
    border-radius: 4px;
    box-shadow: 0 0 0 2px #d70015 inset;
}

.current-tier-row td {
    color: #d70015 !important;
    font-weight: 700 !important;
}

.current-tier-row td:last-child::after {
    content: " ✓";
    color: #28a745;
}

/* Actions button styling */
.field.qty + .actions {
    margin-top: 0;
}

.product-info-wrapper .box-tocart .fieldset .field.qty .control .label {
    padding-left: 5px;
}

/* Tablet and below (1200px) */
@media (max-width: 1200px) {
    .tier-content-compact {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        padding: 20px;
    }

    .tier-content-compact .manual-qty-compact {
        grid-column: 1 / -1;
    }

    .tier-content-compact .control.unit-price {
        grid-column: 1;
    }

    .tier-content-compact .control.savings {
        grid-column: 2;
    }

    .tier-content-compact .control.subtotal {
        grid-column: 1 / -1;
    }

    .tier-content-compact .summarydiv,
    .tier-content-compact .templatediv,
    .tier-content-compact .control.notes-main {
        grid-column: 1 / -1;
    }
}

/* Small tablets and large phones (768px) */
@media (max-width: 768px) {
    .tier-tabs-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .tier-tab {
        min-width: 110px;
        flex-shrink: 0;
        padding: 12px 10px;
        font-size: 13px;
    }

    .tier-tab-qty {
        font-size: 20px;
        margin-bottom: 2px;
    }

    .tier-tab-price {
        font-size: 12px;
    }

    .tier-content-compact {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 16px;
    }

    .tier-content-compact .manual-qty-compact {
        grid-column: 1 / -1;
    }

    .tier-content-compact .control.unit-price,
    .tier-content-compact .control.savings {
        grid-column: auto;
    }

    .tier-content-compact .control.subtotal {
        grid-column: 1 / -1;
    }

    .tier-content-compact .tier-info-compact,
    .tier-content-compact .tier-table-compact {
        grid-column: 1 / -1;
    }

    .label {
        font-size: 11px;
        margin-bottom: 10px;
    }

    .qty-control-wrapper {
        height: 50px;
    }

    .qty-btn {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .manual-qty-input {
        font-size: 16px;
    }

    .current-tier-badge {
        padding: 10px 14px;
    }

    .tier-status {
        font-size: 12px;
    }

    .tier-price-display {
        font-size: 18px;
    }

    .tier-upsell-box {
        padding: 12px;
        font-size: 12px;
    }

    .savings-highlight {
        display: block;
        margin-left: 0;
        margin-top: 6px;
        text-align: center;
    }

    .tier-prices td {
        padding: 8px 6px;
        font-size: 12px;
    }
}

/* Mobile phones (576px and below) */
@media (max-width: 576px) {
    .tier-price-hybrid-wrapper {
        border-radius: 6px;
    }

    .tier-tabs-container {
        gap: 0;
    }

    .tier-tab {
        min-width: 90px;
        padding: 10px 8px;
        font-size: 12px;
    }

    .tier-tab-qty {
        font-size: 18px;
    }

    .tier-tab-price {
        font-size: 11px;
    }

    .tier-content-compact {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 12px;
    }

    .tier-content-compact .manual-qty-compact,
    .tier-content-compact .control.unit-price,
    .tier-content-compact .control.savings,
    .tier-content-compact .control.subtotal,
    .tier-content-compact .tier-info-compact,
    .tier-content-compact .tier-table-compact {
        grid-column: 1;
    }

    .manual-qty-compact,
    .tier-info-compact,
    .tier-table-compact {
        padding: 12px;
    }

    .tier-content-compact .control.unit-price,
    .tier-content-compact .control.savings,
    .tier-content-compact .control.subtotal {
        padding: 0;
    }

    .tier-content-compact .control.unit-price input,
    .tier-content-compact .control.savings input,
    .tier-content-compact .control.subtotal input {
        padding: 12px;
    }

    .label {
        font-size: 10px;
        margin-bottom: 8px;
    }

    .qty-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .manual-qty-input {
        font-size: 16px;
        padding: 10px;
    }

    .current-tier-badge {
        padding: 8px 12px;
    }

    .tier-status {
        font-size: 11px;
        margin-bottom: 3px;
    }

    .tier-price-display {
        font-size: 16px;
    }

    .tier-upsell-box {
        padding: 10px;
        font-size: 11px;
        line-height: 1.5;
    }

    .savings-highlight {
        padding: 2px 6px;
        font-size: 11px;
    }

    .tier-prices td {
        padding: 6px 4px;
        font-size: 11px;
    }

    .tier-prices td:first-child {
        white-space: normal;
    }
}

/* Extra small devices (400px and below) */
@media (max-width: 400px) {
    .tier-tab {
        min-width: 75px;
        padding: 8px 6px;
    }

    .tier-tab-qty {
        font-size: 16px;
    }

    .tier-tab-price {
        font-size: 10px;
    }

    .tier-content-compact {
        padding: 10px;
        gap: 10px;
    }

    .qty-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .manual-qty-input {
        font-size: 14px;
    }

    .tier-status {
        font-size: 10px;
    }

    .tier-price-display {
        font-size: 14px;
    }

    .tier-upsell-box {
        font-size: 10px;
    }

    .tier-prices td {
        font-size: 10px;
        padding: 5px 3px;
    }
}
/* --- FIXED RESPONSIVE STYLES FOR TIER PRICING --- */

/* Large screens - 4 column layout */
@media (min-width: 1201px) {
    .tier-content-compact {
        grid-template-columns: 1fr 1fr 1fr 1fr !important;
        gap: 15px !important;
    }

    .tier-content-compact .manual-qty-compact {
        grid-column: 1 !important;
    }

    .tier-content-compact .control.unit-price {
        grid-column: 2 !important;
    }

    .tier-content-compact .control.savings {
        grid-column: 3 !important;
    }

    .tier-content-compact .control.subtotal {
        grid-column: 4 !important;
    }

    .tier-content-compact .tier-table-compact,
    .tier-content-compact .tier-info-compact,
    .tier-content-compact .summarydiv,
    .tier-content-compact .templatediv,
    .tier-content-compact .control.notes-main {
        grid-column: 1 / -1 !important;
    }
}

/* Tablets and small laptops (max-width: 820px) */
@media (max-width: 820px) {
    .tier-content-compact {
        grid-template-columns: 1fr !important;
        padding: 16px !important;
    }

    .manual-qty-compact,
    .tier-info-compact,
    .tier-table-compact {
        grid-column: 1 / -1;
        width: 100%;
    }

    .tier-tabs-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .tier-tab {
        flex: 0 0 auto;
        min-width: 120px;
    }
}

/* Mobile (max-width: 576px) */
@media (max-width: 576px) {
    .tier-content-compact {
        grid-template-columns: 1fr !important;
        padding: 12px !important;
        gap: 12px !important;
    }

    .manual-qty-compact,
    .tier-info-compact,
    .tier-table-compact {
        width: 100%;
    }

    .tier-tabs-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .tier-tab {
        min-width: 100px;
        font-size: 12px;
        padding: 8px 6px;
    }

    .tier-prices td {
        font-size: 12px;
        padding: 8px 6px;
        white-space: nowrap;
    }

    .tier-prices {
        display: inline-table;
        overflow-x: auto;
    }
}

/* Very small devices (max-width: 400px) */
@media (max-width: 400px) {
    .tier-tab {
        min-width: 90px;
        font-size: 11px;
    }

    .manual-qty-input {
        font-size: 14px;
    }

    .qty-btn {
        width: 40px;
        height: 40px;
    }

    .tier-prices td {
        font-size: 11px;
    }
}
/* --- TIER TABS RESPONSIVE FIX --- */

/* Default desktop layout (inline tabs) */
.tier-tabs-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

/* Tablet and below (stack tabs vertically) */
@media (max-width: 820px) {
    .tier-tabs-container {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .tier-tab {
        width: 100%;
        text-align: left;
        justify-content: space-between;
        display: flex;
        align-items: center;
    }
}

/* Mobile fine-tuning */
@media (max-width: 480px) {
    .tier-tab {
        font-size: 13px;
        padding: 10px 12px;
    }

    .tier-tab span {
        display: block;
    }

    .tier-tab-price {
        font-weight: 600;
    }
}
.box-tocart .fieldset .field.qty {
    display: block !important;
}

/* Medium screens - 2 column layout */
@media (max-width: 1200px) and (min-width: 577px) {
    .tier-content-compact {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        padding: 20px !important;
    }

    .tier-content-compact .manual-qty-compact {
        grid-column: 1 / -1 !important;
    }

    .tier-content-compact .control.unit-price {
        grid-column: 1 !important;
    }

    .tier-content-compact .control.savings {
        grid-column: 2 !important;
    }

    .tier-content-compact .control.subtotal {
        grid-column: 1 / -1 !important;
    }

    .tier-content-compact .tier-table-compact,
    .tier-content-compact .tier-info-compact,
    .tier-content-compact .summarydiv,
    .tier-content-compact .templatediv,
    .tier-content-compact .control.notes-main {
        grid-column: 1 / -1 !important;
    }
}

