/**
 * Axomify Flex Print — calculator styles.
 *
 * REDESIGNED (2.8): a full visual refresh of the [axomify_flex_calculator]
 * card, requested by the site owner as "professional and unique" for
 * customers. Built on the same black + gold brand tokens already used
 * elsewhere on Axomify Mart (Axomify Marketplace's .axmp-wrap design
 * system), 'Inter'/'Sora' as the site already loads both fonts sitewide, so
 * this plugin's calculator now reads as part of the same site instead of a
 * visually separate red/black block bolted on. All values are scoped under
 * .axomify-calc-box as CSS custom properties so the palette lives in one
 * place. No selector, id, or class that assets/js/flex-calculator.js or the
 * theme's own CSS depends on was renamed or removed — only look and feel.
 *
 * Follow-up refinement (same 2.8 release, live feedback): .ax-summary
 * (Quantity + Total Price) and .ax-actions (Add to Cart + View Cart) are
 * now equal-width flex children (flex: 1; min-width: 0) that stay side by
 * side in a single row at every screen width, including mobile -- they
 * previously stacked into a single column under the 480px breakpoint.
 * .ax-btn also gained white-space: nowrap so its label can never wrap
 * unevenly between the two buttons.
 *
 * BUG FIXED (2.8.2): the .ax-qty-box / .ax-price-box pair above still
 * wasn't rendering truly equal width, even though both had identical
 * flex: 1 1 0px, min-width: 0 and box-sizing: border-box. Root-caused (and
 * confirmed with an isolated, plugin-independent test) to a real CSS
 * flexbox behaviour, not a bug in this stylesheet or a theme conflict:
 * with box-sizing: border-box, a flex item's flex-basis can never resolve
 * below its own padding -- so a flex: 1 item WITH horizontal padding
 * always ends up exactly [that padding] wider than an otherwise-identical
 * flex: 1 item with none, once both have grown to fill the row. Only
 * .ax-price-box had padding directly on the flex item itself (for its
 * dark background's inner spacing), which is why it was consistently
 * wider than .ax-qty-box by exactly its own left+right padding. Fixed by
 * moving that padding onto a new, purely cosmetic .ax-price-inner wrapper
 * (frontend/views/calculator-form.php) so the flex item itself
 * (.ax-price-box) carries no padding of its own -- same visual spacing,
 * but the outer box can now split the row exactly 50/50 with .ax-qty-box.
 * The same live check also caught the Add to Cart / View Cart buttons
 * rendering unequal HEIGHT (View Cart taller): the theme's own WooCommerce
 * button CSS (.woocommerce .button and similar, which only the submit
 * button carries via WooCommerce's own "button" class) was overriding this
 * plugin's padding on the Add to Cart button specifically. .ax-btn's
 * padding now carries !important so both buttons always get the same
 * padding regardless of what other classes an element also carries. Even
 * with identical padding/border/font-size, the two buttons' auto-computed
 * height still differed by a few px (Add to Cart's icon+text flex content
 * resolves a slightly different intrinsic height than View Cart's
 * text-only content under "height: auto") -- so .ax-btn now sets an
 * explicit height instead of leaving it to auto-size from content, which
 * guarantees pixel-identical height for both buttons regardless of
 * whichever one happens to contain an icon.
 *
 * LAYOUT CHANGE (2.8.3): requested live -- the "Total Price" label and the
 * ₹ amount were stacked on two lines inside the dark price box (label on
 * top, amount below); requested instead as one line, e.g. "Total Price
 * ₹0.00" side by side, matching how Quantity's single-row stepper reads.
 * .ax-price-inner changed from a centered column (flex-direction: column)
 * to a single row (flex-direction: row; justify-content: space-between),
 * with the label and the live price now sitting on one baseline. Checked
 * this doesn't overflow/wrap for a large total (tested up to ₹45,600.00,
 * a big multi-sq.ft order) at both the normal card width and the
 * <=480px mobile width: at mobile width "Total Price" alongside a large
 * amount does not reliably fit on one line at a legible font size, so
 * frontend/views/calculator-form.php now renders two label spans --
 * ax-price-label-full ("Total Price", shown >480px) and
 * ax-price-label-short ("Price", shown <=480px) -- so the amount itself
 * always has room to stay on one line and fully readable rather than
 * shrinking the label to an illegible size or letting the amount get
 * clipped. #ax_total_disp itself (what assets/js/flex-calculator.js
 * writes the live total into) is unchanged, so no JS changes were needed.
 *
 * BUG FIXED (2.8.4): 2.8.3's one-line change made the label and price sit
 * on the same line inside the dark box, but the actual visible bug the
 * site owner meant by "in 4 box ka size same hai?" was still there: the
 * VISIBLE control -- the white bordered Quantity stepper vs. the solid
 * dark Total Price box -- were never actually the same height. The two
 * OUTER flex children (.ax-qty-box and .ax-price-box) were correctly
 * equal at 82px (confirmed since 2.8.2), but that 82px was split
 * differently inside each: Quantity is a ~28px label sitting above a
 * ~48px white stepper box, while Total Price was previously one single
 * ~82px dark rectangle with its label baked in -- so the dark box visibly
 * looked much bigger/taller than the stepper even though their shared
 * flex-row parent was balanced. Measured live: .ax-stepper is 48px tall,
 * the old single-piece .ax-price-box was 82px tall -- a 34px real,
 * visible gap, exactly matching the complaint.
 * Fixed by restructuring frontend/views/calculator-form.php's price field
 * to mirror the Quantity field's own structure exactly: a plain <label>
 * ("Total Price") sitting above the box -- reusing the same
 * ".axomify-calc-box label" rule the "Quantity" label already uses, so
 * the two labels are guaranteed identical without a separate CSS rule to
 * keep in sync -- followed by .ax-price-amount-box, a leaner dark box
 * that now holds only the price value and is given the same explicit
 * height: 48px as .ax-stepper. Both controls now match in height by
 * construction, not by coincidence of content sizing, the same technique
 * already used for Add to Cart / View Cart in 2.8.2. This also let the
 * mobile "Price"/"Total Price" short-label swap from 2.8.3 be removed
 * entirely -- once the label isn't sharing a line with the price anymore,
 * "Total Price" alone always fits comfortably at any screen width.
 */

