/* ==========================================================================
   Litofanía · Configurador de láminas individuales
   Paleta caligráfica: tinta #3b2a1e sobre papel #f3ead8
   ========================================================================== */

#wls-configurator-container {
    --wls-ink: #3b2a1e;
    --wls-paper: #f3ead8;
    --wls-accent: #2271b1;
    /* Grosor extra del trazo caligráfico (negrilla). Igual que BOLD_RATIO en el JS. */
    --wls-bold: 0.035em;

    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #ddd;
    position: relative;
}

.wls-quantity-selector {
    margin-bottom: 20px;
}

.wls-quantity-selector select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 16px;
    margin-left: 10px;
}

.wls-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.wls-sheet-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    width: 180px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.wls-sheet-card h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
}

/* --------------------------------------------------------------------------
   Selector Foto / Texto
   Selectores con #id: los temas de WooCommerce estilizan <button> con fuerza.
   -------------------------------------------------------------------------- */

#wls-configurator-container .wls-mode-toggle {
    display: flex;
    gap: 2px;
    padding: 3px;
    margin-bottom: 12px;
    background: #f1f5f9;
    border-radius: 999px;
}

#wls-configurator-container .wls-mode-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 7px 4px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    background-image: none;
    box-shadow: none;
    color: #64748b;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

#wls-configurator-container .wls-mode-btn:hover {
    background: transparent;
    color: #1f2937;
}

#wls-configurator-container .wls-mode-btn.is-active {
    background: #ffffff;
    color: #1f2937;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

#wls-configurator-container .wls-mode-btn:focus-visible {
    outline: 2px solid var(--wls-accent);
    outline-offset: 1px;
}

/* --------------------------------------------------------------------------
   Recuadro de la lámina
   -------------------------------------------------------------------------- */

.wls-preview-area {
    width: 150px;
    height: 150px;
    margin: 0 auto 15px;
    border: 2px dashed #ccc;
    border-radius: 6px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    container-type: inline-size;
}

.wls-preview-area:hover, .wls-preview-area.dragover {
    border-color: var(--wls-accent);
    background: #e8f0fe;
}

.wls-preview-placeholder {
    color: #666;
    font-size: 12px;
    pointer-events: none;
    padding: 10px;
}

.wls-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Efecto Litofanía (Gris + Contraste) */
    filter: grayscale(100%) contrast(1.2) brightness(1.1);
}

/* --------------------------------------------------------------------------
   Lámina en modo Texto
   El data-mode de la tarjeta decide qué se ve; el JS solo cambia ese atributo.
   -------------------------------------------------------------------------- */

/* Negrilla caligráfica. Great Vibes solo tiene un grosor, así que se engruesa
   el trazo con el mismo factor que usa el canvas al generar el PNG. Se anula la
   negrita sintética del navegador para que la vista previa sea la pieza grabada. */
.wls-tile-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8%;
    text-align: center;
    font-family: "Great Vibes", "Segoe Script", cursive;
    font-weight: 400;
    font-synthesis: none;
    -webkit-text-stroke: var(--wls-bold) var(--wls-ink);
    paint-order: stroke fill;
    color: var(--wls-ink);
    font-size: 1.35rem;
    font-size: 16cqi; /* Proporcional al recuadro donde se soporte */
    line-height: 1.15;
    word-break: break-word;
    overflow: hidden;
    pointer-events: none;
}

.wls-tile-text:empty::before {
    content: "Tu texto";
    opacity: 0.35;
}

.wls-sheet-card[data-mode="photo"] .wls-tile-text,
.wls-sheet-card[data-mode="photo"] .wls-text-input {
    display: none;
}

.wls-sheet-card[data-mode="text"] .wls-preview-placeholder,
.wls-sheet-card[data-mode="text"] .wls-preview-img,
.wls-sheet-card[data-mode="text"] .wls-file-input {
    display: none !important;
}

.wls-sheet-card[data-mode="text"] .wls-preview-area {
    cursor: text;
    background: var(--wls-paper);
    border-style: solid;
    border-color: #e6dcc6;
}

.wls-sheet-card[data-mode="text"] .wls-preview-area:hover,
.wls-sheet-card[data-mode="text"] .wls-preview-area.dragover {
    background: var(--wls-paper);
    border-color: var(--wls-accent);
}

.wls-text-input {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 0 10px;
    padding: 8px 10px;
    font-size: 1rem; /* 1rem evita el zoom automático de iOS al enfocar */
    text-align: center;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    background: #fbfcfd;
    color: #1f2937;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wls-text-input:focus {
    outline: none;
    border-color: var(--wls-accent);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.wls-text-hint {
    display: block;
    margin-top: 16px;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* --------------------------------------------------------------------------
   Botones y estados
   -------------------------------------------------------------------------- */

.wls-upload-btn {
    display: block;
    width: 100%;
    padding: 6px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.wls-upload-btn:hover {
    background: #e0e0e0;
}

#wls-status-message.error {
    color: #b32d2e;
}

#wls-status-message.success {
    color: #1e7e34;
}

#wls-status-message.is-progress {
    color: #333;
}

#wls-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 10;
}

.wls-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--wls-accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ocultar elementos nativos de Woo que vamos a sobreescribir si fuera necesario */
form.cart .quantity {
    /* Hide default quantity if we control it from JS */
    display: none !important;
}

/* Verificación anti-bots (Turnstile). Invisible salvo que Cloudflare pida un reto. */
.wls-turnstile {
    margin: 10px 0;
}

.wls-turnstile:empty {
    display: none;
}

/* Aviso cuando la compra sin cuenta no está disponible. */
.wls-login-notice {
    margin: 15px 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: #fdf6e3;
    border-left: 3px solid #d9b74a;
}
