/* ============================================================
   Steel Price Calculator — Frontend Styles
============================================================ */

/* ── Hide WooCommerce price on products with calculator ── */
body.spc-active .price,
body.spc-active p.price,
body.spc-active span.price,
body.spc-active .woocommerce-Price-amount,
body.spc-active .summary .price {
    display: none !important;
}

.spc-calculator {
    margin: 20px 0 16px;
    font-family: inherit;
}

/* Fields grid */
.spc-fields-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
    background: #f7f7f7;
}

.spc-field-group {
    padding: 14px 18px;
    border-bottom: 1px solid #e0e0e0;
    background: #f7f7f7;
}

.spc-field-group:last-child {
    border-bottom: none;
}

/* Label */
.spc-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 8px;
}

.spc-max-note {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #888;
    font-size: 11px;
}

.spc-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ccc;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    font-style: normal;
    line-height: 1;
    flex-shrink: 0;
}

/* Number input with +/- buttons */
.spc-number-input-wrap {
    display: flex;
    align-items: stretch;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    width: fit-content;
    min-width: 150px;
}

.spc-number-btn {
    background: #f0f0f0;
    border: none;
    padding: 0 14px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #444;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    flex-shrink: 0;
    min-height: 42px;
    display: flex;
    align-items: center;
}

.spc-number-btn:hover {
    background: #1e3a2f;
    color: #fff;
}

.spc-number-btn:active {
    background: #163020;
    color: #fff;
}

.spc-number-input {
    border: none;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    padding: 8px 10px;
    width: 80px;
    color: #222;
    background: #fff;
    -moz-appearance: textfield;
    appearance: textfield;
}

.spc-number-input::-webkit-outer-spin-button,
.spc-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.spc-number-input:focus {
    outline: none;
    background: #fafffe;
}

/* Select */
.spc-select-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 380px;
}

.spc-select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px 36px 10px 12px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    width: 100%;
    transition: border-color 0.15s;
}

.spc-select:focus {
    outline: none;
    border-color: #1e3a2f;
    box-shadow: 0 0 0 2px rgba(30, 58, 47, 0.12);
}

.spc-select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #888;
    font-size: 13px;
}

/* Error message */
.spc-field-error {
    font-size: 12px;
    color: #c0392b;
    margin-top: 5px;
    min-height: 16px;
}

/* Price box */
.spc-price-box {
    background: #1e3a2f;
    color: #fff;
    padding: 16px 20px;
    border-radius: 0 0 6px 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.spc-price-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.75;
    line-height: 1;
    align-self: center;
}

.spc-price-value {
    display: flex;
    align-items: baseline;
    gap: 3px;
    line-height: 1;
}

.spc-currency {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.spc-price-amount {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    transition: opacity 0.2s;
}

.spc-price-amount.spc-updating {
    opacity: 0.5;
}

.spc-price-note {
    font-size: 11px;
    opacity: 0.6;
    align-self: flex-end;
    margin-bottom: 4px;
    margin-left: auto;
}

/* Add to cart button below calculator */
.spc-calculator ~ .single_add_to_cart_button,
.spc-calculator ~ .cart .single_add_to_cart_button {
    margin-top: 14px;
}

/* Qty field — hide default WC qty if calculator has its own */
.woocommerce-page .spc-calculator ~ .cart .qty {
    /* keep WC qty visible unless you want to hide it */
}

/* Responsive */
@media (max-width: 480px) {
    .spc-price-amount {
        font-size: 28px;
    }
    .spc-number-input-wrap {
        min-width: 130px;
    }
    .spc-number-input {
        width: 60px;
    }
}


/* Layout fix when calculator is rendered inside WooCommerce cart form */
body.spc-active form.cart,
body.spc-active .summary form.cart,
body.spc-active form.cart.cart,
body.spc-active .summary form.cart.cart {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px;
}

body.spc-active form.cart .spc-calculator,
body.spc-active .summary form.cart .spc-calculator {
    width: 100%;
    flex: 0 0 100%;
    order: 1;
}

body.spc-active form.cart > .quantity,
body.spc-active form.cart > .qty,
body.spc-active form.cart .quantity,
body.spc-active .summary form.cart .quantity {
    order: 2;
    margin: 0 !important;
}

body.spc-active form.cart > .single_add_to_cart_button,
body.spc-active form.cart .single_add_to_cart_button,
body.spc-active .summary form.cart .single_add_to_cart_button {
    order: 3;
    margin: 0 !important;
    float: none !important;
    clear: both;
}
