/**
 * Signedge Designer UI — mobile.css
 * Phone order flow (#sg-m, built by mobile.js). Every rule is scoped to
 * body.sg-m-on / body.sg-m-adv / #sg-m / #sg-m-back, which only exist on
 * phones, so this file has no effect on desktop.
 * override.css uses unscoped !important rules; ours use ids to win.
 */

/* ---- core editor out of sight while the quick order is up --------------
   Shifted off-screen (not display:none) so fabric keeps real dimensions.
   A transform to the left adds no scrollable overflow. */
html.sg-m-html body.sg-m-on {
    overflow: hidden !important;
    max-width: 100vw !important;
}
body.sg-m-on > *:not(#sg-m):not(#sg-m-back):not(script):not(style):not(link):not(noscript) {
    transform: translateX(-200vw) !important;
}

/* Core tour / tooltips never show on a phone; summary panel is only a donor */
body.sg-m-on .tour-guide,
body.sg-m-adv .tour-guide,
body.sg-m-on .tooltipster-base,
body.sg-m-on .sg-summary,
body.sg-m-adv .sg-summary {
    display: none !important;
}

/* ---- container --------------------------------------------------------- */
#sg-m,
#sg-m-back { display: none; }

body.sg-m-on #sg-m {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2147483000;
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
    color: #1f2937;
    font-size: 16px;
    line-height: 1.4;
    padding: 0 0 150px;
}
#sg-m *, #sg-m *::before, #sg-m *::after { box-sizing: border-box; }
#sg-m { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

#sg-m .sg-m-head { padding: 14px 16px 4px; }
#sg-m .sg-m-title { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.2; color: #111827; }
#sg-m .sg-m-sec { padding: 12px 16px 8px; border-bottom: 1px solid #e5e7eb; max-width: 100%; }
#sg-m .sg-m-h { margin: 0 0 10px; font-size: 16px; font-weight: 700; color: #111827; }
#sg-m .sg-m-note { margin: 0; color: #6b7280; font-size: 14px; }

/* Size only once there is art */
#sg-m #sg-m-sec-size { display: none; }
#sg-m.sg-m-has-art #sg-m-sec-size { display: block; }

/* ---- buttons ----------------------------------------------------------- */
#sg-m .sg-m-btn { display: block; }
#sg-m .sg-m-btn,
#sg-m-back.sg-m-btn {
    width: 100%;
    min-height: 56px;
    padding: 12px 16px;
    border: 0;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
#sg-m .sg-m-btn-primary,
#sg-m-back.sg-m-btn-primary { background: #2563eb; color: #ffffff; }
#sg-m #sg-m-upload.sg-m-pulse { animation: sg-m-pulse .5s ease-in-out 3; }
@keyframes sg-m-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
    50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, .45); }
}
#sg-m .sg-m-adv-row { margin: 0; padding: 14px 16px; text-align: center; }
#sg-m .sg-m-link {
    min-height: 44px;
    padding: 8px 14px;
    background: transparent;
    border: 0;
    color: #6b7280;
    font-size: 15px;
    text-decoration: underline;
    cursor: pointer;
}

body.sg-m-adv #sg-m-back.sg-m-btn {
    display: block;
    position: fixed;
    left: 12px; right: 12px;
    bottom: 72px;
    width: auto;
    z-index: 2147483000;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}

/* ---- upload progress --------------------------------------------------- */
#sg-m #sg-upload-progress,
#sg-m .sg-upload-progress {
    position: static !important;
    margin: 10px 0 0 !important;
    padding: 0 !important;
    background: transparent !important;
    width: 100% !important;
}
#sg-m .sg-up-card { width: 100% !important; max-width: 100% !important; }
#sg-m .sg-up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- preview ----------------------------------------------------------- */
#sg-m #sg-m-preview-wrap { margin-top: 12px; max-width: 100%; }
#sg-m .sg-m-prow { display: flex; align-items: stretch; max-width: 100%; }
#sg-m #sg-m-preview {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px;
}
#sg-m #sg-m-preview img {
    display: none;
    max-width: 100%;
    max-height: 55vh;
    width: auto;
    height: auto;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
#sg-m.sg-m-has-art #sg-m-preview img[src] { display: block; }
#sg-m #sg-m-empty { margin: 0; padding: 24px 8px; text-align: center; color: #6b7280; font-size: 15px; }
#sg-m.sg-m-has-art #sg-m-empty { display: none; }

#sg-m .sg-m-dim { color: #374151; font-size: 13px; font-weight: 600; text-align: center; }
#sg-m .sg-m-dim:empty { display: none; }
#sg-m .sg-m-dim-w { padding: 0 0 4px; }
#sg-m .sg-m-dim-h {
    -webkit-writing-mode: vertical-rl;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    padding: 0 6px 0 0;
    align-self: center;
}
#sg-m .sg-m-measure { margin: 8px 0 4px; text-align: center; font-size: 15px; font-weight: 600; color: #111827; }
#sg-m .sg-m-measure:empty { display: none; }

