/* ============================================================
   Magnetique — Estilos principales (index.html)
   ============================================================ */


/* ── Variables globales ─────────────────────────────────── */

:root {
    --rose:   #E7C8C5;
    --mist:   #B5C2C8;
    --ink:    #2B2B2B;
    --ink-2:  #5b5b5b;
    --paper:  #fff;
    --soft:   #F6F1F0;
    --accent: #8A6F6C;
    --ok:     #0DA37F;
    --err:    #D94242;
    --radius: 16px;
    --shadow: 0 6px 24px rgba(0,0,0,.08);
}


/* ── Reset / Base ───────────────────────────────────────── */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: linear-gradient(180deg, var(--soft), #fff);
    color: var(--ink);
    font-family: 'Instrument Sans', system-ui, sans-serif;
    line-height: 1.45;
}


/* ── Layout ─────────────────────────────────────────────── */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

.grid {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
}

@media (min-width: 960px) {
    .grid {
        grid-template-columns: 1.2fr .8fr;
    }
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.muted {
    color: var(--ink-2);
    font-size: 13px;
}

#orderHint.hint-warning {
    font-weight: bold;
    font-size: clamp(12px, 3vw, 14px);
    color: #EE0000;
}

#orderHint.hint-warning .hint-count {
    color: #CC0000;
}


/* ── Header / Brand ─────────────────────────────────────── */

header {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0,0,0,.06);
    z-index: 5;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.brand img {
    width: 150px;
    height: 50px;
    object-fit: contain;
}

.brand-title {
    font-family: 'Domine', serif;
    font-size: clamp(14px, 4vw, 20px);
}

.tag {
    font-size: 13px;
    color: var(--ink-2);
}


/* ── Ribbon de pasos ────────────────────────────────────── */

.ribbon {
    background: var(--rose);
    border-bottom: 1px solid rgba(0,0,0,.06);
}

.steps {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.step {
    background: #fff;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 13px;
}

.step b {
    background: var(--mist);
    padding: 2px 8px;
    border-radius: 999px;
    margin-right: 6px;
    color: #1c2730;
}


/* ── Cards ──────────────────────────────────────────────── */

.card {
    background: #fcfcfc;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card h2 {
    font-family: 'Domine', serif;
    margin: 0;
    padding: 14px 16px;
    font-size: 18px;
    border-bottom: 1px solid rgba(0,0,0,.06);
}

.card .body {
    padding: 14px;
}

#editorBody {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

#editorRow {
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#editorSidebar {
    width: 100%;
    min-width: unset;
}


/* ── Botones ────────────────────────────────────────────── */

button {
    appearance: none;
    border: none;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: .2px;
}

.btn-ghost {
    background: #fff;
    color: var(--ink);
    border: 1px solid rgba(0,0,0,.1);
}

.btn-soft {
    background: var(--mist);
    color: #1c2730;
}
.btn-soft-2 {
    background: var(--mist);
    color: #1c2730;    
    width: 100%;

}

/* ── Inputs ─────────────────────────────────────────────── */

input[type="number"],
input[type="text"],
input[type="email"],
input[type="range"] {
    width: 100%;
    background: #fff;
    color: var(--ink);
    border: 1px solid rgba(0,0,0,.12);
    padding: 12px;
    border-radius: 12px;
}

label {
    font-size: 12px;
    color: var(--ink-2);
    display: block;
    margin-bottom: 6px;
}

/* Input file oculto dentro de su wrapper */
.fileInputWrap {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.fileInputWrap input[type=file] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

#editorControls {
    width: 100%;
}
#editorControls > * {
    flex: 1 1 0;
    min-width: 0;
}
#editorControls .fileInputWrap {
    display: block;
}
#editorControls .fileInputWrap .boton-sweep,
#editorControls .boton-sweep {
    width: 100%;
}


/* ── Editor de canvas ───────────────────────────────────── */

.canvasWrap {
    position: relative;
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1/1;
    margin: 0 auto;
    background: #fff;
    border: 3px dashed #AAAAAA;
    border-radius: 16px;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

.canvasWrap:active {
    cursor: grabbing;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #fff;
}

/* Hint de "soltá una imagen" superpuesto al canvas */
.drop {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-2);
    pointer-events: none;
    padding: 10px;
    text-align: center;
}


/* ── Lista de ítems del pedido ──────────────────────────── */

.items {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}


.cartRow {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid rgba(0,0,0,.09);
    background: #fff;
    border-radius: 14px;
    padding: 10px;
}

.thumb {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: #ddd;
    flex: 0 0 auto;
    border: 1px solid rgba(0,0,0,.08);
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.meta {
    flex: 1 1 auto;
    min-width: 120px;
}

.meta .title {
    font-weight: 700;
}

.meta .sub {
    font-size: 12px;
    color: var(--ink-2);
}

.controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty {
    width: 90px;
}

.iconBtn {
    color: #000000;
    width: 100px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,.12);
    background: #fff;
    display: grid;
    place-items: center;
    font-size: 12px;
    cursor: pointer;
}


/* ── Tabla de resumen ───────────────────────────────────── */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    border-bottom: 1px solid rgba(0,0,0,.08);
    padding: 8px;
    font-size: 14px;
    text-align: left;
}

tfoot td {
    font-weight: 700;
}


/* ── Pill de info ───────────────────────────────────────── */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--rose);
    color: #4a3b39;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,.08);
}


/* ── Footer sticky con botón de pedido ─────────────────── */

.footerBar {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid rgba(0,0,0,.1);
    padding: 12px;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

/* Botón Agregar: mismo estilo que boton-sweep pero ancho automático */
#btnAdd {
    width: auto;
}