/* Theme-hiding rules -- functional, unchanged from earlier versions. These
   hide the theme's own Add to Cart form/button/price ONLY on a page where
   this plugin's own #axomify-calc-form replaces them (see
   frontend/class-shortcode.php's maybe_enqueue_assets() doc comment for why
   these assets only ever load on a page where that's actually true). */
form.cart:not(#axomify-calc-form),
div.quantity:not(.axomify-qty-box),
.single_add_to_cart_button:not(.axomify-btn-add),
.elementor-add-to-cart {
    display: none !important;
}

.summary .price, p.price, .woocommerce-Price-amount { display: none !important; }
.axomify-calc-box .ax-live-price { display: inline-block !important; }

/* ---------------------------------------------------------------------- */
/* Design tokens                                                          */
/* ---------------------------------------------------------------------- */

.axomify-calc-box {
    --ax-ink: #14120B;
    --ax-ink-soft: #57534E;
    --ax-muted: #8A8578;
    --ax-gold: #F5B700;
    --ax-gold-dark: #C99400;
    --ax-gold-tint: #FFF7DE;
    --ax-surface: #FFFFFF;
    --ax-bg: #FAF9F6;
    --ax-border: #E7E2D4;
    --ax-border-strong: #D8D2C0;
    --ax-error: #C0392B;
    --ax-error-bg: #FDECEA;
    --ax-error-border: #F3C6C0;
    --ax-radius-lg: 16px;
    --ax-radius-md: 12px;
    --ax-radius-sm: 8px;
    --ax-shadow: 0 1px 2px rgba(20, 18, 11, 0.04), 0 8px 24px -12px rgba(20, 18, 11, 0.18);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---------------------------------------------------------------------- */
/* Card shell                                                             */
/* ---------------------------------------------------------------------- */

.axomify-calc-box {
    background: var(--ax-surface);
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius-lg);
    box-shadow: var(--ax-shadow);
    padding: 26px;
    margin: 18px 0;
    color: var(--ax-ink);
}

.axomify-calc-box * { box-sizing: border-box; }

.axomify-calc-box label {
    color: var(--ax-ink);
    font-weight: 600;
    font-size: 13px;
    display: block;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.axomify-calc-box .ax-req { color: var(--ax-gold-dark); font-weight: 700; }
.axomify-calc-box .ax-optional { color: var(--ax-muted); font-weight: 500; text-transform: none; }

.axomify-calc-box input[type="text"],
.axomify-calc-box input[type="number"],
.axomify-calc-box select,
.axomify-calc-box textarea {
    width: 100%;
    background: var(--ax-surface);
    border: 1.5px solid var(--ax-border-strong) !important;
    border-radius: var(--ax-radius-sm) !important;
    color: var(--ax-ink) !important;
    font-family: inherit;
    font-size: 14.5px;
    padding: 11px 13px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.axomify-calc-box input[type="text"]:hover,
.axomify-calc-box input[type="number"]:hover,
.axomify-calc-box select:hover,
.axomify-calc-box textarea:hover {
    border-color: var(--ax-muted) !important;
}

.axomify-calc-box input[type="text"]:focus,
.axomify-calc-box input[type="number"]:focus,
.axomify-calc-box select:focus,
.axomify-calc-box textarea:focus {
    border-color: var(--ax-gold-dark) !important;
    box-shadow: 0 0 0 3.5px rgba(245, 183, 0, 0.22);
}

.axomify-calc-box textarea { resize: vertical; min-height: 72px; line-height: 1.5; }

/* ---------------------------------------------------------------------- */
/* Header                                                                  */
/* ---------------------------------------------------------------------- */

.axomify-calc-box .ax-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.axomify-calc-box .ax-header-icon {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: linear-gradient(155deg, var(--ax-gold), var(--ax-gold-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ax-ink);
    box-shadow: 0 4px 10px -4px rgba(201, 148, 0, 0.55);
}

.axomify-calc-box .ax-header-icon svg { width: 21px; height: 21px; }

.axomify-calc-box .ax-title {
    margin: 0 0 2px 0;
    font-family: 'Sora', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--ax-ink);
    letter-spacing: -0.01em;
}

.axomify-calc-box .ax-subtitle {
    margin: 0;
    font-size: 12.5px;
    color: var(--ax-muted);
}

/* ---------------------------------------------------------------------- */
/* Fields & layout                                                        */
/* ---------------------------------------------------------------------- */

.axomify-calc-box .ax-field { margin-bottom: 16px; }
.axomify-calc-box .ax-row-2 { display: flex; gap: 12px; }
.axomify-calc-box .ax-row-2 .ax-field { flex: 1; margin-bottom: 0; }

.axomify-calc-box .ax-helper-text {
    margin: 8px 2px 0;
    font-size: 11.5px;
    color: var(--ax-muted);
}

/* Search-your-size */

.axomify-calc-box .ax-field-search { position: relative; margin-bottom: 0; }

.axomify-calc-box .ax-input-icon { position: relative; }

.axomify-calc-box .ax-input-icon-svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--ax-muted);
    pointer-events: none;
}

.axomify-calc-box .ax-input-icon input { padding-left: 36px !important; }

.axomify-calc-box .ax-dropdown {
    background: var(--ax-surface);
    border: 1px solid var(--ax-border-strong);
    border-radius: var(--ax-radius-sm);
    box-shadow: 0 12px 28px -10px rgba(20, 18, 11, 0.22);
    max-height: 190px;
    overflow-y: auto;
    display: none;
    position: absolute;
    width: 100%;
    z-index: 99;
    margin-top: 6px;
    padding: 6px;
}

.axomify-calc-box .sz-item {
    padding: 9px 11px;
    cursor: pointer;
    border-radius: 7px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 13.5px;
    color: var(--ax-ink);
    transition: background 0.12s ease, color 0.12s ease;
}

.axomify-calc-box .sz-item:hover,
.axomify-calc-box .sz-item:focus {
    background: var(--ax-gold-tint) !important;
    color: var(--ax-ink) !important;
}

.axomify-calc-box .sz-item-size { font-weight: 600; }
.axomify-calc-box .sz-item-unit { font-size: 11px; color: var(--ax-muted); }

/* Divider */

.axomify-calc-box .ax-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
    color: var(--ax-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.axomify-calc-box .ax-divider::before,
.axomify-calc-box .ax-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--ax-border);
}

