/* =======================================================
   ZONATV — Panel de Demos
   Tema oscuro profesional · acento rojo de marca
======================================================= */

:root {
    --bg:        #09090b;
    --bg-2:      #0f0f12;
    --surface:   #141418;
    --surface-2: #1b1b21;
    --surface-3: #23232b;
    --line:      rgba(255,255,255,.07);
    --line-2:    rgba(255,255,255,.12);

    --text:   #f5f5f7;
    --muted:  #a1a1aa;
    --dim:    #6b6b76;

    --accent:      #ef2b2d;
    --accent-hi:   #ff4a4a;
    --accent-lo:   #b81d20;
    --accent-soft: rgba(239,43,45,.12);
    --accent-line: rgba(239,43,45,.38);

    --ok:      #22c55e;
    --ok-soft: rgba(34,197,94,.12);
    --err:     #f87171;
    --err-soft:rgba(248,113,113,.10);
    --wa:      #25d366;

    --r-sm: 10px;
    --r:    14px;
    --r-lg: 20px;

    --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 20px 50px -24px rgba(0,0,0,.8);
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-3); padding: .1em .4em; border-radius: 6px; }
.mono { font-family: var(--mono); }
button { font: inherit; color: inherit; }

.bg-glow {
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background:
        radial-gradient(700px 380px at 50% -120px, rgba(239,43,45,.16), transparent 70%),
        radial-gradient(500px 300px at 100% 100%, rgba(239,43,45,.05), transparent 70%);
}