/* Botón con animación de brillo (sweep) */
.boton-sweep {
    width: 240px;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: #E7C8C5;
    color: #2b2b2b;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.boton-sweep::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.6), transparent);
    animation: sweep 2.5s infinite;
}

@keyframes sweep {
    0%   { left: -100%; }
    100% { left: 100%; }
}


/* ── Modales ────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

#imgModal {
    cursor: zoom-out;
}

.modal-overlay.hidden {
    display: none;
}

.modal-img {
    max-width: 90vw;
    max-height: 90vh;
    max-height: 90svh;
    border-radius: 10px;
    cursor: default;
}

/* Modal de confirmación de borrado de ítems */
.del-modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 24px 20px;
    max-width: 320px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
}

.del-modal-msg {
    font-size: 16px;
    margin: 0 0 20px;
    font-weight: 600;
    color: var(--ink);
}

.del-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.del-modal-actions button {
    flex: 1;
}

.modal-cant-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: min(480px, 92vw);
    width: 92vw;
    max-height: 90vh;
    max-height: 90svh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-cant-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 45vh;
    max-height: 45svh;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.08);
    display: block;
}

.modal-cant-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.modal-cant-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 22px;
    font-weight: 700;
    padding: 0;
    display: grid;
    place-items: center;
    background: var(--mist);
    color: var(--ink);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.modal-cant-num {
    font-size: 36px;
    font-weight: 700;
    min-width: 52px;
    text-align: center;
    color: var(--ink);
    font-family: 'Domine', serif;
}

.qty[readonly] {
    cursor: pointer;
    background: var(--soft);
}

@media (max-width: 420px) {
    .thumb { width: 48px; height: 48px; }
    .meta { min-width: 0; }
    .qty { width: 60px; padding: 8px; }
    .iconBtn { width: 70px; font-size: 11px; }
}


/* ── Modificadores de fila ──────────────────────────────── */

/* Alinea ítems al tope en lugar del centro */
.row-top {
    align-items: flex-start;
}

/* Distribuye espacio entre ítems */
.row-between {
    justify-content: space-between;
}


/* ── Layout del editor ──────────────────────────────────── */

/* Columna izquierda: canvas + zoom apilados verticalmente */
.editor-canvas-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0 0 auto;
    width: 100%;
    max-width: 360px;
}

/* Barra de zoom debajo del canvas (oculta hasta cargar imagen) */
.zoom-wrap {
    width: 100%;
}

/* Columna lateral derecha del editor (controles) */
.editor-sidebar {
    flex: 1;
    min-width: 260px;
}

/* Label "Zoom:" */
.zoom-label {
    font-size: 14px;
    font-weight: bold;
}


/* ── Sección Pedido ─────────────────────────────────────── */

/* Input de email del comprador */
.buyer-email-input {
    max-width: 260px;
    width: 100%;
}

/* Línea de total de imanes */
.total-line {
    margin-top: 10px;
    font-size: 14px;
}

/* Grid de ítems del carrito */
#items {
    margin-top: 12px;
}

/* Área de mensajes de estado */
#status {
    margin-top: 10px;
}


/* ── Utilidades de espaciado ────────────────────────────── */

.mt-8  { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }


/* ── Modal Espacio Vacío ─────────────────────────────────── */

.wb-modal-overlay {
    background: rgba(0,0,0,.55);
    padding: 16px;
    cursor: default;
}

.wb-modal-box {
    background: linear-gradient(180deg, var(--soft), #fff);
    border-radius: 18px;
    padding: clamp(20px,4vw,36px) clamp(16px,4vw,32px);
    width: min(500px, 92vw);
    max-height: 90vh;
    max-height: 90svh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    font-family: 'Instrument Sans', system-ui, sans-serif;
    position: relative;
}
.wb-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: #888;
    cursor: pointer;
    padding: 2px 6px;
}
.wb-close:hover { color: #333; }

#wbCanvas {
    border-radius: 12px;
    width: min(300px, 80vw);
    height: auto;
    aspect-ratio: 1 / 1;
    display: block;
    flex-shrink: 0;
}

.wb-color-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(90%, 90vw);
    padding: 12px;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 12px;
    background: rgba(255,255,255,.7);
}

.wb-color-panel.hidden {
    display: none;
}

.wb-title {
    font-family: 'Domine', serif;
    font-size: clamp(18px, 3vw, 22px);
    margin: 0;
    text-align: center;
    color: #2b2b2b;
}

.wb-desc {
    font-size: clamp(13px, 2vw, 15px);
    color: var(--ink-2);
    margin: 0;
    text-align: center;
}

.wb-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.wb-btn {
    width: 100%;
    text-align: left;
    font-size: clamp(13px, 2vw, 15px);
}

@media (max-height: 700px), (max-width: 480px) {
    .wb-modal-box {
        padding: 14px 12px;
        gap: 8px;
    }
    #wbCanvas {
        width: min(200px, 65vw);
    }
    .wb-color-panel {
        width: min(90%, 90vw);
    }
}

.wb-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.wb-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,.15);
    padding: 0;
    cursor: pointer;
    transition: transform .15s;
    flex: 0 0 auto;
}

.wb-swatch:hover {
    transform: scale(1.18);
}

.wb-swatch.active {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.wb-color-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wb-color-inputs input[type="color"] {
    width: 44px;
    height: 44px;
    padding: 3px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,.12);
    cursor: pointer;
    background: #fff;
}

.wb-eyedropper-btn {
    font-size: 13px;
    padding: 10px 14px;
    width: auto;
}