/* Height / Width suffix inputs */

.axomify-calc-box .ax-input-suffix { position: relative; }
.axomify-calc-box .ax-input-suffix input { padding-right: 38px !important; }
.axomify-calc-box .ax-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ax-muted);
    pointer-events: none;
}

/* Material select */

.axomify-calc-box .ax-select-wrap { position: relative; }
.axomify-calc-box .ax-select-wrap select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px !important;
    cursor: pointer;
}
.axomify-calc-box .ax-select-caret {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--ax-muted);
    pointer-events: none;
}

/* File dropzone */

.axomify-calc-box .ax-file-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    border: 1.5px dashed var(--ax-border-strong);
    border-radius: var(--ax-radius-md);
    padding: 22px 16px;
    background: var(--ax-bg);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    font-weight: 500;
}

.axomify-calc-box .ax-file-drop:hover {
    border-color: var(--ax-gold-dark);
    background: var(--ax-gold-tint);
}

.axomify-calc-box .ax-file-drop input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    padding: 0;
    border: none !important;
}

.axomify-calc-box .ax-file-icon { width: 22px; height: 22px; color: var(--ax-gold-dark); }
.axomify-calc-box .ax-file-text { font-size: 13.5px; color: var(--ax-ink); }
.axomify-calc-box .ax-file-hint { font-size: 11px; color: var(--ax-muted); font-weight: 400; }
.axomify-calc-box .ax-file-drop.ax-file-has-file { border-style: solid; border-color: var(--ax-gold-dark); }

