/* ── Stone m² / pcs Calculator — Stonemart Theme Integration ── */

.stone-m2-wrapper,
.stone-pcs-wrapper {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #faf8f5 0%, #f3efe9 100%);
    border: 1px solid #e0d6ca;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.stone-m2-wrapper::before,
.stone-pcs-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #8b7355;
    border-radius: 8px 0 0 8px;
}

.stone-m2-wrapper.hidden,
.stone-pcs-wrapper.hidden {
    display: none;
}

/* Header row */
.stone-m2-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0d6ca;
    color: #8b7355;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.stone-m2-header i {
    font-size: 16px;
}

/* Input group */
.stone-m2-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stone-m2-input-group label {
    font-size: 14px;
    color: #555;
    margin-bottom: 0;
}

/* m² area input */
.stone-required-area {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d5cdc2;
    border-radius: 6px;
    font-size: 15px;
    color: #333;
    background: #fff;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    -moz-appearance: textfield;
}

.stone-required-area::-webkit-outer-spin-button,
.stone-required-area::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.stone-required-area:focus {
    outline: none;
    border-color: #8b7355;
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.12);
}

/* ── pcs quantity input with +/- buttons ── */
.stone-pcs-qty-wrap {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d5cdc2;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    max-width: 160px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.stone-pcs-qty-wrap:focus-within {
    border-color: #8b7355;
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.12);
}

.stone-pcs-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: #f5f0ea;
    color: #8b7355;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.stone-pcs-btn:hover {
    background: #8b7355;
    color: #fff;
}

.stone-pcs-btn:active {
    background: #6e5a42;
    color: #fff;
}

.stone-required-pcs {
    width: 70px;
    text-align: center;
    border: none;
    border-left: 1px solid #e0d6ca;
    border-right: 1px solid #e0d6ca;
    padding: 10px 4px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    background: #fff;
    -moz-appearance: textfield;
    outline: none;
}

.stone-required-pcs::-webkit-outer-spin-button,
.stone-required-pcs::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Calculated price (shared between m² and pcs) */
.stone-calculated-price,
.stone-pcs-calculated-price {
    margin-top: 14px;
    font-size: 18px;
    font-weight: 700;
    color: #333;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e0d6ca;
    border-radius: 6px;
    display: none;
}

.stone-calculated-price.has-price,
.stone-pcs-calculated-price.has-price {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stone-calculated-price .stone-m2-total-label,
.stone-pcs-calculated-price .stone-m2-total-label {
    font-size: 13px;
    font-weight: 600;
    color: #8b7355;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stone-calculated-price .stone-m2-total-value,
.stone-pcs-calculated-price .stone-m2-total-value {
    font-size: 22px;
    font-weight: 700;
    color: #333;
}

.stone-calculated-price .stone-m2-total-area,
.stone-pcs-calculated-price .stone-m2-total-area {
    font-size: 13px;
    font-weight: 400;
    color: #888;
    margin-left: auto;
}

/* Disabled add-to-cart button */
.single_add_to_cart_button.stone-m2-btn-disabled,
.single_add_to_cart_button.stone-m2-btn-disabled:hover {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(40%);
}

/* Responsive */
@media (max-width: 576px) {
    .stone-m2-wrapper,
    .stone-pcs-wrapper {
        padding: 16px;
    }

    .stone-required-area {
        max-width: 100%;
    }

    .stone-pcs-qty-wrap {
        max-width: 100%;
    }

    .stone-calculated-price,
    .stone-pcs-calculated-price {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .stone-calculated-price .stone-m2-total-area,
    .stone-pcs-calculated-price .stone-m2-total-area {
        margin-left: 0;
    }
}