/* ============================================================
   UltraCall Center — Sistema de diseño
   Tokens, micro-interacciones y componentes base
   ============================================================ */

:root {
  --brand: #6366f1;
  --brand-hover: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #06b6d4;
  --radius: 12px;
}

* { scrollbar-width: thin; scrollbar-color: #2a2a40 transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #2a2a40; border-radius: 3px; }

body { font-feature-settings: 'cv02','cv03','cv04','cv11'; }

/* ---- Animaciones de entrada ---- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,.5); } 70% { box-shadow: 0 0 0 8px rgba(16,185,129,0); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

.anim-up { animation: fadeUp .35s cubic-bezier(.2,.8,.2,1) both; }
.anim-in { animation: fadeIn .25s ease both; }
.stagger > * { animation: fadeUp .4s cubic-bezier(.2,.8,.2,1) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .10s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }

/* ---- Skeleton loading ---- */
.skeleton {
  background: linear-gradient(90deg, #181825 25%, #232336 50%, #181825 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 8px;
}

/* ---- Componentes ---- */
.card {
  background: #11111a;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card-hover:hover { border-color: rgba(99,102,241,.35); box-shadow: 0 0 24px rgba(99,102,241,.12); transform: translateY(-1px); }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem 1rem; border-radius: 10px; font-weight: 600; font-size: .8125rem;
  transition: all .15s ease; cursor: pointer; border: 1px solid transparent;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); box-shadow: 0 4px 16px rgba(99,102,241,.35); }
.btn-ghost { background: rgba(255,255,255,.04); color: #cbd5e1; border-color: rgba(255,255,255,.08); }
.btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn-danger { background: rgba(239,68,68,.12); color: #f87171; border-color: rgba(239,68,68,.25); }
.btn-danger:hover { background: rgba(239,68,68,.22); }
.btn-sm { padding: .3rem .65rem; font-size: .75rem; border-radius: 8px; }

.input {
  width: 100%; background: #181825; border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; padding: .55rem .85rem; font-size: .85rem; color: #e2e8f0;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.input::placeholder { color: #475569; }
label.field-label { display: block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #64748b; margin-bottom: .35rem; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 600; }
.badge-success { background: rgba(16,185,129,.12); color: #34d399; }
.badge-warning { background: rgba(245,158,11,.12); color: #fbbf24; }
.badge-error { background: rgba(239,68,68,.12); color: #f87171; }
.badge-info { background: rgba(6,182,212,.12); color: #22d3ee; }
.badge-brand { background: rgba(99,102,241,.14); color: #a5b4fc; }
.badge-neutral { background: rgba(148,163,184,.1); color: #94a3b8; }

/* ---- Sidebar ---- */
.nav-item {
  display: flex; align-items: center; gap: .75rem; padding: .55rem .8rem;
  border-radius: 10px; color: #94a3b8; font-size: .85rem; font-weight: 500;
  transition: all .15s; cursor: pointer; position: relative;
}
.nav-item:hover { color: #e2e8f0; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: rgba(99,102,241,.15); }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; background: var(--brand); border-radius: 2px;
}
.nav-item i { width: 18px; text-align: center; font-size: .9rem; }

/* ---- Tablas ---- */
.table-pro { width: 100%; font-size: .82rem; }
.table-pro th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: #64748b; font-weight: 600; padding: .6rem .9rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.table-pro td { padding: .7rem .9rem; border-bottom: 1px solid rgba(255,255,255,.04); color: #cbd5e1; }
.table-pro tbody tr { transition: background .12s; }
.table-pro tbody tr:hover { background: rgba(255,255,255,.025); }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(5,5,10,.7); backdrop-filter: blur(6px); z-index: 90; animation: fadeIn .2s ease; }
.modal-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: #14141f; border: 1px solid rgba(255,255,255,.09); border-radius: 16px;
  z-index: 95; width: min(640px, calc(100vw - 32px)); max-height: 86vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.5); animation: fadeUp .25s cubic-bezier(.2,.8,.2,1);
}

/* ---- Toast ---- */
.toast {
  background: #1a1a2a; border: 1px solid rgba(255,255,255,.1); border-radius: 12px;
  padding: .75rem 1rem; font-size: .82rem; display: flex; align-items: center; gap: .6rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.4); animation: fadeUp .3s cubic-bezier(.2,.8,.2,1);
  min-width: 260px;
}

/* ---- IVR canvas ---- */
.ivr-node {
  position: absolute; min-width: 150px; background: #181828; border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px; padding: .6rem .8rem; cursor: grab; user-select: none;
  transition: border-color .15s, box-shadow .15s; font-size: .75rem;
}
.ivr-node:hover { border-color: rgba(99,102,241,.5); box-shadow: 0 0 16px rgba(99,102,241,.2); z-index: 5; }
.ivr-node.dragging { cursor: grabbing; opacity: .85; z-index: 10; }

/* ---- Kanban ---- */
.kanban-col { min-width: 264px; width: 264px; }
.kanban-card { cursor: grab; }
.kanban-card.dragging { opacity: .4; }
.kanban-col.drag-over .kanban-drop { background: rgba(99,102,241,.08); border-color: rgba(99,102,241,.4); }
.kanban-drop { border: 1.5px dashed transparent; border-radius: 12px; transition: all .15s; min-height: 120px; }

/* ---- Live indicator ---- */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse-ring 1.6s infinite; }

/* ---- Command palette ---- */
.cmdk-panel {
  position: fixed; top: 18vh; left: 50%; transform: translateX(-50%);
  width: min(580px, calc(100vw - 32px)); background: #14141f;
  border: 1px solid rgba(255,255,255,.1); border-radius: 16px; z-index: 95;
  box-shadow: 0 24px 80px rgba(0,0,0,.6); animation: fadeUp .2s ease; overflow: hidden;
}
.cmdk-item { display: flex; align-items: center; gap: .7rem; padding: .6rem .9rem; font-size: .83rem; color: #cbd5e1; cursor: pointer; border-radius: 10px; }
.cmdk-item:hover, .cmdk-item.selected { background: rgba(99,102,241,.14); color: #fff; }

kbd { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 5px; padding: 1px 6px; font-size: .68rem; font-family: inherit; color: #94a3b8; }

/* ---- Tabs ---- */
.tab { padding: .45rem .9rem; font-size: .8rem; font-weight: 600; color: #64748b; border-radius: 9px; cursor: pointer; transition: all .15s; }
.tab:hover { color: #cbd5e1; }
.tab.active { color: #fff; background: rgba(99,102,241,.16); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  #sidebar { transform: translateX(-100%); transition: transform .25s; }
  #sidebar.open { transform: none; }
}

/* ---- Modo claro (toggle) ---- */
html:not(.dark) body { background: #f8fafc; color: #1e293b; }
html:not(.dark) .card { background: #fff; border-color: #e2e8f0; }
html:not(.dark) .input { background: #fff; border-color: #cbd5e1; color: #1e293b; }
html:not(.dark) .table-pro td { color: #334155; border-color: #f1f5f9; }
html:not(.dark) #sidebar { background: #fff !important; border-color: #e2e8f0 !important; }
html:not(.dark) .nav-item { color: #64748b; }
html:not(.dark) .nav-item.active { color: var(--brand); }
html:not(.dark) #topbar { background: rgba(248,250,252,.85) !important; border-color: #e2e8f0 !important; }
html:not(.dark) .text-white { color: #0f172a !important; }
html:not(.dark) .modal-panel, html:not(.dark) .cmdk-panel { background: #fff; border-color: #e2e8f0; }
html:not(.dark) .toast { background: #fff; border-color: #e2e8f0; color: #1e293b; }
html:not(.dark) .ivr-node { background: #fff; border-color: #e2e8f0; }
html:not(.dark) .btn-ghost { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