/* ---- size (the moved art bar) ------------------------------------------ */
#sg-m #sg-artbar,
#sg-m #sg-artbar.is-visible {
    position: static !important;
    margin: 0 0 8px !important;
    padding: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    align-self: stretch !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    box-shadow: none !important;
    font-size: 16px !important;
}
#sg-m #sg-artbar:not(.is-visible) { display: none !important; }
#sg-m #sg-artbar.is-visible { display: flex !important; }
#sg-m #sg-artbar .sg-artbar-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    justify-content: center !important;
}
#sg-m #sg-artbar .sg-artbar-modes { flex-wrap: nowrap !important; }
#sg-m #sg-artbar .sg-artbar-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    min-height: 48px !important;
    padding: 6px 4px !important;
    font-size: 14px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
}
#sg-m #sg-artbar .sg-artbar-size { align-items: center !important; }
#sg-m #sg-artbar .sg-artbar-field { font-size: 16px !important; font-weight: 600 !important; }
#sg-m #sg-artbar .sg-artbar-field input[type="number"] {
    width: 96px !important;
    min-height: 48px !important;
    font-size: 18px !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
}
#sg-m #sg-artbar .sg-artbar-lock {
    min-height: 44px !important;
    width: 100% !important;
    justify-content: center !important;
    font-size: 15px !important;
}
#sg-m #sg-artbar .sg-artbar-lock input { width: 24px !important; height: 24px !important; margin: 0 6px 0 0 !important; }
#sg-m #sg-artbar .sg-artbar-actual { display: none !important; } /* shown in the preview block instead */
#sg-m #sg-artbar .sg-artbar-err { flex-basis: auto !important; }

#sg-m #sg-lowres-warning { position: static !important; margin: 0 0 8px !important; max-width: 100% !important; width: 100% !important; font-size: 14px !important; }
#sg-m #sg-lowres-warning .sg-lowres-dismiss { min-height: 44px !important; padding: 6px 14px !important; }

/* ---- options (the moved NBO panel) -------------------------------------- */
#sg-m #nbo-options-wrap {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
}
#sg-m #nbo-options-wrap * { max-width: 100%; }
#sg-m #nbo-options-wrap table,
#sg-m #nbo-options-wrap tbody,
#sg-m #nbo-options-wrap thead,
#sg-m #nbo-options-wrap tr,
#sg-m #nbo-options-wrap th,
#sg-m #nbo-options-wrap td {
    display: block !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
#sg-m #nbo-options-wrap label,
#sg-m #nbo-options-wrap .nbd-field-header,
#sg-m #nbo-options-wrap .nbo-field-title { font-size: 16px; }
#sg-m #nbo-options-wrap select,
#sg-m #nbo-options-wrap input[type="text"],
#sg-m #nbo-options-wrap input[type="number"],
#sg-m #nbo-options-wrap textarea {
    width: 100% !important;
    min-height: 48px !important;
    font-size: 16px !important; /* >=16px stops iOS zoom-on-focus */
    padding: 8px 12px !important;
}
#sg-m #nbo-options-wrap input[type="radio"],
#sg-m #nbo-options-wrap input[type="checkbox"] { min-width: 24px; min-height: 24px; }
#sg-m #nbo-options-wrap input[type="radio"] + label,
#sg-m #nbo-options-wrap input[type="checkbox"] + label,
#sg-m #nbo-options-wrap .nbd-swatch-wrap label,
#sg-m #nbo-options-wrap .nbd-field-content label {
    display: inline-block;
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
    line-height: 1.3;
}
#sg-m #nbo-options-wrap button,
#sg-m #nbo-options-wrap .nbd-button,
#sg-m #nbo-options-wrap a.button { min-height: 44px; }
/* NBO dimension field is replaced by the Size section above */

/* ---- sticky bottom bar -------------------------------------------------- */
#sg-m #sg-m-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, .08);
}
#sg-m .sg-m-price { flex: 0 0 auto; display: flex; flex-direction: column; min-width: 96px; max-width: 42%; }
#sg-m .sg-m-price-label,
#sg-m .sg-m-price-unit { font-size: 12px; color: #6b7280; line-height: 1.2; }
#sg-m #sg-total-price {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: #111827 !important;
    word-break: break-word;
}
#sg-m .sg-m-cta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
#sg-m #sg-empty-msg {
    margin: 0 !important;
    padding: 6px 10px !important;
    font-size: 13px !important;
}
#sg-m #sg-add-to-cart-btn {
    width: 100% !important;
    min-height: 56px !important;
    padding: 10px 14px !important;
    border-radius: 12px !important;
    font-size: 17px !important;
    font-weight: 700 !important;
}
#sg-m #sg-add-to-cart-btn .sg-btn-price-val,
#sg-m #sg-add-to-cart-btn .sg-btn-arrow { display: none !important; }
#sg-m #sg-add-to-cart-btn .sg-btn-inner { width: 100%; text-align: center; }

/* Add to Cart button in the sticky bar: primary colour */
body.sg-m-on #sg-m-bar #sg-add-to-cart-btn,
body.sg-m-on #sg-m-bar .sg-btn-add-to-cart {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #1d4ed8 !important;
}
body.sg-m-on #sg-m-bar #sg-add-to-cart-btn .sg-btn-label,
body.sg-m-on #sg-m-bar #sg-add-to-cart-btn span { color: #fff !important; }
body.sg-m-on #sg-m-bar #sg-add-to-cart-btn.sg-btn-loading,
body.sg-m-on #sg-m-bar #sg-add-to-cart-btn:disabled { background: #9ca3af !important; border-color: #9ca3af !important; }
