/* ==========================================================================
   MI APP - COMMAND CENTER SUB-LAYOUT (2026)
   ========================================================================== */

/* Main Wrapper that sits inside the Content Area */
.mi-app-container {
    display: grid;
    /* Columns: Sub-Sidebar (Steps) | Content (Form) | Preview (Phone) */
    grid-template-columns: 260px 1fr 420px;
    grid-template-rows: 100vh;
    height: 100vh;
    width: 100%;
    background: #f8fafc;
    overflow: hidden;
    gap: 0;
}

/* --- COLUMN 1: STEPS SIDEBAR (White) --- */
.sub-sidebar-steps {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sub-header {
    margin-bottom: 30px;
}

.sub-header h2 {
    font-size: 1.25rem;
    /* 20px */
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}

.sub-header p {
    font-size: 0.85rem;
    color: #64748b;
    margin: 4px 0 0;
}

.step-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    /* Subtle border */
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    background: #f8fafc;
}

.step-card.active {
    background: #6366f1;
    /* Indigo-500 */
    border-color: #6366f1;
    color: white;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.25);
}

.step-card.active .step-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.step-card.active .step-text h4,
.step-card.active .step-text span {
    color: white !important;
}

.step-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-text {
    display: flex;
    flex-direction: column;
}

.step-text span {
    font-size: 0.7rem;
    /* Tiny label "PASO 1" */
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.step-text h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
    margin: 0;
    line-height: 1.2;
}

.btn-download-container {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.btn-download-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    color: #475569;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: 0.2s;
}

.btn-download-sub:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* --- COLUMN 2: WORKSPACE (Form) --- */
.workspace-center {
    padding: 0;
    /* NO PADDING - Allow card to fill full width/height */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    background: #ffffff;
    /* White background to match card */
    position: relative;
    overflow-y: auto;
    width: 100%;
}

.form-container-card {
    background: white;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    /* Fill full height */
    border-radius: 0;
    box-shadow: none;
    padding: 40px;
    /* Reduced padding to maximize width */
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    /* FORCE STRETCH TO FILL WIDTH */
}

#connection-form-wrapper {
    width: 100%;
    max-width: none;
    /* SIN LÍMITES */
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.form-header-center {
    text-align: center;
    margin-bottom: 40px;
    width: 100%;
    /* Ancho completo */
}

.form-header-center h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 8px;
}

.form-header-center p {
    color: #64748b;
    font-size: 1rem;
}

.mobile-hero-chip {
    display: none;
}

.mobile-hero-chip .hero-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    text-transform: none;
    color: #1e293b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.mobile-hero-chip .hero-pill i {
    color: #6366f1;
}

/* Split Connection Box -> NOW VERTICAL STACK FOR FULL WIDTH */
.connection-split-box {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    margin-bottom: 20px;
}

.connect-step-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.connect-step-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: #1e293b;
    font-size: 1rem;
}

.badge-circle {
    width: 24px;
    height: 24px;
    background: #6366f1;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
}

.input-compact {
    width: 100%;
    height: 56px;
    /* MÁS GRANDE - 56px */
    padding: 0 24px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 600;
    background: #f8fafc;
    transition: all 0.3s ease;
    outline: none;
    margin-bottom: 16px;
}

