/**
 * Merkelapp Designer — Design Tokens
 *
 * This file connects the designer to the nfoto.no theme's
 * existing CSS custom properties (defined in the theme's
 * style.css "01. CSS CUSTOM PROPERTIES" block).
 *
 * Strategy: namespace-local --ma-* aliases that simply point to
 * the theme's --nf-* tokens. Two big wins from this approach:
 *
 *   1. When the theme palette changes (e.g. a future rebrand),
 *      the designer picks it up automatically — no edits here.
 *   2. The aliases give us a safety net: if a token is ever
 *      missing on a page (e.g. the theme stylesheet hasn't
 *      loaded), the var() fallback after the comma takes over
 *      and the designer still renders correctly.
 *
 * To re-skin the designer in isolation (different brand, demo
 * mode, etc.), override --ma-* values lower in the cascade.
 *
 * @since 2.1.0
 * @updated 2.1.1 — switched from hard-coded values to theme aliases.
 */

:root {
    /* ---------------------------------------------------------------- */
    /* COLOR — Brand                                                    */
    /* Falls back to the previous hard-coded sage if the theme tokens   */
    /* aren't loaded for any reason.                                    */
    /* ---------------------------------------------------------------- */

    --ma-brand:          var(--nf-primary,        #6a8e87);
    --ma-brand-hover:    var(--nf-primary-hover,  #7ea39c);
    --ma-brand-dark:     var(--nf-primary-dark,   #557872);
    --ma-brand-soft:     var(--nf-primary-soft,   #dde9e6);
    --ma-brand-softer:   var(--nf-primary-softer, #eef4f3);
    --ma-brand-pill:     var(--nf-primary-pill,   #cfdedb);
    --ma-brand-deep:     var(--nf-primary-deep,   #2f4945);
    --ma-brand-ring:     rgba(106, 142, 135, 0.18);
    --ma-brand-text:     var(--nf-primary-deep,   #2f4945);

    /* ---------------------------------------------------------------- */
    /* COLOR — Ink (text)                                               */
    /* ---------------------------------------------------------------- */

    --ma-ink:            var(--nf-heading,        #111111);
    --ma-ink-muted:      var(--nf-text,           #333333);
    --ma-ink-hint:       var(--nf-muted,          #666666);
    --ma-ink-faint:      #a8b5ab;

    /* ---------------------------------------------------------------- */
    /* COLOR — Surfaces                                                 */
    /* ---------------------------------------------------------------- */

    --ma-surface:        var(--nf-bg,             #ffffff);
    --ma-surface-soft:   var(--nf-bg-secondary,   #faf6f4);
    --ma-surface-tint:   var(--nf-primary-softer, #eef4f3);
    --ma-surface-input:  #ffffff;

    /* ---------------------------------------------------------------- */
    /* COLOR — Borders                                                  */
    /* ---------------------------------------------------------------- */

    --ma-border:         var(--nf-border-soft,    #ece7e5);
    --ma-border-soft:    var(--nf-border,         #eeeeee);
    --ma-border-strong:  var(--nf-primary-pill,   #cfdedb);

    /* ---------------------------------------------------------------- */
    /* COLOR — Save badge                                               */
    /* ---------------------------------------------------------------- */

    --ma-save-text:      var(--nf-primary-deep,   #2f4945);
    --ma-save-bg:        var(--nf-primary-softer, #eef4f3);
    --ma-save-border:    var(--nf-primary-pill,   #cfdedb);

    /* ---------------------------------------------------------------- */
    /* RADIUS                                                           */
    /* ---------------------------------------------------------------- */

    --ma-radius-sm:      var(--nf-radius-sm,      10px);
    --ma-radius-md:      var(--nf-radius-md,      16px);
    --ma-radius-lg:      var(--nf-radius-lg,      24px);
    --ma-radius-xl:      24px;
    --ma-radius-pill:    var(--nf-radius-pill,    999px);

    /* ---------------------------------------------------------------- */
    /* SHADOW — Uses the same warm tinted shadows from the theme        */
    /* ---------------------------------------------------------------- */

    --ma-shadow-xs:      0 1px 2px rgba(45, 80, 55, 0.04);
    --ma-shadow-sm:      var(--nf-shadow-sm,
                            0 4px 14px rgba(0, 0, 0, 0.04));
    --ma-shadow-md:      var(--nf-shadow-md,
                            0 8px 24px rgba(0, 0, 0, 0.04));
    --ma-shadow-lg:      0 4px 20px rgba(45, 80, 55, 0.10),
                         0 24px 48px rgba(45, 80, 55, 0.08);

    /* Brand-coloured focus ring */
    --ma-focus-ring:     0 0 0 3px rgba(106, 142, 135, 0.18);

    /* ---------------------------------------------------------------- */
    /* TYPOGRAPHY                                                       */
    /* The theme uses Nunito globally — re-use it here.                 */
    /* ---------------------------------------------------------------- */

    --ma-font:           var(--nf-font,           'Nunito', sans-serif);

    /* ---------------------------------------------------------------- */
    /* MOTION                                                           */
    /* ---------------------------------------------------------------- */

    --ma-ease:           cubic-bezier(0.4, 0, 0.2, 1);
    --ma-dur:            0.2s;
}

/* ====================================================================
 * SHARED PRIMITIVES
 * Re-usable building blocks consumed by editor/mix/temamix.
 * ==================================================================== */

.ma-designer-card {
    background: var(--ma-surface);
    border-radius: var(--ma-radius-lg);
    border: 1px solid var(--ma-border-soft);
    box-shadow: var(--ma-shadow-sm);
    overflow: hidden;
    clear: both;
    max-width: 100%;
    margin: 0 auto 40px;
    font-family: var(--ma-font);
}

.ma-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 18px 26px;
    background: var(--ma-surface-soft);
    border-bottom: 1px solid var(--ma-border-soft);
    position: sticky;
    top: 0;
    z-index: 10;
}

.ma-step-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--ma-surface);
    border: 1px solid var(--ma-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--ma-brand-text);
    font-family: var(--ma-font);
}

.ma-step-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ma-ink);
    letter-spacing: -0.01em;
    font-family: var(--ma-font);
}

.ma-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}


/* ====================================================================
 * QUANTITY STEPPER — Top-bar variant
 *
 * The designer's qty selector lives inside the sticky top bar.
 * It uses the same visual language as the cart/checkout stepper
 * (theme section 34): rounded pill background with circular
 * −/+ buttons that fill on hover.
 *
 * Selector scoped to the three designer containers so it doesn't
 * leak onto WooCommerce cart/checkout rows.
 * ==================================================================== */

#merkelapp-editor-container #merkelapp-qty-container .quantity,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 118px !important;
    height: 40px !important;
    padding: 3px !important;
    background: var(--ma-surface-tint) !important;
    border: 0 !important;
    border-radius: var(--ma-radius-pill) !important;
    overflow: hidden !important;
    box-shadow: none !important;
    transition: background var(--ma-dur) var(--ma-ease) !important;
}

#merkelapp-editor-container #merkelapp-qty-container .quantity:hover,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity:hover,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity:hover {
    background: var(--ma-brand-softer) !important;
}

#merkelapp-editor-container #merkelapp-qty-container .quantity:focus-within,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity:focus-within,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity:focus-within {
    background: var(--ma-brand-softer) !important;
    box-shadow: var(--ma-focus-ring) !important;
}

/* Circular −/+ buttons */
#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus,
#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: var(--ma-surface) !important;
    color: var(--ma-ink) !important;
    font-family: var(--ma-font) !important;
    /* Hide the theme's text glyph — we draw our own crisp lines below. */
    font-size: 0 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    border: 0 !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    transition: background var(--ma-dur) var(--ma-ease),
                color var(--ma-dur) var(--ma-ease),
                transform 0.1s var(--ma-ease),
                box-shadow var(--ma-dur) var(--ma-ease) !important;
}

/* Minus glyph — single horizontal line drawn with ::before */
#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus::before,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus::before,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus::before {
    content: '';
    display: block;
    width: 11px;
    height: 1.5px;
    background: currentColor;
    border-radius: 2px;
}

/* Plus glyph — horizontal + vertical lines, drawn with ::before and ::after */
#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus {
    position: relative !important;
}

#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus::before,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus::before,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus::before {
    content: '';
    position: absolute;
    width: 11px;
    height: 1.5px;
    background: currentColor;
    border-radius: 2px;
}

#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus::after,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus::after,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus::after {
    content: '';
    position: absolute;
    width: 1.5px;
    height: 11px;
    background: currentColor;
    border-radius: 2px;
}

/* Hover — brand fill, white glyph */
#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus:hover,
#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus:hover,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus:hover,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus:hover,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus:hover,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus:hover {
    background: var(--ma-brand) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(106, 142, 135, 0.25) !important;
}

/* Active / pressed */
#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus:active,
#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus:active,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus:active,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus:active,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus:active,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus:active {
    transform: scale(0.92) !important;
    background: var(--ma-brand-dark) !important;
}

/* Disabled */
#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus.disabled,
#merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus.disabled,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus.disabled,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus.disabled,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus.disabled,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus.disabled {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background: var(--ma-surface) !important;
    color: var(--ma-ink) !important;
    box-shadow: none !important;
}

/* Number input — flat, sits between the buttons */
#merkelapp-editor-container #merkelapp-qty-container .quantity input.qty,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity input.qty,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity input.qty {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    height: 100% !important;
    padding: 0 4px !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    text-align: center !important;
    font-family: var(--ma-font) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: var(--ma-ink) !important;
    line-height: 1 !important;
    appearance: textfield !important;
    -moz-appearance: textfield !important;
}

#merkelapp-editor-container #merkelapp-qty-container .quantity input.qty::-webkit-outer-spin-button,
#merkelapp-editor-container #merkelapp-qty-container .quantity input.qty::-webkit-inner-spin-button,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity input.qty::-webkit-outer-spin-button,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity input.qty::-webkit-inner-spin-button,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity input.qty::-webkit-outer-spin-button,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity input.qty::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

#merkelapp-editor-container #merkelapp-qty-container .quantity input.qty:focus,
#merkelapp-mix-editor-container #merkelapp-qty-container .quantity input.qty:focus,
#merkelapp-temamix-editor-container #merkelapp-qty-container .quantity input.qty:focus {
    outline: none !important;
}

/* Mobile — slightly tighter */
@media (max-width: 767px) {
    #merkelapp-editor-container #merkelapp-qty-container .quantity,
    #merkelapp-mix-editor-container #merkelapp-qty-container .quantity,
    #merkelapp-temamix-editor-container #merkelapp-qty-container .quantity {
        width: 112px !important;
        height: 38px !important;
    }

    #merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus,
    #merkelapp-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus,
    #merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus,
    #merkelapp-mix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus,
    #merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-minus,
    #merkelapp-temamix-editor-container #merkelapp-qty-container .quantity .botiga-quantity-plus {
        width: 30px !important;
        height: 30px !important;
    }
}
