*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #0f172a;
    color: #f9fafb;
}

/* CONTENEDOR GENERAL */

.editor-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER */

.ed-header {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.96);
    position: sticky;
    top: 0;
    z-index: 10;
}

.ed-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ed-logo-circle {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e40af, #22c55e);
    color: #f9fafb;
    font-weight: 700;
    font-size: 15px;
}

.ed-title-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ed-brand-name {
    font-weight: 600;
    font-size: 14px;
}

.ed-sub {
    font-size: 11px;
    color: #9ca3af;
}

.ed-id {
    font-size: 11px;
    color: #cbd5f5;
}

/* LAYOUT PRINCIPAL */

.ed-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 12px 10px 14px;
}

/* TARJETAS DEL EDITOR */

.ed-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ed-card {
    background: rgba(15, 23, 42, 0.96);
    border-radius: 14px;
    padding: 10px 12px 12px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.8);
}

.ed-card h2 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.ed-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 8px;
}

.ed-row label {
    font-size: 11px;
    color: #cbd5f5;
}

.ed-row-inline {
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

input[type="text"],
input[type="url"],
textarea,
select {
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: #020617;
    color: #e5e7eb;
    padding: 7px 9px;
    font-size: 13px;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

.ed-help-text {
    font-size: 11px;
    color: #9ca3af;
    margin: 2px 0 6px;
}

/* BOTONES */

.ed-actions {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Estilo base para todos los botones del editor */
.ed-btn {
    width: 100%;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
}

/* Botón principal: se queda con su verde original */
.ed-btn-primary {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #022c22;
    box-shadow: 0 10px 25px rgba(34, 197, 94, 0.5);
}

.ed-btn-primary:active {
    transform: scale(0.97) translateY(1px);
}

/* --- Botones secundarios con color propio --- */
.ed-btn-ghost {
    background: linear-gradient(135deg, #0ea5e9, #0369a1); /* cyan/azul elegante */
    color: #f9fafb;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.7);
    transition: background 0.15s ease, transform 0.05s ease;
}

.ed-btn-ghost:hover {
    background: linear-gradient(135deg, #0891b2, #075985);
}

.ed-btn-ghost:active {
    transform: scale(0.97) translateY(1px);
}

.ed-btn-ghost:hover {
    background: #115e59;           /* un poco más oscuro */
}

.ed-btn-ghost:active {
    transform: scale(0.97) translateY(1px);
}


/* PREVIEW */

.ed-preview {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ed-preview h2 {
    font-size: 13px;
    font-weight: 500;
    color: #e5e7eb;
}

.ed-preview-frame {
    width: 100%;
    min-height: 520px;
    border-radius: 18px;
    border: none;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.9);
    background: #020617;
}

/* MODO PC: DOS COLUMNAS */

@media (min-width: 900px) {
    .ed-main {
        flex-direction: row !important;
        align-items: flex-start;
        gap: 18px;
        padding: 16px 20px 20px;
    }

    /* Columna izquierda fija (formulario) */
    .ed-form-col {
        flex: 0 0 360px;
        max-width: 380px;
    }

    /* Columna derecha ocupa todo el espacio restante (preview) */
    .ed-preview-col {
        flex: 1 1 auto;
        min-width: 0;
    }

    .ed-preview-frame {
        min-height: 640px;
    }
}
/* Botón solo visible en móvil */
.ed-btn-mobile-only {
    display: none;
}

/* En pantallas chicas: ocultar columna de preview fija y mostrar botón móvil */
@media (max-width: 768px) {
    .ed-preview-col {
        display: none;
    }

    .ed-btn-mobile-only {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
        /* FAB flotante para el botón de vista previa móvil */
    #btn-open-mobile-preview {
        position: fixed;
        bottom: 0.85rem;
        right: 0.85rem;
        z-index: 900; /* debajo del overlay (que está en 1000) */
        border-radius: 999px;
        padding-inline: 1.2rem;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    }
}
/* En pantallas grandes: hacer sticky la columna de preview */
@media (min-width: 769px) {
    .ed-preview-col {
        position: sticky;
        top: 1rem;          /* separación desde el borde superior de la ventana */
        align-self: flex-start;
        height: fit-content; /* evita que se estire a toda la altura del contenedor */
    }
}

/* Overlay de vista previa móvil */
.mobile-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.mobile-preview-overlay.is-visible {
    display: flex;
}

.mobile-preview-inner {
    position: relative;
    background: #111;
    border-radius: 1.25rem;
    width: 100%;
    max-width: 420px;
    aspect-ratio: 9 / 16;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.mobile-preview-frame {
    width: 100%;
    height: 100%;
    border: 0;
}

.mobile-preview-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    border: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 999px;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
}
/* Toast Demo (aviso temporal) */

.demo-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(15, 23, 42, 0.95);
    color: #e5e7eb;
    padding: 20px 28px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 500;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    z-index: 2000;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.demo-toast-label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: #a5b4fc;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.demo-toast--visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
/* === Ajuste para que el botón flotante no tape "Ver código QR" en móvil === */

@media (max-width: 768px) {
  .ed-actions {
    /* deja espacio como si hubiera otra fila de botones */
    margin-bottom: 96px;
  }

  .ed-btn-mobile-only {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    border-radius: 999px;
  }
}
