/*
 * Configurator + image-crop UI styling, ported faithfully from the legacy storefront.css
 * so the canvas editor keeps its exact look & behaviour when the product page runs in the
 * Groover theme. configurator.js / image-crop.js emit these .sf-* classes; only these are
 * needed here (the rest of the product page uses theme markup). Brand colour already #309bd9.
 */
:root {
    --color-bg: #f7f9fb;
    --color-surface: #ffffff;
    --color-border: #e2e6ec;
    --color-border-strong: #cdd3dc;
    --color-text: #1a2230;
    --color-muted: #667085;
    --color-primary: #309bd9;
    --color-primary-hover: #2589c2;
    --color-primary-active: #1f76a8;
    --color-primary-tint: #eaf5fb;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-lg: 0 20px 40px rgba(16, 24, 40, 0.16);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

/* ---- View tabs (front/back/… of the product) ---- */
.sf-view-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.sf-view-tab {
    padding: 0.5rem 1.1rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
}
.sf-view-tab:hover { border-color: var(--color-primary); color: var(--color-primary); }
.sf-view-tab.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ---- Canvas ---- */
.sf-canvas-wrap { margin-bottom: 1.25rem; }
.sf-canvas-wrap canvas {
    max-width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    cursor: grab;
    box-shadow: var(--shadow-sm);
    /* Ohne das behandelt der Browser jede Wischgeste auf der Leinwand als Scrollen und
       liefert keine pointermove-Ereignisse — Verschieben wäre am Handy unmöglich.
       touch-none unterbindet auch das Doppeltipp-Zoomen auf der Leinwand. */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Fehlermeldung unter der Leinwand. Sie steht bewusst genau dort und nicht in der Statuszeile
   weit unten — dort hat sie nie jemand gesehen. */
.sf-canvas-note {
    margin: -0.75rem 0 0.75rem;
    padding: 10px 14px;
    border-left: 3px solid #c0392b;
    border-radius: 0 4px 4px 0;
    background: rgba(192, 57, 43, .08);
    color: #922b21;
    font-size: 0.875rem;
    line-height: 1.45;
}

/* Hinweis unter der Leinwand. Bewusst zurückhaltend: er erklärt eine Möglichkeit, er warnt
   nicht. Auf dem Handy steht er direkt unter dem Bild und damit da, wo er gebraucht wird. */
.sf-canvas-hint {
    margin: -0.75rem 0 1.25rem;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--color-text-muted, #6b7684);
}

/* ---- Zone control boxes ---- */
.sf-zone-controls { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.1rem; margin-bottom: 1.75rem; }
.sf-zone-box {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}
.sf-zone-box legend { font-weight: 600; padding: 0 0.4rem; }

/* ---- Layer list ---- */
.sf-layer-list { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.75rem; }
.sf-layer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.5rem;
    background: var(--color-bg);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.sf-layer-row.selected { border-color: var(--color-primary); background: var(--color-primary-tint); }
.sf-layer-label {
    flex: 1;
    text-align: left;
    background: none;
    border: none;
    color: var(--color-text);
    padding: 0.2rem;
    font-size: 0.85rem;
    cursor: pointer;
}
.sf-layer-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }
.sf-layer-actions button {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    padding: 0.2rem 0.45rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}
.sf-layer-actions button:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
.sf-layer-actions button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Fields inside zone boxes ---- */
.sf-field {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--color-muted);
    font-weight: 500;
}
.sf-field input, .sf-field select, .sf-field textarea {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--color-text);
    font-family: inherit;
    background: var(--color-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sf-field input:focus, .sf-field select:focus, .sf-field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-tint);
}

/* ---- Secondary buttons (+Text/+Bild/+Farbe, remove image, crop cancel) ---- */
.sf-btn-secondary {
    display: inline-block;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border-strong);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease;
}
.sf-btn-secondary:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-tint); }

.sf-save-status { color: var(--color-muted); font-size: 0.85rem; }

/* ---- Image crop overlay ---- */
.sf-crop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.sf-crop-panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
}
.sf-crop-panel h3 { margin-top: 0; }
.sf-crop-canvas-wrap { line-height: 0; }
/* Gleicher Grund wie bei der Konfigurator-Leinwand: ohne touch-action fängt der Browser
   die Wischgeste als Scrollen ab und das Zuschneiden ließe sich am Handy nicht bedienen. */
.sf-crop-canvas-wrap canvas {
    max-width: 100%;
    height: auto;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.sf-crop-canvas-wrap canvas { max-width: 100%; cursor: move; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.sf-crop-transparency-note { font-size: 0.85rem; color: var(--color-muted); }
.sf-crop-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
/* Primary crop button (applyBtn is a bare <button>) — scoped, does not touch theme buttons */
.sf-crop-actions button:not(.sf-btn-secondary) {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}
.sf-crop-actions button:not(.sf-btn-secondary):hover { background: var(--color-primary-hover); }

/* =====================================================================================
   Umschaltung Galerie <-> Gestalten
   =====================================================================================
   Diese drei Bedienelemente waren auf der Theme-Produktseite völlig ungestaltet: ihre Regeln
   standen ausschließlich in public/assets/css/storefront.css, und die lädt die Theme-Seite
   nicht (siehe _theme_header.php). Sichtbar war deshalb ein nackter Browser-Knopf.
   ===================================================================================== */

/* Einladung "Selbst gestalten" unter der Galerie */
.sf-design-invite {
    margin-top: 1rem;
    padding: 1rem 1.15rem;
    border: 1px dashed var(--shop-border, #e4e4e4);
    border-radius: 10px;
    background: linear-gradient(135deg, var(--shop-brand-tint, #e8f4fb), #ffffff);
    line-height: 1.45;
}
.sf-design-invite p { margin: 0 0 .75rem; font-size: 14px; color: var(--shop-muted, #707070); }

.sf-design-start {
    width: 100%;
    padding: 11px 18px;
    border: 0;
    border-radius: 8px;
    background: var(--shop-brand, #309bd9);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease;
}
.sf-design-start:hover { background: var(--shop-brand-dark, #2a89c0); }

/* "← Zurück zu den Produktbildern" über der Leinwand */
.sf-design-exit {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: 12px;
    padding: 8px 14px;
    border: 1px solid var(--shop-border, #e4e4e4);
    border-radius: 8px;
    background: #fff;
    color: var(--shop-ink, #292929);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.sf-design-exit:hover {
    background: var(--shop-brand-tint, #e8f4fb);
    border-color: var(--shop-brand, #309bd9);
    color: var(--shop-brand-dark, #2a89c0);
}
