/* ==========================================================================
   Personalizar tarjeta (templates/personalizar.php, Tokka_Customizer).
   Se carga después de home.css.
   ========================================================================== */

.tpz-main { padding-top: 96px; }
.tpz-body .tsh-preorder {
    display: flex; align-items: center; gap: 12px; margin: 0 var(--gutter) 24px; padding: 14px 20px; border-radius: 14px;
    background: var(--mint); font-size: 15px; line-height: 1.4;
}
.tpz-body .tsh-preorder p { margin: 0; }
.tpz-body .tsh-preorder .th-dot { flex: none; background: var(--brand); }

.tpz-hero { padding: 40px var(--gutter) 8px; display: flex; flex-direction: column; gap: 16px; }
.tpz-title { font-size: clamp(44px, 6.4vw, 104px); font-weight: 500; line-height: 0.92; letter-spacing: -0.055em; margin: 0; }
.tpz-lead { font-size: clamp(17px, 1.4vw, 21px); color: var(--ink-60); max-width: 32em; margin: 0; }

.tpz {
    display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px 64px; align-items: start;
    padding: 40px var(--gutter) 120px;
}

/* ---------- Vista previa ---------- */
.tpz-preview { position: sticky; top: 96px; display: grid; gap: 20px; }
.tpz-face { position: relative; margin: 0; display: grid; gap: 10px; }
.tpz-face canvas {
    display: block; width: 100%; height: auto; aspect-ratio: 1181 / 755; border-radius: 4.5% / 7%;
    box-shadow: 0 1px 2px rgba(32, 34, 26, 0.08), 0 18px 40px -12px rgba(32, 34, 26, 0.28);
    background: var(--ink-06);
}
.tpz-face figcaption { font-size: 13px; font-weight: 500; color: var(--ink-60); }
.tpz-note { margin: 0; font-size: 13px; color: var(--ink-60); }

/* ---------- Panel ---------- */
.tpz-panel { display: flex; flex-direction: column; gap: 28px; }
.tpz-mode { display: flex; flex-direction: column; gap: 24px; }
.tpz-mode[hidden] { display: none; }
.tpz-field { display: flex; flex-direction: column; gap: 10px; min-width: 0; border: 0; margin: 0; padding: 0; }
.tpz-label { font-size: 14px; font-weight: 500; padding: 0; }
.tpz-label em { font-style: normal; font-weight: 400; color: var(--ink-60); }
.tpz-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tpz input[type=text], .tpz input[type=number] {
    width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--ink-15); border-radius: 4px;
    background: var(--white); color: var(--ink); font: inherit; font-size: 16px;
}
.tpz input[type=text]:focus, .tpz input[type=number]:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }

