/* ==========================================================================
   Pricing Matrix Table — MALFINI Product Pages
   ========================================================================== */

.openhaft-pricing-matrix {
    margin: 1.5rem 0;
    width: 100%;
}

/* ---- Header ---- */
.openhaft-matrix-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0;
    padding: 0.75rem 1rem;
    background: var(--color-dark, #1A1A1A);
    color: #fff;
    border-radius: 6px 6px 0 0;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
}

.openhaft-matrix-header__swatch {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

/* ---- Scrollable table wrapper ---- */
.openhaft-matrix-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--color-gray-300, rgba(255, 255, 255, 0.08));
    border-top: none;
    border-radius: 0 0 6px 6px;
}

.openhaft-matrix-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 0.875rem;
}

/* ---- Table header ---- */
.openhaft-matrix-table thead th {
    background: var(--color-dark, #1A1A1A);
    color: #fff;
    padding: 0.625rem 0.75rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.openhaft-matrix-table thead th:first-child {
    text-align: left;
}

.openhaft-matrix-table thead th:last-child {
    border-right: none;
}

.openhaft-matrix-table thead th.is-active-tier {
    background: var(--color-gold, #F5C842);
    color: var(--color-dark, #1A1A1A);
}

/* ---- Table body ---- */
.openhaft-matrix-table tbody td {
    padding: 0.5rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--color-gray-300, rgba(255, 255, 255, 0.08));
    border-right: 1px solid var(--color-gray-300, rgba(255, 255, 255, 0.08));
    vertical-align: middle;
}

.openhaft-matrix-table tbody td:first-child {
    text-align: left;
    font-weight: 700;
}

.openhaft-matrix-table tbody td:last-child {
    border-right: none;
}

.openhaft-matrix-table tbody tr:last-child td {
    border-bottom: none;
}

.openhaft-matrix-table tbody tr:hover {
    background: rgba(245, 200, 66, 0.04);
}

/* Active tier column highlight */
.openhaft-matrix-table tbody td.is-active-tier {
    background: rgba(245, 200, 66, 0.08);
    font-weight: 700;
}

/* ---- Size cell ---- */
.openhaft-matrix-size {
    font-weight: 700;
    font-size: 0.9rem;
}

/* ---- Stock badge ---- */
.openhaft-matrix-stock {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

.openhaft-matrix-stock--in {
    color: var(--accent-success);
    background: rgba(67, 160, 71, 0.1);
}

.openhaft-matrix-stock--low {
    color: #e65100;
    background: rgba(230, 81, 0, 0.1);
}

.openhaft-matrix-stock--out {
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.03);
}

/* ---- Price cells ---- */
.openhaft-matrix-price {
    font-size: 0.85rem;
    color: var(--color-dark, #1A1A1A);
    white-space: nowrap;
}

/* ---- Out of stock row ---- */
.openhaft-matrix-table tbody tr.is-out-of-stock {
    opacity: 0.65;
}

.openhaft-matrix-table tbody tr.is-out-of-stock td {
    background: var(--color-gray-100, #F8F7F4);
}

.openhaft-matrix-table tbody tr.is-out-of-stock:hover {
    background: var(--color-gray-100, #F8F7F4);
}

/* ---- Qty input ---- */
.openhaft-matrix-qty {
    width: 64px;
    padding: 0.35rem 0.25rem;
    text-align: center;
    border: 1px solid var(--color-gray-300, rgba(255, 255, 255, 0.08));
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: var(--font-body);
    -moz-appearance: textfield;
}

.openhaft-matrix-qty::-webkit-inner-spin-button,
.openhaft-matrix-qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.openhaft-matrix-qty:focus {
    outline: none;
    border-color: var(--color-gold, #F5C842);
    box-shadow: 0 0 0 2px rgba(245, 200, 66, 0.25);
}

.openhaft-matrix-qty:disabled {
    background: var(--color-gray-100, #F8F7F4);
    cursor: not-allowed;
    opacity: 0.5;
}

/* ---- Summary bar ---- */
.openhaft-matrix-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: var(--color-gray-100, #F8F7F4);
    border: 1px solid var(--color-gray-300, rgba(255, 255, 255, 0.08));
    border-radius: 6px;
    font-family: var(--font-body);
}

.openhaft-matrix-summary__left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.openhaft-matrix-summary__count {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-dark, #1A1A1A);
}

.openhaft-matrix-summary__tier-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--color-gold, #F5C842);
    color: var(--color-dark, #1A1A1A);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
}

.openhaft-matrix-summary__right {
    display: flex;
    align-items: baseline;
    gap: 1.25rem;
}

.openhaft-matrix-summary__netto {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-dark, #1A1A1A);
}

.openhaft-matrix-summary__brutto {
    font-size: 0.85rem;
    color: var(--color-gray-500, #666666);
}

/* ---- Add to cart button ---- */
.openhaft-matrix-add-btn {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.875rem 2rem;
    background: var(--color-gold, #F5C842);
    color: var(--color-dark, #1A1A1A);
    border: none;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.15s ease;
}

.openhaft-matrix-add-btn:hover {
    background: var(--color-gold-dark, #C8962E);
}

.openhaft-matrix-add-btn:active {
    transform: scale(0.98);
}

.openhaft-matrix-add-btn:disabled {
    background: var(--color-gray-300, rgba(0, 0, 0, 0.08));
    color: var(--color-gray-500, #666666);
    cursor: not-allowed;
    transform: none;
}

.openhaft-matrix-add-btn.is-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.openhaft-matrix-add-btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(26, 26, 26, 0.2);
    border-top-color: var(--color-dark, #1A1A1A);
    border-radius: 50%;
    animation: openhaft-spin 0.6s linear infinite;
}

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

/* ---- Minimum qty hint ---- */
.openhaft-matrix-min-hint {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(196, 30, 58, 0.08);
    color: var(--color-red, #C41E3A);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

/* ---- Success message ---- */
.openhaft-matrix-success {
    display: none;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(67, 160, 71, 0.1);
    color: var(--accent-success);
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.openhaft-matrix-success.is-visible {
    display: block;
}

/* ---- Error message ---- */
.openhaft-matrix-error {
    display: none;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(204, 0, 0, 0.1);
    color: var(--color-red, #E53935);
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.openhaft-matrix-error.is-visible {
    display: block;
}

/* ---- Disclaimer ---- */
.openhaft-matrix-disclaimer {
    margin-top: 0.75rem;
    font-size: 0.78rem;
    color: var(--color-gray-500, #666666);
    line-height: 1.5;
}

.openhaft-matrix-disclaimer p {
    margin: 0.25rem 0;
}

/* ---- Full-width matrix wrapper (below product summary) ---- */
.openhaft-matrix-fullwidth {
    clear: both;
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto 0;
    padding: 0 1rem;
}

/* ---- CTA row (buttons below matrix) ---- */
.openhaft-matrix-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ---- CTA button (Zapytaj o produkt) ---- */
.openhaft-matrix-cta-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 2rem;
    background: transparent;
    color: var(--color-gold, #F5C842);
    border: 2px solid var(--color-gold, #F5C842);
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

.openhaft-matrix-cta-btn:hover {
    background: var(--color-gold, #F5C842);
    color: var(--color-dark, #1A1A1A);
}

/* ---- PDF product card button ---- */
.openhaft-matrix-pdf-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 2rem;
    background: transparent;
    color: var(--color-red, #C41E3A);
    border: 2px solid var(--color-red, #C41E3A);
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

.openhaft-matrix-pdf-btn:hover {
    background: var(--color-red, #C41E3A);
    color: #fff;
}

/* ---- Product description section (SEO) ---- */
.openhaft-product-description {
    max-width: 900px;
    margin: 2rem auto 0;
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.openhaft-product-description__title {
    font-family: var(--font-heading, 'DM Serif Display', serif);
    font-size: 1.35rem;
    font-weight: 400;
    color: var(--color-dark, #1A1A1A);
    margin: 0 0 1rem;
}

.openhaft-product-description__content {
    font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
    font-size: 0.95rem;
    line-height: 1.7;
    color: #444;
}

.openhaft-product-description__content p {
    margin: 0 0 0.75rem;
}

.openhaft-product-description__content p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .openhaft-matrix-summary {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .openhaft-matrix-summary__left,
    .openhaft-matrix-summary__right {
        justify-content: space-between;
    }

    .openhaft-matrix-header {
        font-size: 0.85rem;
    }

    .openhaft-matrix-fullwidth {
        padding: 0;
    }

    .openhaft-matrix-cta-row {
        flex-direction: column;
    }

    .openhaft-matrix-cta-btn,
    .openhaft-matrix-pdf-btn {
        width: 100%;
        justify-content: center;
    }

    .openhaft-product-description {
        padding: 1.25rem;
        margin-top: 1.5rem;
    }
}
