/* INFINITYLINK — Dashboard Premium (Deep Space Glassmorphism) */
* { margin: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

body.ila {
  background: #080a0e;
  color: #e2e8f0;
  font-family: var(--il-font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Atmósfera Espacial Profunda */
body.ila::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: 
    radial-gradient(circle at 10% 0%, rgba(31, 41, 61, 0.6) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(41, 56, 84, 0.4) 0%, transparent 50%);
}

button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--il-accent-bright); text-decoration: none; }

/* ── Auth ── */
.ila-auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.ila-auth-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,0.02);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 40px 100px -20px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.05);
}
.ila-auth-card .logo { width: 140px; filter: drop-shadow(0 0 24px var(--il-accent-glow)); margin-bottom: 8px; }
.ila-auth-card h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; color: #fff; }
.ila-auth-card h1 span { color: var(--il-accent-bright); }
.ila-auth-card .sub { color: #94a3b8; font-size: 14px; margin: 8px 0 28px; line-height: 1.5; }
.ila-auth-card input, .ila-auth-card select {
  width: 100%; margin-bottom: 14px;
  background: rgba(0,0,0,0.3); color: #fff;
  border: 1px solid rgba(255,255,255,0.1); border-radius: 14px;
  padding: 15px 16px; font-size: 15px; font-family: inherit;
  transition: all 0.2s ease;
}
.ila-auth-card input:focus, .ila-auth-card select:focus { outline: none; border-color: var(--il-accent-bright); box-shadow: 0 0 0 4px rgba(111,138,176,0.15); }
.ila-auth-card .hint { color: #94a3b8; font-size: 12px; line-height: 1.5; margin: -8px 0 14px; text-align: left; }
.ila-auth-card select:invalid { color: var(--il-text-faint); }
.ila-auth-card select option { background: var(--il-bg-elevated); color: var(--il-text); }
.ila-auth-card button[type=submit] {
  width: 100%; padding: 15px; margin-top: 8px;
  background: linear-gradient(135deg, var(--il-accent-bright), var(--il-accent)); 
  color: #fff; border: 0; border-radius: 14px; font-weight: 600; font-size: 15px;
  box-shadow: 0 8px 24px -6px var(--il-accent-glow), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ila-auth-card button[type=submit]:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -6px var(--il-accent-glow), inset 0 1px 0 rgba(255,255,255,0.3); }
.error { color: var(--il-error); font-size: 13.5px; margin-top: 14px; font-weight: 500; }

/* ── Layout ── */
#app { display: grid; grid-template-columns: 212px 1fr; min-height: 100vh; }
.ila-side {
  background: rgba(11, 14, 20, 0.4);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border-right: 1px solid rgba(255,255,255,0.06);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; height: 100vh;
}
.ila-side .marca { display: flex; align-items: center; gap: 9px; padding: 0 6px; }
.ila-side .marca img { width: 32px; filter: drop-shadow(0 0 12px var(--il-accent-glow)); }
.ila-side .marca strong { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; color: #fff; }
.ila-side .marca span { color: var(--il-accent-bright); }
.ila-side nav { display: grid; gap: 4px; }
.ila-side nav a {
  padding: 8px 10px; border-radius: 9px;
  color: #94a3b8; font-size: 13px; font-weight: 500;
  transition: all 0.2s ease;
}
.ila-side nav a:hover { background: rgba(255,255,255,0.04); color: #fff; }
.ila-side nav a.activo { background: rgba(111,138,176,0.15); color: var(--il-accent-bright); }
.ila-side nav a.cta {
  background: linear-gradient(135deg, var(--il-accent-bright), var(--il-accent)); 
  color: #fff; text-align: center; margin-top: 6px;
  box-shadow: 0 4px 15px -3px var(--il-accent-glow);
}
.ila-side nav a.cta:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -3px var(--il-accent-glow); }
.side-pie { margin-top: auto; }
.ghost {
  background: transparent; border: 1px solid rgba(255,255,255,0.1); color: #94a3b8;
  border-radius: 9px; padding: 8px 12px; font-size: 12.5px; font-weight: 500; width: 100%;
  transition: all 0.2s ease;
}
.ghost:hover { color: #fff; background: rgba(255,255,255,0.05); }

.ila-main { padding: 20px 24px 56px; max-width: 1300px; width: 100%; }
.ila-main h2 { font-weight: 600; font-size: 20px; letter-spacing: -0.02em; margin-bottom: 3px; color: #fff; }
.ila-main .sub { color: #94a3b8; font-size: 12.5px; margin-bottom: 14px; }

/* ── Cards / tabla de links ── */
.card {
  background: rgba(255,255,255,0.02);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 13px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.03);
}
.link-fila {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: rgba(255,255,255,0.01);
  padding: 11px 12px; border-radius: 11px; border: 1px solid rgba(255,255,255,0.04);
  transition: all 0.2s ease; margin-bottom: 7px;
}
.link-fila:hover { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.1); box-shadow: 0 10px 30px -10px rgba(0,0,0,0.6); }
.link-fila .info { min-width: 170px; flex: 1; }
.link-fila .nombre { font-weight: 600; font-size: 14px; color: #fff; }
.link-fila .slug { color: #94a3b8; font-size: 12px; margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.copiar { background: rgba(255,255,255,0.05); border: 0; color: var(--il-accent-bright); font-size: 13px; padding: 2px 8px; border-radius: 6px; cursor: pointer; transition: background 0.2s; }
.copiar:hover { background: rgba(255,255,255,0.1); }

.chip {
  font-size: 10px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1); color: #94a3b8;
}
.chip.activo { color: #34d399; border-color: rgba(52,211,153,0.3); background: rgba(52,211,153,0.1); }
.chip.borrador { color: #fbbf24; border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.1); }
.chip.pausado, .chip.archivado { color: #64748b; }

.mini-stats { display: flex; gap: 13px; }
.mini-stats div { text-align: center; }
.mini-stats b { display: block; font-size: 14.5px; font-weight: 600; color: #fff; }
.mini-stats span { font-size: 10px; color: #64748b; text-transform: uppercase; letter-spacing: 0.08em; }

.acciones { display: flex; gap: 5px; }
.btn {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  color: #e2e8f0; border-radius: 8px; padding: 6px 11px; font-size: 12.5px; font-weight: 500;
  transition: all 0.2s ease;
}
.btn:hover { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.08); transform: translateY(-1px); }
.btn.principal {
  background: linear-gradient(135deg, var(--il-accent-bright), var(--il-accent)); 
  color: #fff; border: none; 
  box-shadow: 0 6px 20px -4px var(--il-accent-glow), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn.principal:hover { box-shadow: 0 10px 25px -4px var(--il-accent-glow), inset 0 1px 0 rgba(255,255,255,0.3); }
.btn.peligro:hover { border-color: rgba(239,68,68,0.5); color: #ef4444; background: rgba(239,68,68,0.1); }

.vacio { text-align: center; padding: 54px 20px; color: #64748b; }
.vacio img { width: 110px; opacity: 0.5; margin-bottom: 24px; }

/* ── Editor ── */
.editor-grid { display: grid; grid-template-columns: 1fr 350px; gap: 16px; align-items: start; }
@media (max-width: 1180px) { .editor-grid { grid-template-columns: 1fr; } }
.form-sec h3 {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.13em; color: var(--il-accent-bright); margin-bottom: 9px;
}
.campo { margin-bottom: 9px; }
.campo label { display: block; font-size: 12px; font-weight: 500; color: #cbd5e1; margin-bottom: 3px; }
.campo input, .campo select, .campo textarea, .fila-item input, .fila-item select {
  width: 100%;
  background: rgba(0,0,0,0.25); color: #fff;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 9px;
  padding: 8px 11px; font-size: 13px;
  transition: all 0.2s ease;
}
.campo input:focus, .campo select:focus, .campo textarea:focus, .fila-item input:focus, .fila-item select:focus {
  outline: none; border-color: var(--il-accent-bright);
  box-shadow: 0 0 0 4px rgba(111,138,176,0.15); background: rgba(0,0,0,0.4);
}
.campo textarea { resize: vertical; min-height: 62px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #cbd5e1; }
.check input { width: auto; accent-color: var(--il-accent-bright); width: 18px; height: 18px; }

.fila-item { display: flex; gap: 6px; margin-bottom: 7px; align-items: center; }
.fila-item select { max-width: 180px; font-weight: 500; }
.fila-item input { flex: 1; }
.fila-item .mini {
  background: transparent; border: none; color: #64748b;
  width: 28px; height: 28px; border-radius: 8px; flex: none; font-size: 14px; font-weight: bold; line-height: 1;
  transition: all 0.2s ease; cursor: pointer;
}
.fila-item .mini:hover { background: rgba(255,255,255,0.06); color: #fff; }
.fila-item .mini-del:hover { background: rgba(239,68,68,0.15); color: #ef4444; }

.input-prefijo { 
  display: flex; align-items: center; border: 1px solid rgba(255,255,255,0.08); 
  border-radius: 12px; background: rgba(0,0,0,0.25); overflow: hidden; 
  transition: all 0.2s ease; 
}
.input-prefijo:focus-within { border-color: var(--il-accent-bright); box-shadow: 0 0 0 4px rgba(111,138,176,0.15); background: rgba(0,0,0,0.4); }
.input-prefijo span { padding: 0 0 0 11px; color: #64748b; font-size: 13px; pointer-events: none; }
.input-prefijo input { border: none; border-radius: 0; box-shadow: none !important; background: transparent; }
.ayuda { font-size: 12.5px; color: #94a3b8; margin-top: 6px; display: block; line-height: 1.5; }
.ayuda.resalto { color: #fbbf24; font-weight: 500; }

.preview-col { position: sticky; top: 18px; }
.preview-marco {
  border: 12px solid #0f131a; border-radius: 46px; overflow: hidden;
  background: #000; 
  box-shadow: 0 50px 100px -20px var(--il-accent-glow), inset 0 0 0 2px #2A3140, 0 0 0 1px rgba(255,255,255,0.1);
  aspect-ratio: 9 / 19; position: relative;
}
/* Dynamic Island / Notch */
.preview-marco::before {
  content: ""; position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 30px; background: #000; border-radius: 20px; z-index: 10;
  box-shadow: inset 0 0 4px rgba(255,255,255,0.1);
}
.preview-marco iframe { width: 100%; height: 100%; border: 0; }
.preview-col .nota { text-align: center; color: #64748b; font-size: 13px; margin-top: 16px; }

.qr-grid { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Stats ── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr)); gap: 7px; margin-bottom: 12px; }
.stat-cards .card { margin: 0; padding: 11px 8px; text-align: center; }
.stat-cards b { font-size: 19px; font-weight: 600; display: block; letter-spacing: -0.02em; color: #fff; margin-bottom: 4px; }
.stat-cards span { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 500; }
.stat-cards .vivo b { color: #34d399; text-shadow: 0 0 12px rgba(52,211,153,0.4); }
.pulso {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #34d399; margin-right: 8px;
  animation: pulso 2s ease-in-out infinite; box-shadow: 0 0 8px #34d399;
}
@keyframes pulso { 50% { opacity: 0.4; box-shadow: 0 0 0px #34d399; } }
@media (prefers-reduced-motion: reduce) { .pulso { animation: none; } }

.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 900px) { .dos-col { grid-template-columns: 1fr; } }
.lista-bd { font-size: 12.5px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.lista-bd .fila { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.02); }
.lista-bd .fila:last-child { border-bottom: none; }
.lista-bd .fila span { flex: 0 1 40%; color: #cbd5e1; min-width: 0; }
.lista-bd .barra { flex: 1 1 auto; height: 6px; border-radius: 6px; background: rgba(255,255,255,0.06); overflow: hidden; }
.lista-bd .barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--il-accent), var(--il-accent-bright)); border-radius: 8px; }
.lista-bd b { min-width: 44px; text-align: right; font-weight: 600; color: #fff; }
.serie svg { width: 100%; height: 110px; display: block; }
.horas { display: flex; align-items: flex-end; gap: 3px; height: 74px; }
.horas div { flex: 1; background: linear-gradient(180deg, var(--il-accent-bright), var(--il-accent)); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; opacity: 0.8; transition: opacity 0.2s; }
.horas div:hover { opacity: 1; }
.horas div::after {
  content: attr(data-h); position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: #64748b; font-weight: 500;
}
.rango-sel { display: flex; gap: 6px; margin-bottom: 12px; }

/* ── Tablas (API keys, Plataforma) ── */
.tabla { width: 100%; border-collapse: collapse; font-size: 13px; display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
.tabla th {
  text-align: left; font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--il-text-faint); padding: 7px 10px 7px 0;
  border-bottom: 1px solid var(--il-line);
}
.tabla td { padding: 7px 8px 7px 0; border-bottom: 1px solid rgba(27, 34, 48, 0.5); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla code { color: var(--il-accent-bright); font-size: 12px; }

/* ── Toasts ── */
.ila-toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 100; }
.toast {
  background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-left: 4px solid var(--il-accent-bright);
  border-radius: 10px; padding: 10px 14px; font-size: 12.5px; font-weight: 500; color: #fff;
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.9);
  animation: il-up var(--il-t-base) var(--il-ease);
}
.toast.error { border-left-color: #ef4444; }
@keyframes il-up { from { opacity: 0; transform: translateY(15px); } }

/* ── Mobile ── */
@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }

  .ila-side {
    position: sticky; top: 0; z-index: 40; height: auto;
    display: grid; grid-template-columns: 1fr auto;
    align-items: center; gap: 8px 10px;
    padding: 10px 12px;
    border-right: 0; border-bottom: 1px solid rgba(255,255,255,0.06);
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow: hidden;
  }
  .ila-side .marca { padding: 0; grid-row: 1; grid-column: 1; }
  .ila-side .marca img { width: 34px; }
  .side-pie { margin: 0; grid-row: 1; grid-column: 2; }
  .ghost { padding: 7px 10px; font-size: 12px; white-space: nowrap; }

  .ila-side nav {
    grid-row: 2; grid-column: 1 / -1;
    display: flex; gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    width: 100%;
    box-sizing: border-box;
  }
  .ila-side nav::-webkit-scrollbar { display: none; }
  .ila-side nav a { 
    padding: 8px 12px; 
    font-size: 12.5px; 
    white-space: nowrap;
    flex-shrink: 0;
  }
  .main-wrap { padding: 12px; }
  .hero { padding: 22px 14px; text-align: center; }

  .ila-main { padding: 14px 12px 60px; }

  .link-fila { display: grid; gap: 10px; padding: 12px; }
  .link-fila .info { min-width: 0; }
  .chip { justify-self: start; }
  .mini-stats { justify-content: space-between; width: 100%; }
  .acciones { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .acciones .btn { text-align: center; padding: 9px 6px; }

  .dos { grid-template-columns: 1fr; }
  .fila-item { flex-wrap: wrap; }
  .fila-item select { max-width: none; flex: 1 1 100%; }
  .fila-item input { flex: 1 1 50%; }
  .preview-col { position: static; }

  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .rango-sel { flex-wrap: wrap; }
  .horas div::after { font-size: 8px; }
}

/* ── Personalización Pro: chips de color limpios + filas ── */
.pro-card input[type=color] {
  -webkit-appearance: none; appearance: none;
  width: 42px; height: 34px; padding: 0;
  border: 1px solid var(--il-glass-border, #2a3140); border-radius: 9px;
  background: none; cursor: pointer;
}
.pro-card input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.pro-card input[type=color]::-webkit-color-swatch { border: none; border-radius: 8px; }
.pro-card input[type=color]:disabled { opacity: .3; cursor: not-allowed; }
.pro-card select { width: 100%; }
.pro-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--il-glass-border, #20242e);
}
.pro-row span { flex: 1; font-size: 14px; }
.pro-row .pro-auto { flex: none; font-size: 12px; color: var(--il-text-faint, #64748b); margin-right: 4px; }
/* Toggle switch */
.pro-tgl { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.pro-tgl input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.pro-tgl .kn { position: absolute; inset: 0; background: #2a3140; border-radius: 999px; transition: background .18s; cursor: pointer; }
.pro-tgl .kn::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .18s; }
.pro-tgl input:checked + .kn { background: var(--il-accent-bright, #6F8AB0); }
.pro-tgl input:checked + .kn::before { transform: translateX(18px); }

/* Control segmentado (reemplaza selects nativos feos) */
.seg { display: flex; gap: 4px; background: #12151c; border: 1px solid var(--il-glass-border, #2a3140); border-radius: 11px; padding: 4px; }
.seg button { all: unset; flex: 1; text-align: center; padding: 9px 4px; font-size: 13px; border-radius: 8px; cursor: pointer; color: var(--il-text-dim, #9aa3b2); transition: background .15s, color .15s; }
.seg button:hover { background: rgba(255,255,255,0.04); }
.seg button.on { background: var(--il-accent-bright, #6F8AB0); color: #0d0f14; font-weight: 500; }