/* =======================================================
   BOTONES
======================================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .72rem 1.15rem;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    font-weight: 600; font-size: .92rem; line-height: 1.2;
    cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, transform .1s, box-shadow .2s, opacity .15s;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn-lg { padding: .9rem 1.4rem; font-size: 1rem; border-radius: 12px; }
.btn-sm { padding: .45rem .8rem; font-size: .84rem; }
.btn-block { width: 100%; }

.btn-primary {
    background: linear-gradient(180deg, var(--accent-hi), var(--accent));
    color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 8px 24px -10px rgba(239,43,45,.7);
}
.btn-primary:hover { background: linear-gradient(180deg, #ff5c5c, var(--accent-hi)); }
.btn-primary:disabled {
    background: var(--surface-3); color: var(--dim); box-shadow: none; cursor: not-allowed;
}
.btn-primary.is-ok { background: var(--ok); box-shadow: none; }

.btn-outline { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.btn-outline:hover { border-color: rgba(255,255,255,.24); background: var(--surface-3); }

.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-2); }

.btn-wa { background: rgba(37,211,102,.12); color: #4ade80; border-color: rgba(37,211,102,.3); }
.btn-wa:hover { background: rgba(37,211,102,.2); }

.btn.is-loading { opacity: .6; pointer-events: none; }

.link-sm {
    background: none; border: 0; padding: 0; cursor: pointer;
    color: var(--muted); font-size: .84rem; font-weight: 600;
    text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px;
}
.link-sm:hover { color: var(--text); }

/* =======================================================
   CAMPOS
======================================================= */
.field { display: flex; flex-direction: column; gap: .4rem; }
.field > span { font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.field > span small { font-weight: 500; color: var(--dim); }
.field input, .field textarea, .field select,
.info-label textarea {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    padding: .75rem .9rem;
    color: var(--text);
    font: inherit; font-size: .95rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 70px; }
.field input::placeholder, .field textarea::placeholder { color: var(--dim); }
.field input:focus, .field textarea:focus, .info-label textarea:focus {
    border-color: var(--accent-line);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* =======================================================
   ALERTAS / TOAST
======================================================= */
.alert {
    padding: .8rem 1rem; border-radius: var(--r-sm);
    font-size: .9rem; font-weight: 500;
    border: 1px solid; margin: 0 0 1rem;
}
.alert-err { background: var(--err-soft); border-color: rgba(248,113,113,.3); color: #fecaca; }
.alert-ok  { background: var(--ok-soft);  border-color: rgba(34,197,94,.3);  color: #bbf7d0; }

.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 100;
    transform: translate(-50%, 16px); opacity: 0;
    background: var(--text); color: var(--bg);
    padding: .6rem 1.1rem; border-radius: 999px;
    font-weight: 700; font-size: .88rem;
    box-shadow: 0 10px 30px rgba(0,0,0,.5);
    transition: transform .2s, opacity .2s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* =======================================================
   LOGIN
======================================================= */
.is-login { display: flex; }
.login-wrap {
    position: relative; z-index: 1;
    width: 100%; min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 24px 16px;
}
.login-card {
    width: 100%; max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 28px 24px 22px;
    box-shadow: var(--shadow);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo {
    display: block; width: 100%; max-width: 240px; height: auto;
    margin: 0 auto 18px; border-radius: 12px;
}
.login-brand h1 { margin: 0; font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
.login-brand p  { margin: .35rem 0 0; color: var(--muted); font-size: .92rem; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .btn { margin-top: 6px; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 76px; }
.pass-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: var(--surface-3); border: 0; border-radius: 7px;
    padding: .35rem .6rem; font-size: .78rem; font-weight: 600; color: var(--muted); cursor: pointer;
}
.login-foot { text-align: center; margin: 18px 0 0; font-size: .86rem; }
.login-foot a { color: var(--muted); }
.login-foot a:hover { color: var(--text); }
.copy { color: var(--dim); font-size: .8rem; margin-top: 18px; }

.brand-word {
    font-weight: 800; font-size: 1.8rem; letter-spacing: .04em;
    color: #fff; text-shadow: 0 0 18px rgba(239,43,45,.6);
}
.brand-word.sm { font-size: 1.1rem; }

/* =======================================================
   TOPBAR
======================================================= */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(9,9,11,.82);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    max-width: 980px; margin: 0 auto;
    display: flex; align-items: center; gap: 16px;
    padding: 10px 16px;
}
.tb-brand img { display: block; height: 34px; width: auto; border-radius: 6px; }
.tb-nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tb-nav::-webkit-scrollbar { display: none; }
.tb-link {
    padding: .45rem .75rem; border-radius: 8px;
    color: var(--muted); font-size: .88rem; font-weight: 600; white-space: nowrap;
    transition: color .15s, background .15s;
}
.tb-link:hover { color: var(--text); background: var(--surface-2); }
.tb-link.is-active { color: var(--text); background: var(--surface-3); }
.tb-user { display: flex; align-items: center; gap: 8px; }
.user-pill {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .35rem .7rem; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line);
    font-size: .82rem; font-weight: 600; color: var(--muted);
}
.user-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }

/* =======================================================
   LAYOUT PANEL
======================================================= */
.panel-wrap {
    position: relative; z-index: 1;
    max-width: 980px; margin: 0 auto;
    padding: 28px 16px 40px;
}
.page-head { margin-bottom: 20px; }
.page-head h1 { margin: .35rem 0 .25rem; font-size: clamp(1.6rem, 4.5vw, 2.1rem); font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.page-head p  { margin: 0; color: var(--muted); max-width: 60ch; }
.eyebrow {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--accent-hi);
}
.live-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
    box-shadow: 0 0 0 0 rgba(239,43,45,.6); animation: pulse 2s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(239,43,45,.55); }
    70%  { box-shadow: 0 0 0 8px rgba(239,43,45,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,43,45,0); }
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.card-head h2 { margin: 0; font-size: 1.08rem; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.card-head p  { margin: .2rem 0 0; color: var(--muted); font-size: .88rem; }
.card-head-row { justify-content: space-between; align-items: center; }

.step-badge {
    flex: none; width: 32px; height: 32px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent-hi);
    border: 1px solid var(--accent-line);
    font-weight: 800; font-size: .9rem;
}
.step-badge svg, .chip-check svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.step-badge.step-ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(34,197,94,.35); }

/* =======================================================
   CHIPS DE DURACIÓN
======================================================= */
.demo-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.demo-chip {
    position: relative; text-align: left;
    display: flex; flex-direction: column; gap: 4px;
    padding: 16px 16px 14px;
    background: var(--bg-2);
    border: 1.5px solid var(--line-2);
    border-radius: var(--r);
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}
.demo-chip:hover { border-color: rgba(255,255,255,.22); }
.demo-chip:active { transform: scale(.985); }
.chip-hours { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.chip-hours small { font-size: .85rem; font-weight: 600; color: var(--muted); margin-left: 5px; letter-spacing: 0; }
.chip-label { font-size: .8rem; color: var(--dim); font-weight: 600; }
.chip-check {
    position: absolute; top: 12px; right: 12px;
    width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center;
    border: 1.5px solid var(--line-2); color: transparent;
    transition: all .15s;
}
.demo-chip.selected {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(239,43,45,.12), rgba(239,43,45,.04));
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.demo-chip.selected .chip-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.demo-chip.selected .chip-label { color: #fca5a5; }

.activate-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.demo-hint { font-size: .86rem; color: var(--dim); font-weight: 500; }
.demo-hint.is-ready { color: var(--muted); }

.loader {
    display: flex; align-items: center; gap: 12px;
    margin-top: 16px; padding: 14px 16px;
    background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
}
.loader p { margin: 0; font-weight: 600; font-size: .9rem; color: var(--muted); }
.spinner {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2.5px solid var(--surface-3); border-top-color: var(--accent);
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#demoError { margin: 16px 0 0; }

/* =======================================================
   RESULTADO
======================================================= */
.result-card { border-color: rgba(34,197,94,.22); }
.pill-pkg {
    display: inline-flex; padding: .2rem .6rem; border-radius: 999px;
    background: var(--surface-3); color: var(--muted);
    font-size: .74rem; font-weight: 700;
}
.creds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cred {
    position: relative; text-align: left;
    display: flex; flex-direction: column; gap: 3px;
    padding: 12px 14px; min-width: 0;
    background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r);
    cursor: pointer; transition: border-color .15s, background .15s;
}
.cred:hover { border-color: rgba(255,255,255,.22); }
.cred-wide { grid-column: 1 / -1; }
.cred-static { cursor: default; }
.cred .k { font-size: .72rem; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .07em; }
.cred .v { font-size: 1.05rem; font-weight: 600; color: var(--text); word-break: break-all; padding-right: 64px; }
.cred-static .v { padding-right: 0; }
.cred .c {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    font-size: .74rem; font-weight: 700; color: var(--muted);
    padding: .3rem .55rem; border-radius: 7px; background: var(--surface-3);
}
.cred.copied { border-color: rgba(34,197,94,.5); background: rgba(34,197,94,.06); }
.cred.copied .c { background: var(--ok); color: #04130a; }

.promo-block { margin-top: 18px; }
.promo-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.promo-head h3 { margin: 0; font-size: .95rem; font-weight: 700; }
.promo-text {
    margin: 0; max-height: 320px; overflow: auto;
    background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r);
    padding: 14px 16px;
    font-family: var(--font); font-size: .9rem; line-height: 1.6; color: #e4e4e7;
    white-space: pre-wrap; word-break: break-word;
}
.promo-text::-webkit-scrollbar { width: 8px; }
.promo-text::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
.promo-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* =======================================================
   HISTORIAL
======================================================= */
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.history li {
    display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
    padding: 11px 0; border-top: 1px solid var(--line);
}
.history li:first-child { border-top: 0; padding-top: 0; }
.h-main { font-size: .92rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-sep { color: var(--dim); margin: 0 .4rem; }
.h-meta { grid-column: 1; font-size: .78rem; color: var(--dim); display: flex; gap: .5rem; flex-wrap: wrap; }
.h-pkg { color: var(--muted); font-weight: 600; }
.h-copy {
    grid-column: 2; grid-row: 1 / span 2;
    background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px;
    padding: .4rem .7rem; font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer;
}
.h-copy:hover { color: var(--text); }

.panel-foot { text-align: center; color: var(--dim); font-size: .8rem; margin-top: 28px; }

/* =======================================================
   EDITAR INFORMACIÓN
======================================================= */
.placeholders-help {
    background: var(--bg-2); border: 1px dashed var(--line-2); border-radius: var(--r);
    padding: 14px; margin-bottom: 16px;
}
.ph-title { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.ph-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-chip {
    display: inline-flex; align-items: center; gap: .45rem;
    background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px;
    padding: .4rem .6rem; cursor: pointer; transition: border-color .15s, background .15s;
}
.ph-chip:hover { border-color: var(--accent-line); }
.ph-chip code { background: none; padding: 0; color: #fca5a5; font-weight: 600; }
.ph-chip span { font-size: .76rem; color: var(--dim); }
.ph-chip.ph-flash { background: var(--accent-soft); border-color: var(--accent); }
.ph-hint { display: block; margin-top: 10px; color: var(--dim); font-size: .78rem; }

.info-form { display: flex; flex-direction: column; gap: 14px; }
.info-label { display: flex; flex-direction: column; gap: .4rem; }
.info-label > span { font-size: .8rem; font-weight: 600; color: var(--muted); }
.info-label textarea { font-family: var(--mono); font-size: .86rem; line-height: 1.6; resize: vertical; min-height: 320px; }
.char-count { color: var(--dim); font-size: .78rem; text-align: right; }
.info-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.info-preview { margin: 0; }
.edit-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.edit-grid > .card { margin-bottom: 0; }
@media (min-width: 900px) {
    .panel-wrap.wide { max-width: 1180px; }
    .edit-grid { grid-template-columns: 1.15fr 1fr; align-items: start; }
    .edit-grid .sticky { position: sticky; top: 76px; }
}

/* =======================================================
   RESPONSIVE
======================================================= */
@media (max-width: 640px) {
    .topbar-inner { flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; }
    .tb-brand img { height: 30px; }
    .tb-nav { order: 3; flex-basis: 100%; margin: 0 -4px; }
    .tb-user { margin-left: auto; }
    .user-pill { display: none; }
    .panel-wrap { padding: 20px 14px 32px; }
    .card { padding: 18px 16px; border-radius: 16px; }
    .demo-options { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
    .demo-chip { padding: 14px 12px 12px; }
    .chip-hours { font-size: 1.7rem; }
    .chip-hours small { display: block; margin: 4px 0 0; font-size: .78rem; }
    .chip-check { top: 10px; right: 10px; width: 20px; height: 20px; }
    .activate-row .btn { width: 100%; }
    .demo-hint { width: 100%; text-align: center; }
    .creds { grid-template-columns: 1fr; }
    .promo-actions .btn { flex: 1 1 100%; }
}
.promo-text.info-preview { max-height: 70vh; }
.link-sm { white-space: nowrap; }
.diag-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
