/**
 * Sticker Cutline Generator – Frontend Styles
 *
 * Designed to sit naturally within a WooCommerce product page.
 * Uses neutral colours that work with most themes.
 */

/* ------------------------------------------------------------------ */
/*  Widget container                                                    */
/* ------------------------------------------------------------------ */
.scg-widget {
    margin: 1.5em 0;
    padding: 1.25em;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
        Ubuntu, Cantarell, sans-serif;
}

.scg-widget__title {
    margin: 0 0 1em;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.scg-version {
    display: block;
    margin-bottom: 0.25em;
    font-size: 0.72em;
    color: #999;
    letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------ */
/*  Dropzone                                                            */
/* ------------------------------------------------------------------ */
.scg-dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    text-align: center;
    padding: 2em 1em;
}

.scg-dropzone:hover,
.scg-dropzone--active {
    border-color: #6366f1;
    background-color: #f5f3ff;
}

.scg-dropzone--loading {
    pointer-events: none;
    opacity: 0.6;
}

.scg-dropzone__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5em;
}

.scg-dropzone__icon {
    color: #9ca3af;
}

.scg-dropzone__text {
    font-size: 0.95em;
    color: #555;
    margin: 0;
}

.scg-dropzone__hint {
    font-size: 0.8em;
    color: #999;
    margin: 0;
}

/* ------------------------------------------------------------------ */
/*  Controls panel                                                      */
/* ------------------------------------------------------------------ */
.scg-controls {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

/* ------------------------------------------------------------------ */
/*  Canvas preview                                                      */
/* ------------------------------------------------------------------ */
.scg-preview-wrap {
    position: relative;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.scg-preview-canvas {
    display: block;
    width: 100%;
    /* Height is set dynamically by JS based on image aspect ratio */
}

/* ------------------------------------------------------------------ */
/*  DPI badge                                                           */
/* ------------------------------------------------------------------ */
.scg-dpi-badge {
    display: inline-block;
    margin-top: 0.5em;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.78em;
    font-weight: 600;
}

.scg-dpi-badge--good {
    background: #d1fae5;
    color: #065f46;
}

.scg-dpi-badge--acceptable {
    background: #fef3c7;
    color: #92400e;
}

.scg-dpi-badge--poor {
    background: #fee2e2;
    color: #991b1b;
}

/* ------------------------------------------------------------------ */
/*  DPI warning                                                         */
/* ------------------------------------------------------------------ */
.scg-dpi-warning {
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #991b1b;
    font-size: 0.88em;
    line-height: 1.4;
}

/* ------------------------------------------------------------------ */
/*  Form controls                                                       */
/* ------------------------------------------------------------------ */
.scg-control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Dimensions bar */
.scg-dimensions-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
}

.scg-dim-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: none;
    color: #555;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.scg-dim-btn:hover {
    background: #e5e7eb;
    color: #333;
}

.scg-dim-btn:active {
    background: #d1d5db;
}

.scg-dim-input-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    min-width: 80px;
}

