@import "global.css";
/* --- Vyra Global Text Selection (#ffbe8e) --- */
::selection {
  background-color: #ffbe8e !important;
  color: #0d0d14 !important;
}
::-moz-selection {
  background-color: #ffbe8e !important;
  color: #0d0d14 !important;
}

/* =========================================================================
   VYRA ANALYTICS & A/B TESTING — FEUILLE DE STYLE
   Interface SaaS haut de gamme alignée sur le design system Vyra
   (Sora, Inter, NewTitle, Accent Corail #FF6B4A / #FFBE8E, Glassmorphism).
   ========================================================================= */

.analytics-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.8rem 2rem 4rem;
}

/* ---- Header & Top Controls ---- */
.analytics-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.analytics-header-title h1 {
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.analytics-header-title p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  max-width: 580px;
  line-height: 1.5;
}

.analytics-top-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.analytics-select {
  padding: 0.55rem 1rem 0.55rem 0.9rem;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.analytics-select:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.period-pills {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.period-pill {
  padding: 0.38rem 0.8rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.period-pill:hover {
  color: var(--text-primary);
}
.period-pill.is-active {
  background: var(--ink);
  color: #ffffff;
}
html.dark-mode .period-pill.is-active {
  background: var(--accent);
  color: var(--ink);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.45rem 0.8rem;
  border-radius: 100px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #16a34a;
  font-size: 0.76rem;
  font-weight: 700;
}
html.dark-mode .live-badge {
  color: #4ade80;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse-live 2s infinite;
}
@keyframes pulse-live {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.btn-refresh {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-refresh:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  transform: rotate(45deg);
}

/* ---- Tabs Switcher ---- */
.analytics-tabs {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 2rem;
}

.analytics-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 1.2rem;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}
.analytics-tab-btn:hover {
  color: var(--text-primary);
}
.analytics-tab-btn.is-active {
  color: var(--text-primary);
}
.analytics-tab-btn.is-active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-strong);
  border-radius: 2px;
}
.tab-badge {
  padding: 2px 7px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--accent-tint);
  color: var(--accent-strong);
}

/* ---- KPI Cards Grid ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 1.4rem 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(20,20,26,0.08);
}
.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.kpi-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-glass-1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-strong);
}
.kpi-icon svg {
  width: 16px;
  height: 16px;
}
.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}
.kpi-subtext {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-subtext.positive {
  color: #16a34a;
}
.kpi-subtext.highlight {
  color: var(--accent-strong);
  font-weight: 600;
}

/* ---- Secondary Metrics Bar ---- */
.secondary-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.secondary-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 1rem 1.2rem;
}
.sec-metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-weight: 500;
}
.sec-metric-value {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ---- Chart Card ---- */
.analytics-chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.8rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 2rem;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.chart-title-wrap h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.chart-title-wrap p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chart-metric-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg-glass-1);
  padding: 3px;
  border-radius: 8px;
}
.chart-metric-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chart-metric-btn:hover { color: var(--text-primary); }
.chart-metric-btn.is-active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
}
.chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Empty State */
.analytics-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 2.4rem;
  margin-bottom: 0.8rem;
  opacity: 0.75;
}
.empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.empty-desc {
  font-size: 0.84rem;
  max-width: 420px;
  line-height: 1.5;
}

/* ---- Funnel Section ---- */
.funnel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.8rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 2rem;
}
.funnel-header {
  margin-bottom: 1.6rem;
}
.funnel-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.funnel-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.funnel-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.funnel-step-row {
  display: grid;
  grid-template-columns: 180px 1fr 140px;
  align-items: center;
  gap: 1rem;
}
@media (max-width: 768px) {
  .funnel-step-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

.funnel-step-info {
  display: flex;
  flex-direction: column;
}
.funnel-step-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
}
.funnel-step-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.funnel-bar-container {
  height: 28px;
  background: var(--bg-glass-1);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-soft);
}
.funnel-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  border-radius: 7px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  padding-left: 10px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 32px;
}

.funnel-dropoff-badge {
  text-align: right;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.funnel-dropoff-badge span {
  color: #dc2626;
}

/* ---- Two-Column Breakdown Grid ---- */
.analytics-two-col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
@media (max-width: 992px) {
  .analytics-two-col {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.6rem;
  box-shadow: var(--shadow-card);
}
.panel-card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.2rem;
}

/* Table Style */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.analytics-table th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.analytics-table td {
  padding: 0.75rem 0.8rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
}
.analytics-table tr:last-child td {
  border-bottom: none;
}
.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.product-mini-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg-glass-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* Sources Progress List */
.source-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.source-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.source-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
}
.source-name { color: var(--text-primary); }
.source-pct { color: var(--text-muted); }
.source-progress-bar {
  height: 8px;
  background: var(--bg-glass-1);
  border-radius: 100px;
  overflow: hidden;
}
.source-progress-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--accent-strong);
}

/* ---- Orders Stream ---- */
.orders-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.8rem;
  box-shadow: var(--shadow-card);
}
.status-pill {
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.status-pill.status-completed {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

/* =========================================================================
   A/B TESTING TAB STYLES
   ========================================================================= */
.ab-hero-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.btn-create-ab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.65rem 1.25rem;
  border-radius: 100px;
  background: var(--accent);
  color: var(--ink);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn-create-ab:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.ab-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.ab-test-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.8rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.ab-test-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.ab-test-title-wrap h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.ab-meta-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ab-badge {
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
}
.ab-badge.running { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.ab-badge.paused { background: rgba(234, 179, 8, 0.12); color: #ca8a04; }
.ab-badge.completed { background: rgba(107, 114, 128, 0.12); color: #4b5563; }
.ab-badge.tag { background: var(--bg-glass-1); color: var(--text-secondary); border: 1px solid var(--border-soft); }

.ab-variants-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}
@media (max-width: 768px) {
  .ab-variants-comparison {
    grid-template-columns: 1fr;
  }
}

.ab-variant-box {
  background: var(--bg-glass-1);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 1.2rem;
  position: relative;
  transition: border-color 0.2s ease;
}
.ab-variant-box.is-winner {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.04);
}
.variant-winner-ribbon {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #22c55e;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 100px;
}

.variant-header {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}
.variant-value-preview {
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-soft);
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-family: monospace;
  word-break: break-all;
}

.variant-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  text-align: center;
}
.v-stat-item {
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 0.5rem 0.4rem;
  border: 1px solid var(--border-soft);
}
.v-stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.v-stat-num {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ab-verdict-bar {
  background: var(--bg-glass-1);
  border-radius: 10px;
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  border: 1px solid var(--border-soft);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.ab-verdict-text {
  font-weight: 600;
  color: var(--text-primary);
}
.ab-controls {
  display: flex;
  gap: 8px;
}
.ab-action-btn {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-soft);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: all 0.15s ease;
}
.ab-action-btn:hover {
  background: var(--bg-glass-1);
}
.ab-action-btn.btn-danger {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.2);
}
.ab-action-btn.btn-danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

/* Modal A/B */
.ab-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.ab-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.ab-modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-ambient);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s ease;
}
.ab-modal-backdrop.is-open .ab-modal-box {
  transform: translateY(0) scale(1);
}
.ab-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.ab-modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}
.ab-form-group {
  margin-bottom: 1.2rem;
}
.ab-form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.ab-form-input, .ab-form-select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.84rem;
  outline: none;
}
.ab-form-input:focus, .ab-form-select:focus {
  border-color: var(--accent-strong);
}
.ab-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.ab-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 1.8rem;
}
