/* ElBatt Creations — design tool
 *
 * A focused, app-like screen rather than a page. Fixed viewport height with
 * three regions: tool panel, canvas stage, and a persistent price/action bar,
 * so the "Add to cart" button is never scrolled off on a phone.
 */

.designer-body { overflow: hidden; height: 100%; }
html:has(.designer-body) { height: 100%; }

.dz {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;          /* dvh so mobile browser chrome does not clip it */
    background: var(--sunken);
}

/* ================================================================ top bar */

.dz-top {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--ink);
    color: #fff;
    padding: 0 16px;
    height: 66px;
    flex: 0 0 66px;
    border-bottom: 3px solid var(--brand);
}
.dz-logo { display: flex; align-items: center; }
.dz-logo img { width: 50px; height: auto; }

.dz-title { min-width: 0; flex: 1; line-height: 1.25; }
.dz-title strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dz-title span { font-size: 12px; color: rgba(255,255,255,.6); }

.dz-top-actions { display: flex; gap: 6px; }
.dz-icon {
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.16);
    color: #fff;
    border-radius: 6px;
    padding: 7px 12px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.dz-icon:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.dz-icon:disabled { opacity: .35; cursor: default; }

/* =================================================================== body */

.dz-body { flex: 1; display: flex; min-height: 0; position: relative; }

/* ------------------------------------------------------------ tool panel */

.dz-panel {
    width: 330px;
    flex: 0 0 330px;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dz-tabs { display: flex; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.dz-tabs button {
    flex: 1;
    padding: 13px 6px;
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
}
.dz-tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }

.dz-pane { display: none; padding: 16px; overflow-y: auto; flex: 1; min-height: 0; }
.dz-pane.on { display: block; }

.dz-search { display: grid; gap: 8px; margin-bottom: 14px; }
.dz-search input, .dz-search select, .dz-field input, .dz-field select, .dz-field textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font: inherit;
    font-size: 14px;
    background: #fff;
}
.dz-search input:focus, .dz-field :focus-visible { outline: 2px solid var(--brand); outline-offset: -1px; }