/* Subir archivo */
.tpz-drop {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-height: 112px; padding: 18px; border: 1.5px dashed var(--ink-15); border-radius: 12px; background: var(--white);
    text-align: center; cursor: pointer; transition: border-color 0.2s ease, background-color 0.2s ease;
}
.tpz-drop:hover, .tpz-drop.is-over { border-color: var(--ink); }
.tpz-drop.is-filled { border-style: solid; border-color: var(--brand); background: var(--mint); }
.tpz-drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.tpz-drop input[type=file]:focus-visible + .tpz-drop-title { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 4px; }
.tpz-drop-title { font-size: 16px; font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpz-drop small { font-size: 13px; color: var(--ink-60); line-height: 1.4; }

/* Fuentes */
.tpz-fonts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.tpz-font { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px 10px; border-radius: 10px; background: var(--white); box-shadow: inset 0 0 0 1px var(--ink-15); cursor: pointer; }
.tpz-font-aa { font-size: 28px; line-height: 1; }
.tpz-font small { font-size: 11.5px; color: var(--ink-60); }

/* Radios ocultos con estado visual */
.tpz-font input, .tpz-sw input[type=radio], .tpz-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tpz-font:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ink); }
.tpz-font:has(input:focus-visible), .tpz-sw:has(input:focus-visible), .tpz-pill:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Colores */
.tpz-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.tpz-sw { position: relative; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }
.tpz-sw > span:not(.screen-reader-text) { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(32, 34, 26, 0.18); }
.tpz-sw:has(input:checked) { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.tpz-sw--custom > span { background: conic-gradient(#e0007a, #f39200, #ffe7a6, #00877d, #1344c4, #7b2cbf, #e0007a); }
.tpz-sw--custom input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.tpz-pills { display: flex; gap: 8px; }
.tpz-pill { position: relative; cursor: pointer; }
.tpz-pill span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 999px; background: var(--white); box-shadow: inset 0 0 0 1px var(--ink-15); font-size: 14px; font-weight: 500; }
.tpz-pill:has(input:checked) span { background: var(--ink); color: var(--paper-text); box-shadow: none; }

/* Diseño propio */
.tpz-back { align-self: flex-start; padding: 0; border: 0; background: none; font: inherit; font-size: 14px; color: var(--ink-60); cursor: pointer; }
.tpz-back:hover { color: var(--ink); }
.tpz-h2 { font-size: 28px; font-weight: 500; letter-spacing: -0.035em; margin: -8px 0 0; }
.tpz-help { margin: -12px 0 0; font-size: 15px; color: var(--ink-60); line-height: 1.5; }
.tpz-help strong { color: var(--ink); font-weight: 500; }

/* Compra */
.tpz-buy { display: flex; flex-direction: column; gap: 14px; padding-top: 24px; border-top: 1px solid var(--ink-15); }
.tpz-buy-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.tpz-qty { display: flex; flex-direction: column; gap: 8px; }
.tpz-qty input { width: 96px !important; text-align: center; }
.tpz-total { margin: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; color: var(--ink-60); }
.tpz-total strong { font-size: 28px; font-weight: 500; letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.tpz-more { margin: 0; font-size: 13px; color: var(--ink-60); }
.tpz-more a { color: var(--ink); text-underline-offset: 3px; }
.tpz-error { margin: 0; padding: 12px 16px; border-radius: 8px; background: #fbe4e1; color: #7a1c10; font-size: 14px; line-height: 1.4; }
.tpz-error[hidden] { display: none; }
.tpz-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpz-actions .th-btn { justify-content: center; border: 0; cursor: pointer; font-family: var(--font); min-height: 52px; }
.tpz.is-busy .tpz-actions .th-btn { opacity: 0.6; pointer-events: none; }

/* Botones alternativos */
.tpz-alt { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpz-alt-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 16px;
    border: 0; border-radius: 12px; background: var(--white); box-shadow: inset 0 0 0 1px var(--ink-15);
    color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; text-align: center; text-decoration: none; cursor: pointer;
    transition: box-shadow 0.2s ease;
}
.tpz-alt-btn:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.tpz-alt-btn[hidden] { display: none; }
.tpz-alt:has([data-alt-upload][hidden]) { grid-template-columns: 1fr; }
.tpz-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- Celular ---------- */
@media (max-width: 900px) {
    .tpz-main { padding-top: 80px; }
    .tpz { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-bottom: 88px; }
    .tpz-preview { position: static; grid-template-columns: 1fr 1fr; gap: 12px; }
    .tpz-note { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
    .tpz-row, .tpz-actions, .tpz-alt { grid-template-columns: 1fr; }
    .tpz-preview { grid-template-columns: 1fr; }
    .tpz-fonts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Edición directa sobre la vista previa (personalizar.js, "Edición directa"). */
/* Selector largo: .tpz input[type=text] (fondo blanco, borde, alto mínimo) no debe aplicar aquí. */
.tpz .tpz-face input.tpz-inline, .tpz .tpz-face input.tpz-inline:focus {
    position: absolute; z-index: 2; margin: 0; padding: 0; min-height: 0; border: 0; border-radius: 6px;
    background: transparent; outline: 2px dashed currentColor; outline-offset: 2px; box-shadow: none;
    line-height: 1; caret-color: currentColor; letter-spacing: normal;
}
.tpz .tpz-face input.tpz-inline::placeholder { color: currentColor; opacity: 0.4; }

/* "Igual al frente" dentro de la fila de colores del reverso. */
.tpz-swatches .tpz-pill--same span { min-height: 40px; }

/* La edición directa es solo de la plantilla. */
.tpz.is-upload .tpz-note strong { display: none; }
