/* CallTrack Design v2 — animations, charts, polish (blue primary) */
:root {
  --ct-blue-50: #eff6ff;
  --ct-blue-100: #dbeafe;
  --ct-blue-200: #bfdbfe;
  --ct-blue-400: #60a5fa;
  --ct-blue-500: #3b82f6;
  --ct-blue-600: #2563eb;
  --ct-blue-700: #1d4ed8;
  --ct-indigo-500: #6366f1;
  --ct-indigo-600: #4f46e5;
  --ct-cyan-400: #22d3ee;
  --ct-violet-500: #8b5cf6;
  --ct-emerald-500: #10b981;
  --ct-amber-500: #f59e0b;
  --ct-rose-500: #f43f5e;
  --ct-ease: cubic-bezier(.22,1,.36,1);
  --ct-ease-out: cubic-bezier(.16,1,.3,1);
}

/* ---------- Motion ---------- */
@keyframes ctFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ctFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes ctScaleIn {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes ctFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes ctPulseSoft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,.35); }
  50% { box-shadow: 0 0 0 10px rgba(37,99,235,0); }
}
@keyframes ctShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes ctBarGrow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
@keyframes ctRing {
  from { stroke-dashoffset: 283; }
  to { stroke-dashoffset: var(--ct-ring-offset, 70); }
}
@keyframes ctGradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes ctBlob {
  0%, 100% { border-radius: 40% 60% 60% 40% / 50% 40% 60% 50%; }
  50% { border-radius: 60% 40% 40% 60% / 40% 60% 40% 60%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Page enter */
.page, .ct-page-enter {
  animation: ctFadeUp .45s var(--ct-ease) both;
}
.ct-stagger > * {
  animation: ctFadeUp .5s var(--ct-ease) both;
}
.ct-stagger > *:nth-child(1) { animation-delay: .02s; }
.ct-stagger > *:nth-child(2) { animation-delay: .06s; }
.ct-stagger > *:nth-child(3) { animation-delay: .1s; }
.ct-stagger > *:nth-child(4) { animation-delay: .14s; }
.ct-stagger > *:nth-child(5) { animation-delay: .18s; }
.ct-stagger > *:nth-child(6) { animation-delay: .22s; }

/* ---------- Cards & surfaces ---------- */
.bg-white.rounded-xl,
.bg-white.rounded-2xl,
.ct-card {
  transition: transform .25s var(--ct-ease), box-shadow .25s var(--ct-ease), border-color .2s ease;
}
.bg-white.rounded-xl:hover,
.ct-card:hover {
  box-shadow: 0 12px 40px -12px rgba(37, 99, 235, .18), 0 4px 12px rgba(15,23,42,.06);
}
.ct-card-lift:hover {
  transform: translateY(-3px);
}

/* KPI / stat tiles */
.ct-kpi,
[id^="kpi-"],
.stat-tile {
  position: relative;
  overflow: hidden;
}
.ct-kpi::after {
  content: "";
  position: absolute;
  right: -20%;
  top: -30%;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(59,130,246,.12), transparent 70%);
  pointer-events: none;
  animation: ctFloat 6s ease-in-out infinite;
}

/* ---------- Buttons ---------- */
button.bg-primary-600,
button.bg-indigo-600,
.ct-btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #6366f1 100%) !important;
  background-size: 160% 160% !important;
  box-shadow: 0 8px 20px -6px rgba(37,99,235,.45);
  transition: transform .2s var(--ct-ease), box-shadow .2s ease, background-position .4s ease !important;
}
button.bg-primary-600:hover,
button.bg-indigo-600:hover,
.ct-btn-primary:hover {
  background-position: 100% 50% !important;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -8px rgba(37,99,235,.55);
}
button.bg-primary-600:active,
.ct-btn-primary:active {
  transform: translateY(0) scale(.98);
}

/* Sidebar active glow */
.sidebar-link.active {
  box-shadow: inset 0 0 0 1px rgba(165,180,252,.25);
}
#app aside .sidebar-link {
  transition: background .2s ease, color .2s ease, transform .15s ease;
}
#app aside .sidebar-link:hover {
  transform: translateX(2px);
}

