/* ===== Admin Dashboard CSS ===== */
:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-card2: #22263a;
  --border: rgba(255,255,255,0.07);
  --text: #e8eaf0;
  --text-muted: #7a80a0;
  --text-dim: #4a5070;

  /* Segment colors */
  --loyal-main: #f5c518;
  --loyal-glow: rgba(245,197,24,0.25);
  --loyal-bg: rgba(245,197,24,0.08);

  --new-main: #3ecfcf;
  --new-glow: rgba(62,207,207,0.25);
  --new-bg: rgba(62,207,207,0.08);

  --risk-main: #ff8c42;
  --risk-glow: rgba(255,140,66,0.25);
  --risk-bg: rgba(255,140,66,0.08);

  --lost-main: #e84393;
  --lost-glow: rgba(232,67,147,0.25);
  --lost-bg: rgba(232,67,147,0.08);

  --radius: 16px;
  --radius-sm: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== Header ===== */
.admin-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.admin-logo {
  font-size: 1.6rem;
}

.admin-title-wrap { flex: 1; }

.admin-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.admin-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(62, 207, 100, 0.12);
  border: 1px solid rgba(62, 207, 100, 0.25);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #4ade80;
  letter-spacing: 0.5px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse-live 1.5s ease-in-out infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.header-nav-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.header-nav-btn:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text);
}

/* ===== Main Layout ===== */
.admin-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
}

@media (max-width: 900px) {
  .admin-main { grid-template-columns: 1fr; padding: 16px; }
}

/* ===== Waiting State ===== */
.waiting-panel {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  gap: 20px;
}

.waiting-icon {
  font-size: 5rem;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.waiting-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.waiting-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 340px;
  line-height: 1.6;
}

.waiting-bar {
  width: 200px;
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
}

.waiting-bar-fill {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--text-muted), transparent);
  animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-200%); }
  100% { transform: translateX(400%); }
}

/* ===== Segment Card (main feature) ===== */
.left-col { display: flex; flex-direction: column; gap: 24px; }
.right-col { display: flex; flex-direction: column; gap: 24px; }

.segment-reveal-card {
  border-radius: var(--radius);
  padding: 32px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  animation: card-enter 0.5s ease-out;
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.segment-reveal-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background: radial-gradient(ellipse at 30% 50%, currentColor 0%, transparent 65%);
  pointer-events: none;
}

.segment-glow {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.25;
  pointer-events: none;
}

.segment-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.segment-new-badge {
  background: rgba(62,207,100,0.15);
  border: 1px solid rgba(62,207,100,0.3);
  color: #4ade80;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 8px;
  animation: blink-badge 1s ease-in-out 3;
}

@keyframes blink-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.segment-name {
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 10px;
}

.segment-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 480px;
}

.segment-meta-row {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.meta-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
}

.meta-chip-icon { font-size: 1.1rem; }

.meta-chip-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-chip-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

/* ===== Weight Bars ===== */
.weights-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.card-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.weight-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.weight-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  width: 120px;
  flex-shrink: 0;
}

.weight-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.07);
  border-radius: 4px;
  overflow: hidden;
}

.weight-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.4,0,0.2,1);
}

.weight-value {
  font-size: 0.82rem;
  font-weight: 700;
  min-width: 36px;
  text-align: right;
}

/* ===== Business Recommendations ===== */
.reco-biz-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.reco-biz-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.reco-biz-intro {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.action-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.action-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  cursor: default;
  transition: background 0.18s;
  border: 1px solid transparent;
}

.action-item:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
}

.action-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.action-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.action-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.action-priority {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.priority-high { background: rgba(239,68,68,0.15); color: #f87171; }
.priority-med  { background: rgba(245,158,11,0.15); color: #fbbf24; }
.priority-low  { background: rgba(34,197,94,0.15);  color: #86efac; }

/* ===== Cart Summary (right column) ===== */
.cart-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cart-summary-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.cart-items-list {
  padding: 8px 12px;
  max-height: 280px;
  overflow-y: auto;
}

.cart-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

.cart-row:last-child { border-bottom: none; }

.cart-row-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-card2);
  flex-shrink: 0;
}

.cart-row-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}

.cart-row-variant {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.cart-row-qty {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.cart-row-price {
  font-size: 0.82rem;
  font-weight: 700;
  min-width: 72px;
  text-align: right;
  flex-shrink: 0;
}

.cart-total-block {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-total-lbl { font-size: 0.82rem; color: var(--text-muted); }
.cart-total-val { font-size: 1rem; font-weight: 800; }

/* ===== Activity Feed ===== */
.activity-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.activity-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.activity-feed {
  padding: 8px 12px;
  max-height: 260px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.activity-item:hover { background: rgba(255,255,255,0.03); }

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.activity-text {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.activity-text strong { color: var(--text); font-weight: 700; }

.activity-time {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.activity-empty {
  padding: 24px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ===== Stats Row ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  grid-column: 1 / -1;
}

@media (max-width: 700px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-icon { font-size: 1.6rem; margin-bottom: 10px; }
.stat-value { font-size: 1.6rem; font-weight: 900; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ===== Scrollbars ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