/* Quantity stepper + price */

.axomify-calc-box .ax-summary {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.axomify-calc-box .ax-qty-box { margin-bottom: 0; flex: 1 1 0px; min-width: 0; }

.axomify-calc-box .ax-stepper {
    display: flex;
    align-items: stretch;
    border: 1.5px solid var(--ax-border-strong);
    border-radius: var(--ax-radius-sm);
    overflow: hidden;
    width: 100%;
}

.axomify-calc-box .ax-stepper input {
    flex: 1;
    width: auto;
    min-width: 0;
    text-align: center;
    border: none !important;
    border-left: 1.5px solid var(--ax-border-strong) !important;
    border-right: 1.5px solid var(--ax-border-strong) !important;
    border-radius: 0 !important;
    padding: 9px 4px;
    -moz-appearance: textfield;
}
.axomify-calc-box .ax-stepper input::-webkit-outer-spin-button,
.axomify-calc-box .ax-stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.axomify-calc-box .ax-stepper input:focus { box-shadow: none; }

.axomify-calc-box .ax-step-btn {
    background: var(--ax-bg);
    border: none;
    width: 34px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ax-ink);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.axomify-calc-box .ax-step-btn:hover { background: var(--ax-gold); color: var(--ax-ink); }
.axomify-calc-box .ax-step-btn:active { background: var(--ax-gold-dark); }

.axomify-calc-box .ax-price-box {
    margin-bottom: 0;
    flex: 1 1 0px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* .ax-price-title deliberately has NO rule of its own -- it's a plain
   <label> and inherits the same ".axomify-calc-box label" rule the
   "Quantity" label above the stepper uses (font-weight, font-size,
   margin-bottom, colour), so the two labels are guaranteed to render at
   the same height and style automatically, with nothing to keep in sync
   by hand. See this file's 2.8.4 doc comment. */

.axomify-calc-box .ax-price-amount-box {
    background: var(--ax-ink);
    border-radius: var(--ax-radius-sm);
    /* Same fixed height as .ax-stepper below (2.8.4) -- see doc comment. */
    height: 48px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
}

.axomify-calc-box .ax-live-price {
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--ax-gold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    transition: transform 0.15s ease;
}

.axomify-calc-box .ax-live-price.ax-pulse { transform: scale(1.08); }

/* Alert */

.axomify-calc-box .ax-alert {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--ax-error-bg);
    border: 1px solid var(--ax-error-border);
    color: var(--ax-error);
    font-size: 12.5px;
    font-weight: 600;
    border-radius: var(--ax-radius-sm);
    padding: 10px 13px;
    margin-bottom: 14px;
}

.axomify-calc-box .ax-alert.ax-alert-visible { display: flex; }
.axomify-calc-box .ax-alert-icon { width: 16px; height: 16px; flex: none; }

/* Buttons */

.axomify-calc-box .ax-actions { display: flex; gap: 10px; }

.axomify-calc-box .ax-btn {
    flex: 1 1 0px;
    min-width: 0;
    height: 50px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 18px !important;
    border-radius: var(--ax-radius-sm) !important;
    font-weight: 700 !important;
    font-size: 13.5px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    text-decoration: none !important;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box !important;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
    border: 1.5px solid transparent !important;
}

.axomify-calc-box .ax-btn svg { width: 17px; height: 17px; flex: none; }

.axomify-calc-box .ax-btn-primary,
.axomify-calc-box .axomify-btn-add {
    background: var(--ax-gold) !important;
    color: var(--ax-ink) !important;
    border-color: var(--ax-gold-dark) !important;
    box-shadow: 0 6px 14px -6px rgba(201, 148, 0, 0.6);
}
.axomify-calc-box .ax-btn-primary:hover,
.axomify-calc-box .axomify-btn-add:hover {
    background: var(--ax-gold-dark) !important;
    border-color: var(--ax-gold-dark) !important;
    color: var(--ax-ink) !important;
    transform: translateY(-1px);
}
.axomify-calc-box .ax-btn-primary:disabled,
.axomify-calc-box .axomify-btn-add:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.axomify-calc-box .ax-btn-secondary,
.axomify-calc-box .axomify-btn-view {
    background: var(--ax-surface) !important;
    color: var(--ax-ink) !important;
    border-color: var(--ax-border-strong) !important;
}
.axomify-calc-box .ax-btn-secondary:hover,
.axomify-calc-box .axomify-btn-view:hover {
    background: var(--ax-bg) !important;
    border-color: var(--ax-ink) !important;
    color: var(--ax-ink) !important;
    transform: translateY(-1px);
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                              */
/* ---------------------------------------------------------------------- */

@media (max-width: 480px) {
    .axomify-calc-box { padding: 18px; }
    .axomify-calc-box .ax-row-2 { flex-direction: column; gap: 16px; }
    /* Quantity/Total Price and Add to Cart/View Cart stay side-by-side, equal
       width, even on small screens -- just tighten spacing/sizing to fit. */
    .axomify-calc-box .ax-summary { gap: 8px; }
    .axomify-calc-box .ax-price-amount-box { padding: 0 10px; }
    .axomify-calc-box .ax-live-price { font-size: 17px; }
    .axomify-calc-box .ax-stepper input { padding: 9px 2px; }
    .axomify-calc-box .ax-actions { gap: 8px; }
    .axomify-calc-box .ax-btn { height: 46px !important; padding: 12px 8px !important; font-size: 11.5px; letter-spacing: 0; gap: 5px; }
    .axomify-calc-box .ax-btn svg { width: 15px; height: 15px; }
}