.input-compact:focus {
    border-color: #6366f1;
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn-download-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 56px;
    /* MISMO TAMAÑO QUE INPUTS */
    width: 100%;
    border: 2px solid #6366f1;
    border-radius: 16px;
    background: white;
    color: #6366f1;
    font-weight: 800;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-download-action:hover {
    background: #6366f1;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

.btn-sync-main {
    width: 100%;
    /* ANCHO COMPLETO */
    max-width: none;
    /* SIN LÍMITES */
    margin-top: 50px;
    height: 64px;
    /* MÁS GRANDE Y PROMINENTE */
    background: #111827;
    color: white;
    border-radius: 18px;
    font-weight: 900;
    border: none;
    cursor: pointer;
    font-size: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.btn-sync-main:hover {
    background: #000;
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.progress-bar-container {
    width: 100%;
    /* Ancho completo */
    max-width: none;
    margin-top: 30px;
    background: #f1f5f9;
    border-radius: 20px;
    padding: 8px;
    display: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-sync-main:active {
    transform: translateY(-1px);
}

.progress-bar-fill {
    height: 40px;
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
    border-radius: 8px;
    width: 0%;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    overflow: hidden;
    white-space: nowrap;
}

.btn-rounded-cta {
    border-radius: 999px;
    padding: 14px 20px;
    width: 100%;
    font-size: 0.95rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

.btn-rounded-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 32px rgba(15, 23, 42, 0.25);
}

.btn-rounded-cta i {
    font-size: 1rem;
}

.btn-ghost-cta {
    background: #ffffff;
    color: #111827;
    border: 2px solid rgba(99, 102, 241, 0.4);
}

.btn-solid-cta {
    background: linear-gradient(135deg, #6366f1, #0ea5e9);
    color: white;
}


/* --- COLUMN 3: PREVIEW (Right) --- */
.preview-pane-right {
    background: #f1f5f9;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid #e2e8f0;
}

/* --- OVERRIDE FOR MOBILE PREVIEW NAV STYLE --- */
/* The user wants "Inicio" button to NOT have blue background when active inside the preview phone */
#preview-screen .app-bottom-nav .nav-item.active {
    background-color: transparent !important;
    /* Override potential blue bg */
    color: #6366f1 !important;
    /* Default blue text for others */
}

/* FORCE INICIO (HOME) NEUTRAL - FIRST CHILD */
#preview-screen .app-bottom-nav .nav-item:first-child.active {
    background-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #64748b !important;
    /* Neutral Slate */
}

#preview-screen .app-bottom-nav .nav-item:first-child.active .nav-icon-wrapper i,
#preview-screen .app-bottom-nav .nav-item:first-child.active i {
    color: #64748b !important;
}

#preview-screen .app-bottom-nav .nav-item:first-child.active span {
    color: #64748b !important;
}

/* Ensure no background on ANY nav item in preview */
#preview-screen .app-bottom-nav .nav-item {
    background: transparent !important;
}

/* Reuse phone mockup structure but center it perfectly */
.phone-mockup-centered {
    transform: scale(0.95);
    transform-origin: center;
}

/* --- ANIMATIONS --- */
@keyframes pulse-indigo {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }

    70% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

@keyframes titilar {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.85;
        transform: scale(1.03);
        filter: brightness(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- BREADCRUMBS --- */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 25px;
    padding: 10px 20px;
    background: white;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    width: fit-content;
}

.breadcrumb-item {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.breadcrumb-item.active {
    color: #6366f1;
}

.breadcrumb-separator {
    color: #cbd5e1;
}

/* --- GENERATE BUTTON (SIDEBAR) --- */
.btn-generate-app-sidebar {
    margin-top: 20px;
    width: 100%;
    padding: 18px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

.btn-generate-app-sidebar span {
    font-size: 1.1rem;
}

.btn-generate-app-sidebar i {
    font-size: 1.4rem;
}

.btn-generate-app-sidebar.titilar {
    animation: titilar 2s infinite ease-in-out;
}

.btn-generate-app-sidebar:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
    filter: brightness(1.1);
}

.btn-generate-app-sidebar:active {
    transform: translateY(-1px);
}

.btn-generate-app-sidebar.disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    animation: none;
}

/* --- INNER STEP NAVIGATION --- */
.step-nav-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 40px;
}

.btn-step-nav {
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.btn-step-nav.primary {
    background: #6366f1;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-step-nav.secondary {
    background: #f1f5f9;
    color: #475569;
}

.btn-step-nav:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

/* --- VERIFICADOR DE CONEXIÓN (BASE DESKTOP) --- */
#local-connection-verifier {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s;
    visibility: visible;
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 1200px) {
    .mi-app-container {
        /* On smaller desktop/tablet, stack the preview or hide it? */
        /* Let's keep 3 cols but shrink width or switch to 2 cols */
        grid-template-columns: 240px 1fr;
    }

    .preview-pane-right {
        display: none;
        /* Hide preview on tablet in editor mode to save space */
    }
}

@media (max-width: 900px) {

    /* CONTENEDOR PRINCIPAL: Stack vertical sin overflow horizontal */
    .mi-app-container {
        display: flex !important;
        flex-direction: column !important;
        overflow-x: hidden !important;
        /* ELIMINAR SCROLL LATERAL */
        overflow-y: auto !important;
        height: auto !important;
        width: 100% !important;
    }

    .logo-mobile {
        height: auto !important;
        max-height: 308px !important;
        width: 200px !important;
        object-fit: contain !important;
    }

    /* OCULTAR COMPLETAMENTE LA SIDEBAR DE PASOS EN MÓVIL */
    .top-bar-mobile {
        display: flex !important;
        height: 56px !important;
        background: #fff !important;
        padding: 0 15px !important;
        border-bottom: 1px solid #e2e8f0 !important;
        z-index: 2000 !important;
        flex-shrink: 0 !important;
        align-items: center !important;
    }

    .sub-sidebar-steps {
        display: flex !important;
        flex-direction: row !important;
        padding: 8px 15px !important;
        gap: 12px !important;
        overflow-x: auto !important;
        background: #fff !important;
        border-bottom: 1px solid #e2e8f0 !important;
        scrollbar-width: none !important;
        z-index: 1000 !important;
        flex: 0 0 60px !important;
        width: 100% !important;
        align-items: center !important;
    }

    /* OCULTAR BASURA EXTRA */
    .sub-sidebar-steps .sub-header,
    .sub-sidebar-steps .btn-download-container,
    .sub-sidebar-steps #btn-generate-sidebar,
    .sub-sidebar-steps .btn-generate-app-sidebar,
    .sub-sidebar-steps p {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    .sub-sidebar-steps::-webkit-scrollbar {
        display: none;
    }

    .step-card {
        flex: 0 0 auto !important;
        height: 40px !important;
        padding: 0 16px !important;
        border-radius: 20px !important;
        background: #f1f5f9 !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        color: #475569 !important;
        border: 1px solid transparent !important;
    }

    .step-card.active {
        background: #6366f1 !important;
        color: white !important;
    }

    .step-card .step-icon {
        width: 16px !important;
        height: 16px !important;
        margin: 0 !important;
    }

    .step-card .step-text h4 {
        font-size: 0.85rem !important;
        margin: 0 !important;
        font-weight: 700 !important;
    }



    /* WORKSPACE CENTER: Ocupa todo el ancho */
    .workspace-center {
        padding: 0 !important;
        width: 100% !important;
        overflow-x: hidden !important;
        order: 1 !important;
        /* PRIMERO: Contenido del paso */
        background: #fff !important;
        /* White into white to avoid background noise */
    }

    /* ELIMINAR BANNERS REDUNDANTES */
    .content-pane::before {
        display: none !important;
    }

    /* FORMULARIO: Ajustado para móvil */
    .form-container-card {
        padding: 5px 15px !important;
        /* MINIMUM PADDING */
        margin: 0 !important;
        min-height: auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: #ffffff !important;
        border-radius: 0 !important;
    }

    /* Header del formulario pegado */
    .form-header-center {
        margin: 0 !important;
        padding: 5px 0 !important;
    }

    .form-header-center h1 {
        font-size: 1.5rem !important;
        margin-bottom: 6px !important;
        line-height: 1.3 !important;
    }

    .form-header-center p {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
    }

    /* Contenedor de pasos verticales */
    .vertical-steps-container {
        gap: 20px !important;
        width: 100% !important;
    }

    .step-block {
        width: 100% !important;
        background: #f8fafc !important;
        padding: 15px !important;
        border-radius: 12px !important;
    }

    /* Título de paso de conexión */
    .connect-step-title {
        font-size: 0.95rem !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
    }

    .badge-circle {
        width: 22px !important;
        height: 22px !important;
        font-size: 0.75rem !important;
    }

    /* Inputs más compactos pero usables */
    .input-compact {
        height: 48px !important;
        font-size: 0.95rem !important;
        padding: 0 16px !important;
        margin-bottom: 10px !important;
        border-radius: 10px !important;
    }

    /* Botón de descarga */
    .btn-download-action {
        height: 48px !important;
        font-size: 0.95rem !important;
        border-radius: 10px !important;
    }

    /* Botón de sincronización principal */
    .btn-sync-main {
        height: 52px !important;
        font-size: 0.95rem !important;
        margin-top: 25px !important;
        border-radius: 12px !important;
        letter-spacing: 0.5px !important;
    }

    /* Barra de progreso */
    .progress-bar-container {
        margin-top: 20px !important;
        padding: 6px !important;
        border-radius: 12px !important;
    }

    .progress-bar-fill {
        height: 30px !important;
        font-size: 0.75rem !important;
    }

    /* OVERLAY DE CONEXIÓN ACTIVA */
    .connection-locked-overlay {
        padding: 20px 15px !important;
        gap: 12px !important;
    }

    .sync-badge-permanent {
        padding: 10px 16px !important;
        font-size: 0.8rem !important;
        gap: 8px !important;
    }

    .btn-shipping-modal-trigger {
        padding: 14px 16px !important;
        font-size: 0.85rem !important;
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
        border-radius: 10px !important;
    }

    /* VERIFICADOR LOCAL */
    #local-connection-verifier {
        padding: 30px 20px !important;
    }

    #local-connection-verifier h3 {
        font-size: 1.2rem !important;
        text-align: center !important;
    }

    #local-connection-verifier p {
        font-size: 0.85rem !important;
        text-align: center !important;
        padding: 0 10px !important;
    }

    /* PREVIEW: MOSTRAR AL FINAL en móvil */
    .preview-pane-right {
        display: flex !important;
        order: 2 !important;
        /* SEGUNDO: Preview al final */
        width: 100% !important;
        padding: 40px 20px 50px !important;
        background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
        border-left: none !important;
        border-top: 2px solid #e2e8f0 !important;
        min-height: auto !important;
    }

    /* Preview hint más pequeño en móvil */
    .preview-hint {
        top: 15px !important;
        padding: 8px 16px !important;
    }

    .preview-hint span {
        font-size: 0.75rem !important;
    }

    /* Phone frame más pequeño en móvil */
    .phone-frame-container {
        /* transform: scale(0.7) !important; */
        margin: 0 auto !important;
    }

    /* AJUSTES DE CONTENIDO DE PASOS */

    /* Paso 1: Conexión */
    #tab-connect {
        width: 100% !important;
        min-height: auto !important;
    }

    #tab-connect .form-container-card {
        padding: 5px 15px !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Asegurar que inputs y botones sean visibles */
    #tab-connect .input-compact,
    #tab-connect .btn-download-action,
    #tab-connect .btn-sync-main {
        display: flex !important;
        width: 100% !important;
    }

    #tab-connect .form-header-center h1,
    #tab-connect .form-header-center p,
    #tab-connect .step-block p {
        display: block !important;
        opacity: 1 !important;
    }

    /* PASO 2: Plantillas */
    #tab-templates>div {
        padding: 0 !important;
    }

    #tab-templates .form-header-center {
        padding: 20px 15px 15px !important;
    }

    /* PASO 3: Diseño */
    #tab-design>div {
        padding: 0 !important;
    }

    #tab-design .form-header-center {
        padding: 20px 15px 15px !important;
    }

    /* Asegurar que el contenido del paso esté visible solo cuando es active */
    .content-pane {
        display: none !important;
    }

    .content-pane.active {
        display: flex !important;
        flex-direction: column !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* VERIFICADOR LOCAL - NO DEBE TAPAR EL FORMULARIO */
    #local-connection-verifier {
        position: static !important;
        /* NO absolute */
        width: 100% !important;
        height: auto !important;
        min-height: 150px !important;
        background: white !important;
        padding: 30px 20px !important;
        z-index: 1 !important;
        /* Bajo */
        margin-bottom: 20px !important;
    }

    #local-connection-verifier h3 {
        font-size: 1.2rem !important;
        text-align: center !important;
    }

    #local-connection-verifier p {
        font-size: 0.85rem !important;
        text-align: center !important;
        padding: 0 10px !important;
    }

    /* Ocultar overlay de conexión si no está activo */
    .connection-locked-overlay:not(.active) {
        display: none !important;
    }

    /* Si el overlay está activo, que no tape todo */
    .connection-locked-overlay.active {
        position: absolute !important;
        inset: 0 !important;
        background: rgba(255, 255, 255, 0.9) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        padding: 20px 15px !important;
        border-radius: 12px !important;
        z-index: 99999 !important;
        /* ADELANTE DE TODO */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }


    #template-list-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
        padding: 15px 0 !important;
        max-height: none !important;
    }

    /* Connection split box */
    .connection-split-box {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    /* Párrafos descriptivos en step-block */
    .step-block p {
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
        margin-bottom: 10px !important;
    }

    /* Contenedor de inputs dentro de step-block */
    .step-block>div {
        gap: 12px !important;
    }

    /* Ajustar colores en paso 3 para móvil */
    #tab-design .color-swatch {
        width: 100% !important;
    }

    /* Texto debajo de los swatches */
    #tab-design .color-swatch span {
        font-size: 0.6rem !important;
    }

    body {
        background: linear-gradient(180deg, #f5f7ff 0%, #fef9f4 65%, #e0f2fe 100%) fixed !important;
    }

    .workspace-center {
        position: relative !important;
        padding-top: 12px !important;
        padding-bottom: 76px !important;
        border-radius: 36px !important;
        margin: 0 14px !important;
        overflow: visible !important;
    }

    .workspace-center::before {
        content: '';
        position: absolute;
        inset: 4px 0 0;
        border-radius: 36px;
        background: linear-gradient(160deg, rgba(99, 102, 241, 0.18), rgba(14, 165, 233, 0.08));
        filter: blur(0px);
        box-shadow: 0 30px 80px rgba(15, 23, 42, 0.12);
        z-index: -1;
    }

    .form-container-card {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.85)) !important;
        border-radius: 34px !important;
        padding: 28px 22px 34px !important;
        margin: 0 6px 16px !important;
        box-shadow: 0 30px 60px rgba(15, 23, 42, 0.18) !important;
        border: none !important;
        backdrop-filter: blur(12px);
        border: 1px solid rgba(226, 232, 240, 0.6) !important;
    }

    .form-header-center {
        background: white !important;
        border-radius: 0 !important;
        padding: 0 0 24px 0 !important;
        color: #1e293b !important;
        box-shadow: none !important;
        text-align: left !important;
        border-bottom: 2px solid #f1f5f9 !important;
        margin-bottom: 30px !important;
    }

    .form-header-center h1 {
        color: #0f172a !important;
        font-size: 1.7rem !important;
        line-height: 1.2 !important;
        font-weight: 800 !important;
        letter-spacing: -0.5px;
    }

    .form-header-center p {
        color: #64748b !important;
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
    }

    .form-header-center::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        border: 1px solid rgba(255, 255, 255, 0.25);
        pointer-events: none;
        z-index: -1;
    }

    .mobile-hero-chip {
        display: flex !important;
        gap: 12px;
        margin-top: 18px;
        flex-wrap: wrap;
    }

    .mobile-hero-chip .hero-pill {
        background: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.4);
        color: #fff;
        box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
    }

    .mobile-hero-chip .hero-pill i {
        color: #fff;
    }

    .plugin-version-tag {
        font-size: 0.75rem !important;
        color: #94a3b8 !important;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        margin-bottom: 12px !important;
    }

    .plugin-actions {
        background: rgba(255, 255, 255, 0.9) !important;
        border-radius: 22px !important;
        padding: 18px !important;
        box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12) !important;
        border: 1px solid rgba(99, 102, 241, 0.2) !important;
    }

    .plugin-actions p {
        margin-bottom: 0 !important;
        color: #475569 !important;
    }

    .plugin-actions a {
        border-radius: 18px !important;
        border: 1px solid rgba(99, 102, 241, 0.3) !important;
        padding: 14px 16px !important;
        background: #f8fafc !important;
        gap: 10px !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    }

    .step-block {
        background: rgba(255, 255, 255, 0.95) !important;
        border-radius: 24px !important;
        padding: 20px !important;
        border: 1px solid rgba(226, 232, 240, 0.8) !important;
        box-shadow: 0 18px 35px rgba(15, 23, 42, 0.1) !important;
    }

    .step-block p {
        color: #475569 !important;
    }

    .step-block .input-compact {
        background: #f8fafc !important;
    }

    .btn-rounded-cta {
        margin-top: 16px !important;
    }

    .btn-rounded-cta + .btn-rounded-cta {
        margin-top: 10px !important;
    }

    #tab-connect .btn-shipping-modal-trigger.btn-solid-cta {
        box-shadow: 0 18px 40px rgba(99, 102, 241, 0.35);
    }

    #tab-connect .btn-shipping-modal-trigger i {
        margin-right: 6px;
    }

    #template-list-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
        gap: 16px !important;
    }

    .preview-pane-right {
        padding: 30px 22px 48px !important;
        border-radius: 32px !important;
        border-left: none !important;
        margin-top: 8px !important;
        box-shadow: 0 30px 60px rgba(15, 23, 42, 0.18) !important;
        background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(226, 232, 240, 0.9)) !important;
    }

    .preview-hint {
        padding: 10px 18px !important;
        border-radius: 16px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        top: 12px !important;
    }

    .phone-frame-container {
        width: min(100%, 340px) !important;
    }
}

