/* ── Pricing table ─────────────────────────────────────────────────────────── */
.sqp-pricing-table {
    margin: 16px 0 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    font-size: 14px;
}

.sqp-pricing-table__title {
    margin: 0;
    padding: 10px 16px;
    background: #f6f7f7;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sqp-table {
    width: 100%;
    border-collapse: collapse;
}

.sqp-table th {
    background: #f6f7f7;
    padding: 8px 14px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #50575e;
    border-bottom: 1px solid #e0e0e0;
}

.sqp-table td {
    padding: 9px 14px;
    border-bottom: 1px solid #f0f0f1;
}

.sqp-tier--base td {
    color: #50575e;
}

.sqp-tier--discount td {
    color: #1d2327;
}

/* Active tier highlight */
.sqp-tier--active {
    background: #f0f9f0 !important;
}

.sqp-tier--active td {
    font-weight: 700;
    color: #007a1e !important;
}

.sqp-tier--active .sqp-tier__qty::after {
    content: ' ← ';
    font-size: 11px;
    opacity: .7;
}

/* Discount badge */
.sqp-badge {
    display: inline-block;
    background: #007a1e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
}

/* Live update badge */
.sqp-live-badge {
    display: inline-block;
    background: #007a1e;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle;
}

/* Cart discount badge */
.sqp-discount-badge {
    display: inline-block;
    background: #007a1e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    margin-left: 4px;
}

.sqp-pricing-table__note {
    margin: 0;
    padding: 8px 14px;
    font-size: 11px;
    color: #50575e;
    background: #fafafa;
    border-top: 1px solid #f0f0f1;
}

/* ── Price trigger ──────────────────────────────────────────────────────────── */
.sqp-hidden { display: none !important; }

/*
 * Hide the WooCommerce Blocks price component when SQP rules are active.
 * The theme uses a block-based product template, so PHP hooks don't reach it.
 * body.sqp-active has higher specificity than the block's own single-class rule,
 * so no !important is needed.
 */
body.sqp-active .wc-block-components-product-price,
body.sqp-active .wc-block-grid__product-price {
    display: none;
}

.sqp-trigger-wrap {
    margin: 4px 0 16px;
}

.sqp-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: #f4f6f8;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    flex-wrap: wrap;
}

.sqp-trigger__prices {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 14px;
    color: #6b7280;
}

.sqp-trigger__from strong,
.sqp-trigger__base strong {
    color: #111827;
    font-weight: 700;
}

.sqp-trigger__sep {
    color: #d1d5db;
}

.sqp-trigger__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
    flex-shrink: 0;
}
.sqp-trigger__btn:hover {
    background: #1f2937;
}
.sqp-trigger__btn svg {
    stroke: currentColor;
    flex-shrink: 0;
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.sqp-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.sqp-modal[hidden] { display: none; }

.sqp-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(2px);
}

.sqp-modal__dialog {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    max-width: 860px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: sqpModalIn .2s cubic-bezier(.32,1,.37,1);
}
@keyframes sqpModalIn {
    from { opacity: 0; transform: scale(.96) translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.sqp-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e4e7ec;
    flex-shrink: 0;
}

.sqp-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
}

.sqp-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #f4f6f8;
    border: 1px solid #e4e7ec;
    border-radius: 50%;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    transition: background .12s;
    flex-shrink: 0;
}
.sqp-modal__close:hover { background: #e4e7ec; }
.sqp-modal__close svg { stroke: currentColor; }

.sqp-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 24px;
}

.sqp-modal__subtitle {
    margin: 0 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}
.sqp-modal__subtitle strong {
    color: #111827;
}

/* Horizontal table */
.sqp-modal__table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
}

.sqp-htable {
    width: 100%;
    border-collapse: collapse;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    font-size: 14px;
    white-space: nowrap;
}

.sqp-htable th {
    background: #f4f6f8;
    padding: 10px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6b7280;
    border-right: 1px solid #e4e7ec;
    white-space: nowrap;
    min-width: 140px;
}

.sqp-htable td {
    padding: 10px 16px;
    text-align: center;
    border-right: 1px solid #e4e7ec;
    border-top: 1px solid #e4e7ec;
    color: #111827;
    font-weight: 500;
}
.sqp-htable td:last-child,
.sqp-htable th:last-child {
    border-right: none;
}

.sqp-htable__row-qty td {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    background: #f9fafb;
}

.sqp-htable__row-price td {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.sqp-modal__note {
    margin: 14px 0 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    font-size: 12px;
    color: #9ca3af;
}

@media (max-width: 600px) {
    .sqp-trigger {
        flex-direction: column;
        align-items: flex-start;
    }
    .sqp-trigger__btn { width: 100%; justify-content: center; }
    .sqp-modal__dialog { border-radius: 12px 12px 0 0; max-height: 85vh; align-self: flex-end; width: 100%; }
    .sqp-modal { padding: 0; align-items: flex-end; }
}
