/* ═══════════════════════════════════════════
       SHARED BASE STYLES
       (prefixed with .anim- to avoid collisions
        when embedded in a larger page)
    ═══════════════════════════════════════════ */

.anim-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Visibility helpers — override with your own breakpoints */
.anim-desktop {
  display: none;
}

.anim-mobile {
  display: block;
}

@media screen and (min-width: 768px) {
  .anim-mobile {
    display: none;
  }

  .anim-desktop {
    display: block;
  }
}

/* ── SCENE (desktop) ── */
.anim-desktop .scene {
  width: 900px;
  height: 560px;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  margin: auto;
}

/* ── VIEWPORT + SCENE (mobile) ── */
.anim-mobile .viewport {
  width: min(360px, 100vw);
  height: min(580px, 100svh);
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  margin: auto;
}

.anim-mobile .scene {
  width: 900px;
  height: 560px;
  position: absolute;
  top: 0;
  left: 0;
  /* set by JS */
  pointer-events: none;
}

/* ── APP SHELL ── */
.app {
  width: 100%;
  height: 100%;
  background: #f4f5f7;
  display: flex;
  flex-direction: column;
}

/* TOPBAR */
.topbar {
  height: 44px;
  background: #14123b;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  padding-right: 14px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  border-left: solid 3px #2d6fcb;
  padding-left: 10px;
}

.logo-text .brand {
  font-size: 11px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
}

.logo-text .sub {
  font-size: 7px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.nav-tabs {
  display: flex;
  gap: 20px;
  flex: 1;
}

.nav-tab {
  font-size: 12px;
  color: #d0d5dd;
  cursor: default;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  font-weight: 500;
}

.nav-tab.active {
  color: white;
  border-bottom-color: #2d6fcb;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.icon-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  border-radius: 50%;
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.support-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #2d6fcb;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 5px 12px 5px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: default;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  position: relative;
}

.support-btn .btn-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.support-btn .btn-icon svg {
  width: 14px;
  height: 14px;
}

/* CONTENT */
.content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: 52px;
  background: #1a2b3c;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 6px;
  flex-shrink: 0;
}

.side-item {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #8ab0cc;
}

.side-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.side-item svg {
  width: 16px;
  height: 16px;
}

.side-item span {
  font-size: 6px;
  letter-spacing: 0.2px;
}

/* MAIN */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.subtabs {
  height: 38px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 20px;
  flex-shrink: 0;
}

.subtab {
  font-size: 11px;
  color: #666;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.subtab.active {
  color: #1a3a5c;
  border-bottom-color: #1a3a5c;
  font-weight: 600;
}

/* DASHBOARD */
.dashboard {
  flex: 1;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 12px;
  overflow: hidden;
}

.card {
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e8e8e8;
  padding: 14px;
  position: relative;
}

.card-title {
  font-size: 11px;
  font-weight: 600;
  color: #222;
  margin-bottom: 10px;
}

.card-dots {
  position: absolute;
  top: 12px;
  right: 12px;
  color: #bbb;
  font-size: 16px;
  line-height: 1;
}

.big-num {
  font-size: 32px;
  font-weight: 700;
  color: #1a2b3c;
  line-height: 1;
}

.big-label {
  font-size: 10px;
  color: #888;
  margin-top: 2px;
}

.stat-row {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.stat .n {
  font-size: 18px;
  font-weight: 700;
  color: #1a2b3c;
}

.stat .l {
  font-size: 9px;
  color: #888;
}

.donut-placeholder {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  margin: 6px auto;
  position: relative;
}

.donut-placeholder::after {
  content: '';
  position: absolute;
  inset: 18px;
  background: #fff;
  border-radius: 50%;
}

.bar-placeholder {
  margin-top: 6px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.bar-label {
  font-size: 8px;
  color: #666;
  width: 72px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: #3b82f6;
}

/* CURSOR */
.cursor {
  position: absolute;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 9999;
}

/* PULSE RING */
.pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 24px;
  border: 2px solid rgba(74, 158, 218, 0.6);
  opacity: 0;
  pointer-events: none;
}

.pulse-ring.active {
  animation: pulseRing 0.5s ease-out forwards;
}

@keyframes pulseRing {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.3);
  }
}

/* CHAT POPUP */
.chat-popup {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 300px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  z-index: 100;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.chat-popup.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.popup-header {
  background: #14123b;
  padding: 18px 16px 20px;
  position: relative;
}

.popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.popup-close svg {
  width: 10px;
  height: 10px;
}

.popup-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.popup-logo-bar {
  width: 3px;
  height: 22px;
  background: linear-gradient(to bottom, #4a9eda, #2a7abf);
  border-radius: 2px;
}

.popup-logo-text .brand {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.popup-logo-text .sub {
  font-size: 7.5px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.popup-greeting {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.popup-body {
  padding: 14px 14px 10px;
}

.cta-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e0e4ea;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #1a2b3c;
  cursor: default;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}

.cta-btn .cta-icon {
  color: #3b7dd8;
  flex-shrink: 0;
}

.cta-btn .cta-icon svg {
  width: 14px;
  height: 14px;
}

.cta-btn.highlight {
  background: #f0f5ff;
  border-color: #3b7dd8;
}

.popup-footer {
  border-top: 1px solid #eee;
  display: flex;
  padding: 8px 0 4px;
}

.footer-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px;
  color: #999;
}

.footer-tab.active {
  color: #3b7dd8;
}

.footer-tab svg {
  width: 16px;
  height: 16px;
}

.footer-tab span {
  font-size: 9px;
  font-weight: 500;
}

/* REPLAY BUTTON */
.replay-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(12, 18, 38, 0.84);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 14px 30px;
  border-radius: 40px;
  cursor: pointer;
  z-index: 9999;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.replay-btn.visible {
  opacity: 1;
  pointer-events: auto !important;
  transform: translate(-50%, -50%) scale(1);
}

.replay-btn:hover {
  background: rgba(45, 111, 203, 0.78);
  border-color: rgba(255, 255, 255, 0.45);
}

/* Mobile crop label */
.crop-label {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.6);
  font-size: 9px;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 200;
}