/* =========================================================
   SOCIAL KPI V4: ALIGNED 3-CARD LAYOUT & CORNER INFO BUTTON
   ========================================================= */

.app-main:has(.social-v2-container),
.page-container:has(.social-v2-container),
.social-v2-container {
  min-width: 0;
}

.app-main:has(.social-v2-container),
.page-container:has(.social-v2-container) {
  overflow-x: hidden;
}

/* 1. KPI 3 CARDS GRID */
.social-kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 16px !important;
  margin-bottom: 20px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Base Card: Split into Left Content Column and Right Visual Column */
.social-kpi-card {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 130px !important;
  gap: 12px !important;
  align-items: stretch !important;
  min-height: 200px !important;
  height: 200px !important; /* Fixed uniform height for identical vertical alignment */
  padding: 20px 20px 18px 22px !important;
  background: #ffffff !important;
  border: 1px solid rgba(226, 232, 240, 0.92) !important;
  border-radius: 22px !important;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.05) !important;
  box-sizing: border-box !important;
  position: relative !important;
  overflow: hidden !important;
  transform: none !important;
  transition: none !important;
}

.social-kpi-card:hover {
  transform: none !important;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.05) !important;
}

/* 1. INFO BUTTON ⓘ: Positioned at Top-Right Corner (16px from top/right) on ALL 3 CARDS */
.social-kpi-info-btn {
  position: absolute !important;
  top: 16px !important;
  right: 16px !important;
  width: 24px !important;
  height: 24px !important;
  border: none !important;
  background: transparent !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  z-index: 10 !important;
  transition: color 0.15s ease, background-color 0.15s ease !important;
  transform: none !important;
}

.social-kpi-info-btn:hover,
.social-kpi-info-btn:focus-visible {
  background: #f1f5f9 !important;
  color: #334155 !important;
  outline: none !important;
}

.social-kpi-info-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4) !important;
}

/* LEFT COLUMN: Data Content (Header, Body, Footer) */
.social-kpi-col-content {
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  min-width: 0 !important;
  height: 100% !important;
  z-index: 2 !important;
}

/* Header Row: Top-Left with reserve padding on right to never collide with 16px ⓘ button */
.social-kpi-header {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  justify-content: flex-start !important;
  width: 100% !important;
  min-width: 0 !important;
  padding-right: 32px !important; /* Reserves space so header text never collides with 16px info button */
  box-sizing: border-box !important;
}

.social-kpi-icon-box {
  width: 36px !important;
  height: 36px !important;
  border-radius: 11px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.social-kpi-icon-blue {
  background: #e0f2fe !important;
  color: #0284c7 !important;
}

.social-kpi-icon-purple {
  background: #f3e8ff !important;
  color: #9333ea !important;
}

.social-kpi-icon-green {
  background: #dcfce7 !important;
  color: #16a34a !important;
}

.social-kpi-title {
  font-size: clamp(0.74rem, 0.84vw, 0.84rem) !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  letter-spacing: -0.01em !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-width: 0 !important;
  line-height: 1.25 !important;
}

/* Body: Numbers & Subtext with identical baseline alignment */
.social-kpi-body {
  margin: auto 0 !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
}

.social-kpi-big-number {
  font-size: clamp(2.3rem, 2.7vw, 2.85rem) !important;
  font-weight: 800 !important;
  color: #0a1128 !important;
  line-height: 1.05 !important;
  letter-spacing: -0.03em !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  white-space: nowrap !important;
}

.social-kpi-subtext {
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  color: #64748b !important;
  margin-top: 4px !important;
  white-space: nowrap !important;
}

/* Footer: Secondary text on the exact same bottom line */
.social-kpi-footer {
  display: flex !important;
  align-items: center !important;
  min-height: 28px !important;
  min-width: 0 !important;
}

.social-kpi-data-note {
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  color: #64748b !important;
  white-space: nowrap !important;
}

.social-kpi2-icons-row {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  flex-wrap: nowrap !important;
}

.social-plat-mini-circle {
  width: 25px !important;
  height: 25px !important;
  border-radius: 50% !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
  padding: 0 !important;
  transform: none !important;
  transition: box-shadow 0.15s ease !important;
}

.social-plat-mini-circle:hover {
  transform: none !important;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(99, 102, 241, 0.45) !important;
}

.social-plat-mini-circle:focus-visible,
.social-plat-mini-circle.active {
  outline: none !important;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(99, 102, 241, 0.55) !important;
}

.social-plat-mini-circle--redgifs {
  overflow: hidden !important;
  background: #111827 !important;
}

.social-plat-mini-circle--redgifs img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

.social-kpi-status-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  background: #f0fdf4 !important;
  color: #15803d !important;
  border: 1px solid #dcfce7 !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
}

