/* ═══════════════════════════════════════════════════════════════════
   VModa Studio — páginas de tienda personalizables.
   Mitad 1: secciones del storefront (.tst-*) — consumen los tokens del
   tema de la tienda (--tst-acc / --tst-wash / --tst-radio / --tst-font)
   que emite Catalogo.cshtml. Nada fuera de .tst-* usa esas variables:
   el resto de VModa no cambia.
   Mitad 2: editor (.tsed-*).
   ═══════════════════════════════════════════════════════════════════ */

:root {
    /* Defaults por si una sección se renderiza sin tema (defensivo) */
    --tst-acc: #7c3aed;
    --tst-wash: #f2ecfd;
    --tst-radio: 12px;
    --tst-font: inherit;
}

.tst-sec { margin: 0 0 1.4rem; }
.tst-title {
    font-family: var(--tst-font);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 0 0 12px;
    color: #1c1a18;
}

.tst-btn-acc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--tst-acc);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 11px 24px;
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
    min-height: 44px;
    transition: opacity .15s, transform .12s;
}
.tst-btn-acc:hover { color: #fff; opacity: .92; }
.tst-btn-acc:active { transform: scale(.97); }

/* ── Banner de borrador + lápiz ── */
.tst-draft-banner {
    background: #fff7e6;
    border: 1px solid #f5d9a8;
    color: #8a5a00;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: .84rem;
    margin-bottom: 14px;
}
.tst-pencil {
    position: fixed;
    right: 18px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    z-index: 1040;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #1c1a18;
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .3);
    text-decoration: none;
    transition: transform .12s;
}
.tst-pencil:hover { color: #fff; transform: scale(1.06); }

/* ── Header de tienda: estilos del tema ── */
.tst-header-minimal .tienda-banner { display: none !important; }
.tst-header-split .tienda-banner img { border-radius: var(--tst-radio); }

/* ── Marquee ── */
.tst-marquee {
    overflow: hidden;
    background: var(--tst-acc);
    color: #fff;
    border-radius: var(--tst-radio);
    padding: 8px 0;
    white-space: nowrap;
}
.tst-marquee-track {
    display: inline-flex;
    gap: 48px;
    padding-left: 24px;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .04em;
    animation: tst-marquee 18s linear infinite;
    will-change: transform;
}
@keyframes tst-marquee {
    to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) { .tst-marquee-track { animation: none; } }

/* ── Hero ── */
.tst-hero {
    position: relative;
    border-radius: var(--tst-radio);
    overflow: hidden;
    background-color: var(--tst-wash);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
}
.tst-hero-compacto { min-height: 180px; }
.tst-hero-medio { min-height: 280px; }
.tst-hero-alto { min-height: 420px; }
.tst-hero-overlay {
    width: 100%;
    padding: 56px 24px 24px;
    background: linear-gradient(to top, rgba(10, 8, 6, .68), rgba(10, 8, 6, 0));
    color: #fff;
}
.tst-hero-title {
    font-family: var(--tst-font);
    font-size: clamp(1.5rem, 5vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 0 0 4px;
    color: #fff;
    text-wrap: balance;
}
.tst-hero-sub { margin: 0 0 14px; font-size: .95rem; opacity: .92; max-width: 48ch; }

/* ── Botones rápidos ── */
.tst-botones {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.tst-quick-btn {
    flex: 1 1 auto;
    min-width: 140px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--tst-wash);
    color: #1c1a18;
    border: 1.5px solid color-mix(in srgb, var(--tst-acc) 30%, transparent);
    border-radius: var(--tst-radio);
    padding: 10px 18px;
    font-weight: 700;
    font-size: .9rem;
    text-decoration: none;
    text-align: center;
    transition: background .15s, transform .12s;
}
.tst-quick-btn:hover { background: color-mix(in srgb, var(--tst-acc) 14%, #fff); color: #1c1a18; }
.tst-quick-btn:active { transform: scale(.97); }

/* ── Destacados (rail horizontal, mismo card compartida del sitio) ── */
.tst-rail {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding-bottom: 6px;
    scrollbar-width: none;
}
.tst-rail::-webkit-scrollbar { display: none; }
.tst-rail-item {
    flex: 0 0 46%;
    max-width: 240px;
    scroll-snap-align: start;
}
@media (min-width: 768px) { .tst-rail-item { flex-basis: 220px; } }

/* ── Promo ── */
.tst-promo {
    position: relative;
    border-radius: var(--tst-radio);
    overflow: hidden;
    background-color: var(--tst-wash);
    background-size: cover;
    background-position: center;
    min-height: 170px;
    display: flex;
    align-items: center;
}
.tst-promo-overlay {
    padding: 22px 24px;
    color: #fff;
    background: linear-gradient(to right, rgba(10, 8, 6, .62), rgba(10, 8, 6, .05));
    width: 100%;
    min-height: 170px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 4px;
}
.tst-promo-overlay.tst-promo-solid {
    background: var(--tst-acc);
}
.tst-promo-overlay h3 {
    font-family: var(--tst-font);
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0;
    color: #fff;
}
.tst-promo-overlay p { margin: 0 0 8px; font-size: .9rem; opacity: .92; max-width: 52ch; }
.tst-promo .tst-btn-acc { background: #fff; color: #1c1a18; }

/* ── Historia ── */
.tst-historia {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    background: var(--tst-wash);
    border-radius: var(--tst-radio);
    padding: 20px;
    align-items: center;
}
@media (min-width: 720px) {
    .tst-historia { grid-template-columns: 240px 1fr; }
    .tst-historia-der { grid-template-columns: 1fr 240px; }
    .tst-historia-der .tst-historia-img { order: 2; }
}
.tst-historia-img img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: calc(var(--tst-radio) - 4px);
    display: block;
}
.tst-historia-texto p {
    margin: 0;
    font-size: .92rem;
    line-height: 1.65;
    color: #4a453f;
    white-space: pre-line;
}

/* ── Galería ── */
.tst-galeria-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}
@media (min-width: 720px) {
    .tst-galeria-grid { grid-template-columns: repeat(3, 1fr); }
    .tst-galeria-n1, .tst-galeria-n2 { grid-template-columns: repeat(2, 1fr); }
}
.tst-galeria-item {
    border-radius: calc(var(--tst-radio) - 4px);
    overflow: hidden;
}
.tst-galeria-item img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}
.tst-galeria-item:hover img { transform: scale(1.04); }

/* ── Video ── */
.tst-video-frame {
    border-radius: var(--tst-radio);
    overflow: hidden;
    background: #000;
    aspect-ratio: 16 / 9;
}
.tst-video-frame iframe,
.tst-video-frame video {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* ── Instagram ── */
.tst-ig-band {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--tst-wash);
    border-radius: var(--tst-radio);
    padding: 16px 18px;
}
.tst-ig-band > .bi-instagram { font-size: 1.7rem; color: var(--tst-acc); }
.tst-ig-texto { flex: 1; min-width: 0; }
.tst-ig-titulo { font-weight: 700; font-size: .95rem; }
.tst-ig-user { font-size: .82rem; color: #8a837b; }

/* ── Vivos ── */
.tst-vivos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media (min-width: 720px) { .tst-vivos-grid { grid-template-columns: repeat(4, 1fr); } }
.tst-vivo-card { text-decoration: none; color: #1c1a18; }
.tst-vivo-img {
    position: relative;
    aspect-ratio: 3 / 4;
    border-radius: calc(var(--tst-radio) - 4px);
    background: #1c1a18 center/cover no-repeat;
    overflow: hidden;
}
.tst-vivo-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .04em;
    border-radius: 999px;
    padding: 3px 9px;
}
.tst-vivo-en { background: #dc2626; }
.tst-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: tst-pulse 1.2s ease-in-out infinite;
}
@keyframes tst-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.tst-vivo-titulo {
    font-size: .82rem;
    font-weight: 600;
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tst-vivo-fecha { font-size: .74rem; color: #8a837b; }

/* ═══════════════════════════════════════════════════════════════════
   EDITOR (.tsed-*)
   ═══════════════════════════════════════════════════════════════════ */
.tsed { max-width: 1400px; margin: 0 auto; padding: 12px 14px 40px; }

.tsed-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 6px 0 14px;
    border-bottom: 1px solid #e8e4de;
    margin-bottom: 14px;
}
.tsed-top-left { display: flex; align-items: center; gap: 12px; }
.tsed-back {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 10px;
    background: #f2f0ed;
    color: #1c1a18;
    text-decoration: none;
}
.tsed-titulo { font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.tsed-sub { font-size: .8rem; color: #8a837b; }
.tsed-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    background: #f2f0ed;
    color: #6b6560;
    border-radius: 999px;
    padding: 2px 9px;
}
.tsed-badge-pub { background: #e6f5ee; color: #0e8f63; }
.tsed-top-actions { display: flex; gap: 8px; }

.tsed-cols {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 900px) { .tsed-cols { grid-template-columns: 1fr; } }

/* ── Panel ── */
.tsed-panel { min-width: 0; }
.tsed-block {
    background: #fff;
    border: 1px solid #e8e4de;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.tsed-block summary {
    cursor: pointer;
    font-weight: 700;
    font-size: .9rem;
    list-style: none;
}
.tsed-block summary::-webkit-details-marker { display: none; }
.tsed-hint { font-size: .74rem; color: #8a837b; margin: 4px 0; }
.tsed-label {
    display: block;
    font-size: .74rem;
    font-weight: 700;
    color: #4a453f;
    margin: 10px 0 4px;
}

.tsed-presets { display: grid; gap: 8px; margin-top: 8px; }
.tsed-preset {
    text-align: left;
    background: #faf8f5;
    border: 1px solid #e8e4de;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color .15s;
}
.tsed-preset:hover { border-color: #7c3aed; }
.tsed-preset-nombre { display: block; font-weight: 700; font-size: .86rem; }
.tsed-preset-desc { display: block; font-size: .74rem; color: #8a837b; }

.tsed-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.tsed-swatch {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6);
}
.tsed-swatch.on { border-color: #1c1a18; }
.tsed-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tsed-chip {
    border: 1.5px solid #ddd8d0;
    background: #fff;
    border-radius: 999px;
    padding: 6px 13px;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    color: #4a453f;
}
.tsed-chip.on { background: #1c1a18; border-color: #1c1a18; color: #fff; }

.tsed-secciones-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-weight: 700;
    font-size: .9rem;
    margin: 16px 2px 8px;
}
.tsed-count { font-size: .74rem; color: #8a837b; font-weight: 600; }

.tsed-lista { display: grid; gap: 8px; }
.tsed-sec {
    background: #fff;
    border: 1px solid #e8e4de;
    border-radius: 12px;
    overflow: hidden;
}
.tsed-sec-off { opacity: .55; }
.tsed-dragging { opacity: .4; outline: 2px dashed #7c3aed; }
.tsed-sec-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 10px 6px;
}
.tsed-drag { cursor: grab; color: #b6afa6; padding: 4px 2px; }
.tsed-sec-ico { color: #7c3aed; font-size: .95rem; }
.tsed-sec-nombre { font-weight: 700; font-size: .86rem; flex: 1; min-width: 0; }
.tsed-plus {
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .05em;
    background: #f2ecfd;
    color: #5b21b6;
    border-radius: 999px;
    padding: 2px 7px;
}
.tsed-sec-actions { display: flex; gap: 2px; }
.tsed-ico {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border: none;
    background: none;
    border-radius: 8px;
    color: #6b6560;
    cursor: pointer;
    font-size: .82rem;
}
.tsed-ico:hover { background: #f2f0ed; color: #1c1a18; }
.tsed-ico-danger:hover { background: #fde8e8; color: #dc2626; }

.tsed-form {
    display: none;
    padding: 4px 12px 14px;
    border-top: 1px dashed #eee9e2;
}
.tsed-sec-abierta .tsed-form { display: block; }

.tsed-imgfield { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tsed-imgthumb {
    width: 52px; height: 52px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e8e4de;
}

.tsed-prods-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tsed-prod-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f2f0ed;
    border-radius: 999px;
    padding: 3px 9px 3px 3px;
    font-size: .74rem;
    font-weight: 600;
    cursor: pointer;
    max-width: 100%;
}
.tsed-prod-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.tsed-prod-chip span { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tsed-prod-chip:hover { background: #fde8e8; }
.tsed-prods-res { display: grid; gap: 4px; margin-top: 6px; max-height: 220px; overflow-y: auto; }
.tsed-prod-res {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #eee9e2;
    background: #fff;
    border-radius: 8px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: .8rem;
    text-align: left;
}
.tsed-prod-res:hover { border-color: #7c3aed; }
.tsed-prod-res img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; }
.tsed-prod-res span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tsed-agenda { margin-top: 10px; }
.tsed-agenda summary { font-size: .78rem; font-weight: 700; color: #6b6560; cursor: pointer; }
.tsed-agenda-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.tsed-agregar {
    width: 100%;
    margin-top: 10px;
    border: 2px dashed #d8d2c9;
    background: none;
    border-radius: 12px;
    padding: 13px;
    font-weight: 700;
    font-size: .88rem;
    color: #6b6560;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.tsed-agregar:hover { border-color: #7c3aed; color: #5b21b6; }

/* ── Preview ── */
.tsed-preview { position: sticky; top: 12px; }
.tsed-preview-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.tsed-preview-label { font-size: .8rem; font-weight: 700; color: #6b6560; }
.tsed-preview-modes { display: flex; gap: 6px; }
.tsed-frame-wrap {
    background: #f2f0ed;
    border: 1px solid #e8e4de;
    border-radius: 16px;
    padding: 12px;
    display: flex;
    justify-content: center;
}
.tsed-frame-wrap iframe {
    width: 390px;
    max-width: 100%;
    height: min(78vh, 760px);
    border: 1px solid #ddd8d0;
    border-radius: 14px;
    background: #fff;
    transition: width .25s ease;
}
.tsed-frame-wrap.tsed-desktop iframe { width: 100%; }

/* ── Modal de tipos ── */
.tsed-modal { position: fixed; inset: 0; z-index: 20050; }
.tsed-modal-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.tsed-modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 18px;
    width: min(680px, 94vw);
    max-height: 88vh;
    overflow: auto;
    margin: 6vh auto 0;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
}
.tsed-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    font-weight: 800;
    border-bottom: 1px solid #eee9e2;
    position: sticky;
    top: 0;
    background: #fff;
}
.tsed-tipos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 16px;
}
@media (max-width: 560px) { .tsed-tipos { grid-template-columns: 1fr; } }
.tsed-tipo {
    text-align: left;
    background: #faf8f5;
    border: 1.5px solid #e8e4de;
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: border-color .15s, transform .12s;
}
.tsed-tipo:hover { border-color: #7c3aed; transform: translateY(-1px); }
.tsed-tipo > i { font-size: 1.2rem; color: #7c3aed; }
.tsed-tipo-nombre { display: block; font-weight: 700; font-size: .88rem; margin: 6px 0 2px; }
.tsed-tipo-desc { display: block; font-size: .74rem; color: #8a837b; line-height: 1.4; }

/* ── Rendimiento (analítica por sección) ── */
.tsed-stats { display: grid; gap: 12px; margin-top: 10px; }
.tsed-stat-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: .82rem;
    font-weight: 600;
}
.tsed-stat-n { font-size: .72rem; color: #8a837b; font-weight: 500; white-space: nowrap; }
.tsed-stat-bar {
    height: 8px;
    border-radius: 999px;
    background: #f2f0ed;
    overflow: hidden;
    margin: 5px 0 2px;
}
.tsed-stat-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
}

/* ── Tour de onboarding ── */
.tsed-tour-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 12, 20, .55);
    z-index: 20090;
}
.tsed-tour-focus {
    position: relative;
    z-index: 20095;
    box-shadow: 0 0 0 4px #a78bfa, 0 0 0 9999px rgba(15, 12, 20, .55);
    border-radius: 12px;
}
.tsed-tour-pop {
    position: absolute;
    z-index: 20096;
    width: min(320px, 90vw);
    background: #fff;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .3);
}
.tsed-tour-paso {
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
    color: #7c3aed;
}
.tsed-tour-pop h4 { margin: 4px 0 4px; font-size: 1rem; font-weight: 800; }
.tsed-tour-pop p { margin: 0 0 12px; font-size: .85rem; color: #4a453f; line-height: 1.5; }
.tsed-tour-btns { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tsed-tour-skip {
    border: none; background: none; color: #8a837b;
    font-size: .82rem; font-weight: 600; cursor: pointer; padding: 6px;
}
.tsed-tour-next {
    border: none; background: #1c1a18; color: #fff;
    border-radius: 999px; padding: 9px 20px;
    font-size: .84rem; font-weight: 700; cursor: pointer;
}
@media (prefers-reduced-motion: reduce) {
    .tsed-tour-focus { scroll-behavior: auto; }
}