/* ---------- Charts: CSS bars ---------- */
.ct-chart-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  padding: 8px 4px 0;
}
.ct-chart-bar .bar {
  flex: 1;
  transform-origin: bottom;
  animation: ctBarGrow .7s var(--ct-ease) both;
  border-radius: 8px 8px 3px 3px;
  min-height: 6px;
  position: relative;
  transition: filter .2s ease, opacity .2s ease;
  background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 40%, #4f46e5 100%);
  box-shadow: 0 4px 12px rgba(59,130,246,.25);
}
.ct-chart-bar .bar:nth-child(4n+1) {
  background: linear-gradient(180deg, #22d3ee 0%, #3b82f6 50%, #2563eb 100%);
}
.ct-chart-bar .bar:nth-child(4n+2) {
  background: linear-gradient(180deg, #a5b4fc 0%, #6366f1 45%, #4f46e5 100%);
}
.ct-chart-bar .bar:nth-child(4n+3) {
  background: linear-gradient(180deg, #67e8f9 0%, #06b6d4 40%, #2563eb 100%);
}
.ct-chart-bar .bar:nth-child(4n+4) {
  background: linear-gradient(180deg, #c4b5fd 0%, #8b5cf6 40%, #4f46e5 100%);
}
.ct-chart-bar .bar:hover {
  filter: brightness(1.08);
  opacity: 1;
}
.ct-chart-bar .bar::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.ct-chart-bar .bar:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Line chart (SVG) */
.ct-line-chart {
  width: 100%;
  height: 180px;
  overflow: visible;
}
.ct-line-chart .ct-area {
  fill: url(#ctAreaGrad);
  opacity: .35;
}
.ct-line-chart .ct-line {
  fill: none;
  stroke: url(#ctLineGrad);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 8px rgba(37,99,235,.35));
}
.ct-line-chart .ct-dot {
  fill: #fff;
  stroke: #2563eb;
  stroke-width: 2.5;
  transition: r .2s ease;
}
.ct-line-chart .ct-dot:hover {
  r: 6;
}

/* Donut / ring */
.ct-donut {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}
.ct-donut .track {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 12;
}
.ct-donut .value {
  fill: none;
  stroke: url(#ctDonutGrad);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 283;
  animation: ctRing 1s var(--ct-ease) both;
}

/* ---------- Auth polish ---------- */
.ct-auth-wrap, .ct-auth {
  position: relative;
  overflow: hidden;
}
.ct-auth-wrap::before,
.ct-auth::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  left: -80px;
  top: -80px;
  background: linear-gradient(135deg, rgba(59,130,246,.35), rgba(99,102,241,.2));
  animation: ctBlob 12s ease-in-out infinite, ctFloat 8s ease-in-out infinite;
  filter: blur(2px);
  z-index: 0;
  pointer-events: none;
}
.ct-auth-wrap::after,
.ct-auth::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  right: -60px;
  bottom: -40px;
  background: linear-gradient(135deg, rgba(34,211,238,.25), rgba(37,99,235,.2));
  animation: ctBlob 14s ease-in-out infinite reverse, ctFloat 9s ease-in-out infinite;
  z-index: 0;
  pointer-events: none;
}
.ct-auth-wrap > *,
.ct-auth > * {
  position: relative;
  z-index: 1;
}

/* ---------- Empty states with illustration ---------- */
.ct-empty-illu {
  width: 160px;
  height: 120px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  animation: ctFloat 5s ease-in-out infinite;
}
.ct-empty-illu svg {
  width: 140px;
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(37,99,235,.2));
}

/* ---------- Tables ---------- */
table tbody tr {
  transition: background .15s ease;
}
table tbody tr:hover {
  background: linear-gradient(90deg, rgba(239,246,255,.9), rgba(255,255,255,0));
}

/* ---------- Toasts / modals ---------- */
.ct-toast, [class*="toast"] {
  animation: ctScaleIn .3s var(--ct-ease) both;
}
.modal, .ct-modal, [id$="-modal"] {
  animation: ctFadeIn .2s ease both;
}
.modal > div, .ct-modal-panel {
  animation: ctScaleIn .35s var(--ct-ease) both;
}

/* ---------- Badges ---------- */
.ct-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ct-badge-live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  animation: ctPulseSoft 2s ease infinite;
}

/* ---------- Progress ---------- */
.ct-progress {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.ct-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22d3ee, #3b82f6, #6366f1);
  background-size: 200% 100%;
  animation: ctGradientShift 3s ease infinite;
  transition: width .6s var(--ct-ease);
}

/* ---------- Scrollbar (webkit) ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #93c5fd, #6366f1);
  border-radius: 8px;
}
::-webkit-scrollbar-track { background: #f1f5f9; }

/* ---------- Focus rings ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}