.social-kpi-dot-green {
  width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
  background: #10b981 !important;
}

/* RIGHT COLUMN: Dedicated Visual Area (Under ⓘ, Vertically Centered) */
.social-kpi-col-visual {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 130px !important;
  min-width: 130px !important;
  height: 100% !important;
  padding-top: 14px !important; /* Offset slightly so visual sits comfortably below the 16px corner ⓘ */
  box-sizing: border-box !important;
  position: relative !important;
  z-index: 1 !important;
}

/* Visual wrappers with balanced visible heights */
.social-kpi-visual-wrap {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: none !important;
  user-select: none !important;
  transform: none !important;
  transition: none !important;
}

/* 1. Follower image: visible height ~84px */
.social-kpi-visual-wrap--followers {
  width: 122px !important;
  height: 84px !important;
}

.social-kpi-visual-wrap--followers .social-kpi-illustration {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  pointer-events: none !important;
  user-select: none !important;
  transform: none !important;
}

/* 2. Accounts image: visible height ~86px */
.social-kpi-visual-wrap--accounts {
  width: 106px !important;
  height: 86px !important;
}

.social-kpi-visual-wrap--accounts .social-kpi-illustration {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  pointer-events: none !important;
  user-select: none !important;
  transform: none !important;
}

/* 3. Sync Ring + Text: ring height 88px */
.social-kpi-visual-wrap--sync {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  pointer-events: auto !important;
  transform: none !important;
}

.social-kpi-circle-wrap {
  width: 104px !important;
  height: 104px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  flex-shrink: 0 !important;
  transform: none !important;
}

.social-kpi-ring-svg {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
  overflow: visible !important;
}

.social-kpi3-remaining-text {
  font-size: 0.74rem !important;
  font-weight: 500 !important;
  color: #64748b !important;
  margin-top: 4px !important;
  text-align: center !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
  user-select: none !important;
}

/* Neutralize all hover lift, floating, rotating, scaling on cards & illustrations */
.social-kpi-card:hover,
.social-kpi-card *:hover,
.social-kpi-illustration,
.social-kpi-illustration:hover,
.social-kpi-visual-wrap,
.social-kpi-visual-wrap:hover,
.social-kpi-circle-wrap,
.social-kpi-circle-wrap:hover {
  transform: none !important;
  animation: none !important;
}

/* 3. PORTAL TOOLTIP (Attached to document.body, zero card overflow clipping) */
.kpi-portal-tooltip {
  position: fixed !important;
  z-index: 999999 !important;
  background: #0f172a !important;
  color: #ffffff !important;
  padding: 8px 12px !important;
  border-radius: 10px !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  box-shadow: 0 10px 25px -3px rgba(15, 23, 42, 0.25), 0 4px 10px -2px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  max-width: 250px !important;
  pointer-events: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(-4px) !important;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease !important;
  word-break: break-word !important;
  box-sizing: border-box !important;
}

.kpi-portal-tooltip.is-visible {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  pointer-events: auto !important;
}

/* 2. FILTER PLATFORM (8 BUTTONS) */
.social-platform-filters {
  display: grid !important;
  grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  gap: 8px !important;
  width: 100% !important;
  margin-bottom: 24px !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
}

.social-filter-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  height: 44px !important;
  padding: 0 6px !important;
  border-radius: 9999px !important;
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  border: 1px solid rgba(226, 232, 240, 0.85) !important;
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
  transform: none !important;
}

.social-filter-btn:hover {
  border-color: #cbd5e1 !important;
  background: #f8fafc !important;
  transform: none !important; /* No jumping on hover */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

.social-filter-btn.active {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 45%, #3b82f6 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  font-weight: 700 !important;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35) !important;
  transform: none !important;
}

.social-filter-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 16px !important;
  height: 16px !important;
  flex-shrink: 0 !important;
}

.social-filter-icon svg,
.social-filter-icon img {
  max-width: 16px !important;
  max-height: 16px !important;
}

.social-filter-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 18px !important;
  height: 18px !important;
  padding: 0 5px !important;
  border-radius: 9999px !important;
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  background: #f1f5f9 !important;
  color: #64748b !important;
  margin-left: 2px !important;
}

.social-filter-btn.active .social-filter-badge {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

.social-filter-btn.active .social-filter-icon svg path[fill="#000000"],
.social-filter-btn.active .social-filter-icon svg[fill="#000000"] path {
  fill: #ffffff !important;
}

/* Mobile responsive */
@media (max-width: 900px) {
  .social-kpi-grid {
    grid-template-columns: 1fr !important;
  }
  .social-platform-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