.scg-dim-label {
    font-size: 0.75em;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.scg-dim-input {
    width: 70px;
    border: none;
    background: transparent;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    text-align: center;
    padding: 0;
    -moz-appearance: textfield;
}

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

.scg-dim-input:focus {
    outline: 2px solid var(--st-focus, #0e8ab5); outline-offset: 2px;
}

.scg-lock-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: none;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.15s, background-color 0.15s;
    flex-shrink: 0;
}

.scg-lock-btn:hover {
    background: #e5e7eb;
}

.scg-lock-btn.scg-lock-btn--locked {
    color: #6366f1;
}

.scg-checkbox-label {
    font-size: 0.85em;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.scg-control-hint {
    margin: 2px 0 0;
    font-size: 0.75em;
    color: #999;
}

/* Shape picker */
.scg-shape-picker {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.scg-shape-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 10px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #888;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background-color 0.15s;
    flex: 1;
    min-width: 0;
}

.scg-shape-btn span {
    font-size: 0.65em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.scg-shape-btn:hover {
    border-color: #c7c9cf;
    color: #555;
}

.scg-shape-btn--active {
    border-color: #6366f1;
    color: #6366f1;
    background: #f5f3ff;
}

.scg-shape-btn--active:hover {
    border-color: #6366f1;
}

.scg-label {
    font-size: 0.85em;
    font-weight: 500;
    color: #444;
}

.scg-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9em;
    background: #fff;
    color: #333;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.scg-select:focus {
    outline: 2px solid var(--st-focus, #0e8ab5); outline-offset: 2px;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.scg-range:focus-visible {
    outline: 2px solid var(--st-focus, #0e8ab5);
    outline-offset: 2px;
}
.scg-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
}

.scg-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6366f1;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.scg-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6366f1;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ------------------------------------------------------------------ */
/*  Buttons                                                             */
/* ------------------------------------------------------------------ */
.scg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, opacity 0.15s;
}

.scg-btn--primary {
    background: #6366f1;
    color: #fff;
}

.scg-btn--primary:hover {
    background: #4f46e5;
}

.scg-btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.scg-btn--secondary {
    background: #fff;
    color: #6366f1;
    border: 2px solid #6366f1;
    text-decoration: none;
    margin-top: 0.5em;
}

.scg-btn--secondary:hover {
    background: #f5f3ff;
    color: #4f46e5;
    border-color: #4f46e5;
}

.scg-btn--secondary svg {
    vertical-align: middle;
}

/* ------------------------------------------------------------------ */
/*  Status messages                                                     */
/* ------------------------------------------------------------------ */
.scg-status {
    font-size: 0.88em;
    line-height: 1.4;
}

.scg-status--success {
    color: #065f46;
    font-weight: 500;
}

.scg-status--error {
    color: #991b1b;
    font-weight: 500;
}

/* ------------------------------------------------------------------ */
/*  Change image link                                                   */
/* ------------------------------------------------------------------ */
.scg-change-link {
    font-size: 0.85em;
    color: #6366f1;
    text-decoration: underline;
    cursor: pointer;
}

.scg-change-link:hover {
    color: #4f46e5;
}

/* ------------------------------------------------------------------ */
/*  Responsive                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 600px) {
    .scg-widget {
        padding: 1em;
    }

    .scg-dropzone {
        min-height: 140px;
        padding: 1.5em 1em;
    }

    .scg-btn {
        width: 100%;
    }
}

/* Browse files button — shown inside dropzone as a fallback to drag-and-drop */
.scg-browse-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    border: 1.5px solid currentColor;
    border-radius: 6px;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    transition: background 0.15s, color 0.15s;
}
.scg-browse-btn:hover {
    background: rgba(0,0,0,0.06);
}

/* Ensure label renders exactly like a button and gets pointer cursor */
label.scg-browse-btn {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* ────────────────────────────────────────────────────────────────────────
   Slot strip — studio-enabled split orders

   One tile per design. Hidden entirely on single-artwork orders (JS sets
   display), so nothing here applies to the studio as it was.
   ──────────────────────────────────────────────────────────────────────── */
.asp-slot-strip {
    margin-top: 16px;
}

.asp-slot-strip__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

/*
 * Sized with the configurator's section labels rather than here — this heading
 * is joined to the .asp-pg-label selectors in atomic-theme.css and
 * route-product.css so the two cannot drift. Only the spacing is local.
 */
.asp-slot-strip__title {
    margin: 0;
}

.asp-slot-strip__progress {
    font-size: 12px;
    opacity: 0.7;
}

/* Scrolls rather than wraps: five tiles on a phone should stay one row the
   customer can swipe, not a grid that pushes the price off screen. */
.asp-slot-strip__list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
}

/* Tiles share the column rather than taking a fixed width. Five designs at a
   fixed 96px overflow the product column on a laptop, and a fifth design the
   customer has to scroll sideways to discover is a fifth design they forget
   to upload. They stop shrinking at 64px and the row scrolls below that. */
.asp-slot-tile {
    flex: 1 1 0;
    min-width: 64px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border: 1.5px solid rgba(0,0,0,0.15);
    border-radius: 10px;
    background: transparent;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.asp-slot-tile:hover:not(:disabled) {
    border-color: rgba(0,0,0,0.4);
}

.asp-slot-tile--active {
    border-color: currentColor;
    border-width: 2px;
    padding: 9px 7px; /* keep the tile the same size as the thicker border grows */
}

.asp-slot-tile:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.asp-slot-tile__thumb {
    /* Square, and sized from the tile it sits in rather than a fixed pixel
       count, so the thumbnails shrink with the tiles instead of forcing the
       row wider than the column. */
    width: 100%;
    max-width: 64px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(0,0,0,0.04);
    overflow: hidden;
}

.asp-slot-tile__thumb img {
    /* Sized by both axes and contained: artwork is any aspect ratio, and a
       thumbnail that crops is a thumbnail that lies about the cutline. */
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.asp-slot-tile__thumb--empty {
    font-size: 22px;
    opacity: 0.4;
}

.asp-slot-tile__label {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.asp-slot-tile__status {
    font-size: 10.5px;
    line-height: 1.3;
    text-align: center;
    opacity: 0.75;
}

.asp-slot-tile--needs-human .asp-slot-tile__status {
    opacity: 1;
    font-weight: 600;
}

/* Designs kept past what the quantity covers. Reachable in auto mode by
   lowering the quantity after uploading — the artwork is still on the order,
   so it is dimmed rather than hidden. */
.asp-slot-tile--over {
    border-style: dashed;
}

.asp-slot-strip__over {
    margin: 8px 0 0;
    font-size: 11.5px;
    line-height: 1.45;
    opacity: 0.8;
}

/* ────────────────────────────────────────────────────────────────────────
   The strip inside the studio

   Same markup, narrower home: the studio's left rail is a fraction of the
   product column, so five tiles have to give up the thumbnail size rather
   than the row. Scrolls sideways below that instead of wrapping, because a
   wrapped strip pushes the cutline controls off screen.
   ──────────────────────────────────────────────────────────────────────── */
.asp-slot-strip--studio {
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(128,128,128,0.25);
}

.asp-slot-strip--studio .asp-slot-tile {
    min-width: 52px;
    padding: 7px 4px;
    gap: 4px;
}

.asp-slot-strip--studio .asp-slot-tile__thumb {
    max-width: 44px;
}

.asp-slot-strip--studio .asp-slot-tile__label {
    font-size: 10.5px;
}

.asp-slot-strip--studio .asp-slot-tile__status {
    font-size: 9.5px;
}

/* The rail is dark in night mode; the default border is tuned for the light
   product page and disappears against it. */
.asp-studio--night .asp-slot-strip--studio .asp-slot-tile {
    border-color: rgba(255,255,255,0.22);
}
.asp-studio--night .asp-slot-strip--studio .asp-slot-tile--active {
    border-color: currentColor;
}
.asp-studio--night .asp-slot-strip--studio .asp-slot-tile__thumb {
    background: rgba(255,255,255,0.07);
}

/* Start over — quiet, because it discards work. Sits in the strip head beside
   the progress count, which is where a customer looks to check what they have. */
.asp-slot-strip__reset {
    margin-left: 10px;
    padding: 0;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 11.5px;
    color: inherit;
    opacity: 0.6;
    text-decoration: underline;
    cursor: pointer;
}
.asp-slot-strip__reset:hover { opacity: 1; }

/* ────────────────────────────────────────────────────────────────────────
   How many of each design

   The input sits beside the tile rather than inside it: the tile is a button,
   and an input nested in a button cannot be typed into without firing it.
   ──────────────────────────────────────────────────────────────────────── */
.asp-slot-cell {
    flex: 1 1 0;
    min-width: 64px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.asp-slot-cell .asp-slot-tile {
    width: 100%;
    min-width: 0;
}

.asp-slot-cell__qty {
    width: 100%;
    padding: 3px 4px;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 5px;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 12px;
    text-align: center;
    -moz-appearance: textfield;
}
.asp-slot-cell__qty::-webkit-inner-spin-button,
.asp-slot-cell__qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.asp-slot-strip__split {
    margin: 8px 0 0;
    font-size: 12px;
    opacity: 0.8;
}

/* A split that does not add up cannot be bought, so it is stated plainly
   rather than tucked away as a hint. */
.asp-slot-strip__split--bad {
    opacity: 1;
    font-weight: 600;
}

.asp-slot-strip__even {
    margin-top: 4px;
    padding: 0;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 11.5px;
    color: inherit;
    opacity: 0.65;
    text-decoration: underline;
    cursor: pointer;
}
.asp-slot-strip__even:hover { opacity: 1; }

.asp-slot-strip--studio .asp-slot-cell { min-width: 52px; }
.asp-slot-strip--studio .asp-slot-cell__qty { font-size: 11px; padding: 2px 3px; }
.asp-studio--night .asp-slot-cell__qty { border-color: rgba(255,255,255,0.25); }

/* ────────────────────────────────────────────────────────────────────────
   Kit chooser

   A split kit sells a stated quantity at a stated size for a stated price, so
   the only decision is the kit or the kit doubled. No size picker and no
   quantity list: a control that cannot change the price should not be there.
   ──────────────────────────────────────────────────────────────────────── */
.asp-kit__options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.asp-kit__opt {
    flex: 1 1 160px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 12px 14px;
    border: 1.5px solid rgba(0,0,0,0.15);
    border-radius: 10px;
    background: transparent;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s;
}
.asp-kit__opt:hover { border-color: rgba(0,0,0,0.4); }
.asp-kit__opt--active { border-color: currentColor; border-width: 2px; padding: 11px 13px; }

.asp-kit__qty   { font-size: 14px; font-weight: 600; }
.asp-kit__price { font-size: 18px; font-weight: 700; }
.asp-kit__save  { font-size: 11.5px; opacity: 0.7; }
/* No top margin: the note is its own row of the option's grid now, and the
   10px pushed it off the name it belongs to. No opacity either — it was
   fading #555B68 to roughly #7D8390, against a mock that sets that colour
   solid. Size is set with the rest of the option type in studio-4a.css. */
.asp-kit__note  { font-size: 12.5px; }