/* --- CONNECTION PERSISTENCE & AUTO-SYNC UI --- */
.is-blurred {
    filter: blur(12px);
    /* Cleaner blur without grayscale */
    pointer-events: none;
    user-select: none;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0.4;
}

.connection-locked-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    /* Very subtle to feel minimalist */
    border-radius: 32px;
    gap: 20px;
}

.connection-locked-overlay.active {
    display: flex;
}

.sync-badge-permanent {
    background: #10b981;
    color: white;
    padding: 10px 20px;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    border: 3px solid white;
}

.btn-shipping-modal-trigger {
    background: #1e293b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
    pointer-events: auto;
}

.btn-shipping-modal-trigger:hover {
    background: #000;
    transform: translateY(-2px);
}

/* --- PREVIEW INTERACTION HINT --- */
.preview-pane-right {
    position: relative;
}

.preview-hint {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: bounceSlow 3s infinite;
}

.preview-hint i {
    color: #6366f1;
}

.preview-hint span {
    font-size: 0.85rem;
    font-weight: 800;
    color: #1e293b;
    white-space: nowrap;
}

@keyframes bounceSlow {

    0%,
    100% {
        transform: translate(-50%, 0);
    }

    50% {
        transform: translate(-50%, -10px);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- PAYMENT DRAWER STYLES (v5.2.6) --- */
.payment-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.payment-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.payment-drawer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90%;
    background: #fff;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
}

.payment-drawer-overlay.active .payment-drawer {
    transform: translateY(0);
}

.payment-header {
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    z-index: 10;
}

.payment-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: #1e293b;
}

