/* ================================================
   INVITI — Theme Switcher UI
   ================================================ */

/* ── Floating trigger button ─────────────────── */
.ts-trigger {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 400;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand, #e8637a);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.25), 0 0 0 0 rgba(var(--brand-rgb,232,99,122),.4);
  transition: transform .25s ease, box-shadow .25s ease;
  animation: tsPulse 3s ease-in-out infinite;
}
.ts-trigger:hover {
  transform: scale(1.1) rotate(20deg);
  animation: none;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.ts-trigger i { transition: transform .3s ease; }
.ts-trigger.open { animation: none; transform: scale(1.05); }
.ts-trigger.open i { transform: rotate(180deg); }

@keyframes tsPulse {
  0%,100% { box-shadow: 0 4px 20px rgba(0,0,0,.25), 0 0 0 0 rgba(var(--brand-rgb,232,99,122),.4); }
  50%      { box-shadow: 0 4px 20px rgba(0,0,0,.25), 0 0 0 10px rgba(var(--brand-rgb,232,99,122),0); }
}

/* ── Panel ───────────────────────────────────── */
.ts-panel {
  position: fixed;
  bottom: 164px;
  right: 28px;
  z-index: 399;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
  width: 300px;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(.85) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .28s ease;
}
.ts-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* panel inside dark body */
html[data-theme="dark"] .ts-panel { background: #1e293b; }
html[data-theme="dark"] .ts-panel-header { border-bottom-color: #334155; }
html[data-theme="dark"] .ts-panel-title { color: #e2e8f0; }
html[data-theme="dark"] .ts-panel-sub   { color: #64748b; }
html[data-theme="dark"] .ts-theme-card  { background: #0f172a; border-color: #1e293b; }
html[data-theme="dark"] .ts-theme-name  { color: #e2e8f0; }
html[data-theme="dark"] .ts-panel-footer { border-top-color: #334155; background: #0f172a; }
html[data-theme="dark"] .ts-footer-note { color: #475569; }

.ts-panel-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ts-panel-title {
  font-size: .9rem;
  font-weight: 700;
  color: #1e2030;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ts-panel-title i { color: var(--brand, #e8637a); }
.ts-panel-sub { font-size: .72rem; color: #94a3b8; margin-top: 2px; }
.ts-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  color: #94a3b8;
  cursor: pointer;
  transition: all .2s;
}
.ts-close:hover { background: #fef2f2; border-color: #fecaca; color: #ef4444; }

/* ── Themes grid ─────────────────────────────── */
.ts-themes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
}

.ts-theme-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 10px;
  cursor: pointer;
  transition: all .22s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}
.ts-theme-card:hover { border-color: var(--tc-color, #e8637a); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.ts-theme-card.active { border-color: var(--tc-color, #e8637a); background: var(--tc-lt, #fde8ec); box-shadow: 0 0 0 3px rgba(var(--tc-rgb,232,99,122),.15); }

.ts-theme-swatch {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  flex-shrink: 0;
}
/* swatch split — primary + accent */
.ts-theme-swatch::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--tc-color, #e8637a);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.ts-theme-swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--tc-dark, #0f0f1a);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.ts-theme-name {
  font-size: .75rem;
  font-weight: 700;
  color: #1e2030;
  text-align: center;
  line-height: 1.3;
}

/* Active check badge */
.ts-theme-check {
  position: absolute;
  top: 6px; right: 6px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--tc-color, #e8637a);
  color: #fff;
  font-size: .6rem;
  display: none;
  align-items: center;
  justify-content: center;
}
.ts-theme-card.active .ts-theme-check { display: flex; }

/* ── Footer ──────────────────────────────────── */
.ts-panel-footer {
  padding: 10px 14px;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ts-footer-note { font-size: .7rem; color: #94a3b8; display: flex; align-items: center; gap: 5px; }
.ts-reset {
  font-size: .72rem;
  font-weight: 600;
  color: var(--brand, #e8637a);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .2s;
}
.ts-reset:hover { background: var(--brand-lt, #fde8ec); }

/* ── Backdrop (mobile) ───────────────────────── */
.ts-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 398;
  background: transparent;
}
.ts-backdrop.open { display: block; }

/* ── Transition overlay when switching theme ─── */
.theme-transition * {
  transition: background-color .4s ease, border-color .4s ease, color .3s ease, box-shadow .4s ease !important;
}