.dz-lib { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dz-lib button {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff center/contain no-repeat;
    cursor: pointer;
    padding: 0;
    position: relative;
    overflow: hidden;
}
.dz-lib button:hover { border-color: var(--brand); transform: scale(1.03); }
.dz-lib button img { width: 100%; height: 100%; object-fit: contain; }
.dz-lib .small {
    position: absolute;
    inset: auto 0 0 0;
    background: rgba(179,38,30,.9);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.dz-libmore { margin-top: 14px; text-align: center; }
.dz-libmore .btn { width: 100%; }

.dz-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 30px 10px; }

/* ---------------------------------------------------------------- upload */

.dz-drop {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 30px 16px;
    text-align: center;
    cursor: pointer;
    background: var(--sunken);
    display: grid;
    gap: 4px;
}
.dz-drop:hover, .dz-drop.over { border-color: var(--brand); background: var(--brand-tint); }
.dz-drop:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.dz-drop strong { font-size: 15px; }
.dz-drop span { font-size: 13px; color: var(--muted); }

.dz-note { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; line-height: 1.5; }
.dz-warn { color: var(--brand-dark); }

.dz-uploads { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 14px; }
.dz-uploads button {
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
}
.dz-uploads img { width: 100%; height: 100%; object-fit: contain; }

/* ------------------------------------------------------------------ text */

.dz-field { margin-bottom: 14px; }
.dz-field label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.dz-chosen { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }

.dz-colours { display: flex; flex-wrap: wrap; gap: 7px; }
.dz-colours button {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    padding: 0;
}
.dz-colours button.on { border-color: var(--ink); box-shadow: inset 0 0 0 2px #fff; }

.dz-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.dz-swatches button {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    padding: 0;
    box-shadow: inset 0 0 0 2px #fff;
}
.dz-swatches button.on { border-color: var(--ink); }

.dz-sizes { display: flex; flex-wrap: wrap; gap: 6px; }
.dz-sizes button {
    min-width: 46px;
    padding: 9px 10px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.dz-sizes button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ----------------------------------------------------------------- stage */

.dz-stage {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px;
    overflow: hidden;
    min-height: 0;
}

.dz-sides { display: flex; gap: 6px; margin-bottom: 12px; flex: 0 0 auto; }
.dz-sides button {
    padding: 7px 18px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 20px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    color: var(--muted);
}
.dz-sides button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.dz-canvas-wrap {
    position: relative;
    line-height: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    flex: 0 0 auto;
}
.dz-blank { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.dz-canvas-wrap canvas { position: absolute; inset: 0; }
.dz-canvas-wrap .canvas-container { position: absolute !important; inset: 0; }

.dz-hint { margin-top: 12px; font-size: 13px; color: var(--muted); text-align: center; }

/* -------------------------------------------------------- object toolbar */

.dz-objbar {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    background: var(--ink);
    color: #fff;
    border-radius: 40px;
    padding: 8px 8px 8px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,.28);
    font-size: 12.5px;
    z-index: 20;
    max-width: calc(100% - 28px);
}
.dz-objbtns { display: flex; gap: 5px; }
.dz-objbar button {
    background: rgba(255,255,255,.13);
    border: 0;
    color: #fff;
    border-radius: 30px;
    padding: 7px 13px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.dz-objbar button:hover { background: rgba(255,255,255,.24); }
.dz-objbar button.danger:hover { background: #b3261e; }

/* ---------------------------------------------------------------- footer */

.dz-foot {
    flex: 0 0 auto;
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.dz-price strong { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.dz-price span { font-size: 12px; color: var(--muted); }
.dz-foot-actions { display: flex; gap: 8px; }

/* ----------------------------------------------------------------- toast */

/* Errors used to be written into the small grey hint line under the garment,
   where they were easy to miss entirely — a failed upload read as "nothing
   happened". This sits over the canvas and cannot be overlooked. */
.dz-toast {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    max-width: min(520px, calc(100% - 32px));
    background: var(--ink);
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    box-shadow: 0 8px 30px rgba(0,0,0,.32);
    animation: dztoast .22s ease-out;
}
.dz-toast.err  { background: #b3261e; }
.dz-toast.warn { background: var(--brand-deep); }

@keyframes dztoast {
    from { opacity: 0; transform: translate(-50%, -8px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) { .dz-toast { animation: none; } }

/* ------------------------------------------------------------------ busy */

.dz-busy {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.82);
    display: grid;
    place-items: center;
    gap: 14px;
    z-index: 100;
    font-weight: 600;
    grid-auto-flow: row;
}
.dz-spinner {
    width: 34px; height: 34px;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: dzspin .7s linear infinite;
}
@keyframes dzspin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .dz-spinner { animation-duration: 2s; }
    .dz-lib button:hover { transform: none; }
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 860px) {
    .dz-body { flex-direction: column-reverse; }
    .dz-panel {
        width: auto;
        flex: 0 0 250px;
        border-right: 0;
        border-top: 1px solid var(--border);
    }
    .dz-stage { padding: 10px; }
    .dz-lib { grid-template-columns: repeat(4, 1fr); }
    .dz-objbar { bottom: auto; top: 8px; }
    .dz-title span { display: none; }
}

/* ---------------------------------------------------------------------------
 * The hidden attribute must actually hide things.
 *
 * `[hidden] { display: none }` lives in the browser's own stylesheet, and ANY
 * author rule setting display beats it — regardless of specificity, because
 * author styles outrank user-agent styles. So `.dz-busy { display: grid }`
 * silently defeated `<div class="dz-busy" hidden>` and left a "Working…"
 * overlay permanently covering the editor.
 *
 * One rule, declared last, closes it for every element on the page.
 * -------------------------------------------------------------------------*/
[hidden] { display: none !important; }

/* ------------------------------------------------- printing method picker */

/* Stacked, not the wrap-row the size buttons use: each option carries a line
   of explanation, and those do not survive being squeezed side by side in a
   sidebar this narrow. */
.dz-methods { display: grid; gap: 6px; }
.dz-methods button {
    display: grid;
    grid-template-columns: 16px 1fr;
    gap: 9px;
    align-items: start;
    width: 100%;
    text-align: left;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 9px 11px;
    font: inherit;
    color: inherit;
    cursor: pointer;
    transition: border-color .12s ease, background .12s ease;
}
/* Same drawn dot as the storefront picker, so the two read as one control
   in two places rather than two different widgets. */
/* Placed explicitly, same as the storefront picker: three grid items in two
   columns means the blurb otherwise lands under the dot and breaks one word
   per line. */
.dz-methods button::before {
    content: '';
    grid-column: 1;
    grid-row: 1;
    width: 14px;
    height: 14px;
    margin-top: 2px;
    border-radius: 50%;
    border: 1.5px solid var(--muted-2);
    background: #fff;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.dz-methods button.on::before {
    border-color: var(--brand);
    box-shadow: inset 0 0 0 3.5px var(--brand);
}
.dz-methods button:hover { border-color: var(--muted-2); }
.dz-methods button.on { border-color: var(--brand); background: var(--brand-tint); }
.dz-methods button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.dz-mname  { grid-column: 2; grid-row: 1; font-weight: 700; font-size: 13.5px; }
.dz-mup    { color: var(--brand-deep); font-weight: 600; margin-left: 4px; }
.dz-mblurb { grid-column: 2; grid-row: 2; font-size: 11.5px; line-height: 1.4; color: var(--muted); margin-top: 2px; }