.close-payment {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
}

.close-payment:active {
    transform: scale(0.9);
    background: #f1f5f9;
}

.payment-frame-container {
    flex: 1;
    position: relative;
    background: #f8fafc;
}

.payment-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

.payment-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: opacity 0.5s ease;
}

.payment-loading.fade-out {
    opacity: 0;
    pointer-events: none;
}

.payment-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f1f5f9;
    border-top-color: var(--app-primary);
    border-radius: 50% !important;
    animation: btnSpin 1s linear infinite;
    margin-bottom: 15px;
}

/* --- PREMIUM GEOMETRIC LOADER (SQUARE THEME) --- */
.premium-loader {
    width: 48px;
    height: 48px;
    border: 4px solid #6366f1;
    border-radius: 0 !important;
    animation: square-morph 2s ease-in-out infinite;
    position: relative;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.premium-loader::after {
    content: '';
    position: absolute;
    inset: 4px;
    border: 2px solid rgba(6, 182, 212, 0.4);
    border-radius: 0 !important;
    animation: square-morph-reverse 1.5s ease-in-out infinite;
}

@keyframes square-morph {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(0.85); border-color: #06b6d4; }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes square-morph-reverse {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

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

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

/* Fix for all common spinner classes to be circles */
.checker-loader, .spinner-mini, .loading-spinner, .spinner, .spinner-tiny, .payment-spinner {
    border-radius: 50% !important;
}

@keyframes checker-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

  
/* FORCE ICON VISIBILITY IN PREVIEW */  
#preview-screen .app-bottom-nav .nav-item i, #preview-screen .app-bottom-nav .nav-item svg { color: #1e293b !important; stroke: #1e293b !important; width: 22px !important; height: 22px !important; display: block !important; margin: 0 auto; } 

/* SKELETON LOADER (v14.2) */
@keyframes wiSkeletonPulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}
.wi-skeleton-pulse {
    animation: wiSkeletonPulse 1.5s ease-in-out infinite;
}
.wi-skeleton-card {
    pointer-events: none;
    user-select: none;
}
