/* ========================================================
   VENUS AFFILIATE OS - OBSIDIAN CYBERPUNK FINTECH DESIGN SYSTEM
   Inspired by Linear, Vercel, Raycast & Apple Card
   ======================================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg-app: #07090e;
  --bg-sidebar: #0b0e17;
  --bg-header: rgba(11, 14, 23, 0.85);
  --bg-card: rgba(16, 20, 32, 0.75);
  --bg-card-subtle: rgba(12, 15, 24, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(168, 85, 247, 0.4);
  --text-main: #f3f4f6;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #6366f1;
  --purple: #a855f7;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --cyan: #06b6d4;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  background-image: 
    radial-gradient(circle at 10% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 90% 20%, rgba(168, 85, 247, 0.08) 0%, transparent 35%),
    radial-gradient(circle at 50% 100%, rgba(245, 158, 11, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

/* App Desktop Layout */
.app-container {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Sidebar (Left) */
.app-sidebar {
  width: 250px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  z-index: 40;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}

.sidebar-header {
  height: 64px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #ec4899, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.4);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-brand-text h1 {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #fff;
  line-height: 1.2;
}

.sidebar-brand-text p {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.4px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 0 10px 4px 10px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
  white-space: nowrap;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff;
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.15));
  color: #c084fc;
  font-weight: 700;
  border: 1px solid rgba(168, 85, 247, 0.35);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.2);
}

.nav-item i {
  width: 16px;
  text-align: center;
  font-size: 13px;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card-subtle);
  font-size: 11px;
}

/* Main Area (Right) */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background-color: transparent;
}

/* Header (Top) */
.app-header {
  min-height: 64px;
  background: var(--bg-header);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
  z-index: 30;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-left {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 12px;
}

.page-title {
  white-space: nowrap;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.2px;
}

.header-right {
  display: flex;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.header-right > * { flex-shrink: 0; }

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-badge:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.header-badge.badge-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.header-badge.badge-success:hover {
  background: rgba(16, 185, 129, 0.2);
}

.header-badge.badge-purple {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.3);
  color: #c084fc;
}
.header-badge.badge-purple:hover {
  background: rgba(168, 85, 247, 0.2);
}

.header-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: all 0.2s ease;
}
.header-btn-primary:hover {
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

/* Scrollable Content Body */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* KPI Card Grid: Strict 4-Column Layout */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 125px;
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.kpi-card:hover {
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: 0 12px 35px -8px rgba(0, 0, 0, 0.6), 0 0 20px -5px rgba(168, 85, 247, 0.15);
  transform: translateY(-3px);
}
.kpi-card:hover::before {
  opacity: 1;
}

.kpi-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  white-space: nowrap;
}

.kpi-value {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
  font-family: 'JetBrains Mono', monospace;
  margin: 10px 0;
  color: #fff;
}

.kpi-footer {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

/* Analytics Row: 2 Columns (65% / 35%) */
.analytics-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  width: 100%;
}

.analytics-row-single {
  grid-template-columns: 1fr;
}

.platform-performance-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.platform-performance-item {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-card-subtle);
  padding: 9px 10px;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.55;
}

.platform-performance-item strong {
  display: block;
  color: #f8fafc;
  font-size: 11px;
  margin-bottom: 3px;
}

.analytics-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.analytics-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.card-heading {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-subheading {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

/* Funnel & Telemetry Row */
.funnel-telemetry-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  width: 100%;
}

.funnel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding-top: 6px;
}

.funnel-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  transition: all 0.2s ease;
}
.funnel-box:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.funnel-box-label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
}

.funnel-box-value {
  font-size: 19px;
  font-weight: 900;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  margin: 6px 0;
}

.funnel-box-sub {
  font-size: 10px;
  font-weight: 600;
}

/* Data Table Card */
.table-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
}

.table-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pro-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.pro-table thead tr {
  background: var(--bg-card-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.pro-table th {
  padding: 12px 18px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

.pro-table td {
  padding: 13px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.pro-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
}

/* Platform Tag Pills */
.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 800;
}

.platform-pill.shopee {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.35);
}

.platform-pill.tiktok {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.35);
}

.platform-pill.lazada {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

/* Status Dot Beacons */
.status-beacon {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-beacon.green {
  background-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}

.status-beacon.amber {
  background-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.8);
}

.status-beacon.red {
  background-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.9);
  animation: beaconPulseRed 1.2s infinite;
}

.status-beacon.gray {
  background-color: #64748b;
  box-shadow: none;
}

@keyframes beaconPulseRed {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Floating Disconnect Alert Bar */
.floating-disconnect-bar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  width: calc(100% - 300px);
  max-width: 860px;
  background: rgba(30, 8, 14, 0.94);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(244, 63, 94, 0.65);
  box-shadow: 0 12px 35px -5px rgba(225, 29, 72, 0.45), 0 0 25px rgba(244, 63, 94, 0.2);
  border-radius: 12px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #ffe4e6;
  font-size: 12px;
  transition: all 0.3s ease;
  animation: slideDownAlert 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-disconnect-bar.hidden {
  display: none !important;
}

@keyframes slideDownAlert {
  from { opacity: 0; transform: translate(-50%, -24px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Modern iOS-Style Toggle Switches */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .25s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #6366f1;
}

input:checked + .slider:before {
  transform: translateX(18px);
}

/* Custom Toast System */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  min-width: 300px;
  padding: 13px 18px;
  border-radius: 12px;
  background: rgba(18, 22, 34, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #252d3e;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3b4660;
}

/* Clean Form Controls */
.pro-input {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 12px;
  color: #fff;
  outline: none;
  transition: all 0.2s ease;
}

.pro-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.pro-btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pro-btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}
.pro-btn-primary:hover {
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.5);
  transform: translateY(-1px);
}
.pro-btn-primary:active {
  transform: translateY(1px);
}

/* Order and support workspace */
[hidden] { display: none !important; }
.desk-heading { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom:16px; }
.desk-heading h2 { font-size:24px; font-weight:800; letter-spacing:-.5px; color: #fff; }
.desk-heading h3 { font-size:18px; font-weight:700; color: #fff; }
.desk-eyebrow { font-size:10px; font-weight:800; color:#a5b4fc; letter-spacing:1.8px; margin-bottom:6px; }
.desk-muted { color:#94a3b8; font-size:12px; line-height:1.7; margin:8px 0; }
.desk-metrics { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; }
.desk-metric { padding:18px; border:1px solid var(--border-subtle); border-radius:14px; background:var(--bg-card); display:flex; flex-direction:column; gap:10px; backdrop-filter: blur(12px); }
.desk-metric span { color:#94a3b8; font-size:11px; font-weight: 600; }
.desk-metric strong { color:#e2e8f0; font-size:26px; font-weight:800; font-family: 'JetBrains Mono', monospace; }
.desk-metric:nth-last-child(1) strong { color:#fbbf24; }
.desk-notice { color:#fcd34d; font-size:13px; line-height:1.6; scroll-margin-top:20px; }
.desk-notice:empty { display:none; }
.desk-filter { padding:16px; display:flex; align-items:end; flex-wrap:wrap; gap:12px; }
.desk-filter label,.desk-form label { display:flex; flex-direction:column; gap:7px; color:#cbd5e1; font-size:12px; min-width:0; font-weight: 600; }
.desk-filter .desk-search { flex:1 1 220px; }
.desk-filter .desk-check { display:flex; flex-direction:row; align-items:center; align-self:center; }
.desk-table-scroll { overflow:auto; }
.desk-table-scroll table { min-width:850px; }
.desk-table-scroll td { max-width:280px; overflow-wrap:anywhere; }
.desk-table-scroll .pro-btn { text-align:left; overflow-wrap:anywhere; }
.desk-empty { text-align:center; padding:32px !important; color:#94a3b8; }
.desk-due td:last-child { color:#fbbf24; }
.desk-pager { display:flex; align-items:center; justify-content:end; gap:10px; padding:16px; flex-wrap:wrap; }
.desk-pager span { margin-right:auto; color:#94a3b8; font-size:12px; }
.desk-detail { border:1px solid rgba(168, 85, 247, 0.35); border-radius:16px; padding:20px; scroll-margin-top:16px; background: rgba(16, 20, 32, 0.9); }
.desk-detail-grid { display:grid; grid-template-columns:minmax(0,2fr) minmax(220px,1fr); gap:28px; margin-top:20px; }
.desk-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-content:start; gap:16px; margin-top:16px; }
.desk-form .pro-input { width:100%; }
.desk-form .desk-wide { grid-column:1/-1; }
.desk-form button { justify-self:start; }
.desk-summary-title { font-weight:700; cursor:pointer; font-size:14px; }
.desk-events { display:flex; flex-direction:column; gap:18px; padding-top:16px; max-height:480px; overflow:auto; }
.desk-event { border-left:2px solid #a855f7; padding-left:14px; font-size:12px; line-height:1.6; }
.desk-event time { color:#94a3b8; font-size:10px; }
.desk-context { white-space:pre-wrap; overflow-wrap:anywhere; font-size:13px; padding:16px; background:#080b13; border-radius:12px; line-height:1.7; border: 1px solid var(--border-subtle); }
.desk-support { margin-top:16px; }
.pro-btn:disabled { opacity:.45; cursor:default; }

@media(max-width:1100px) { .desk-metrics { grid-template-columns:repeat(3,minmax(0,1fr)); } .desk-detail-grid { grid-template-columns:1fr; } }
@media(max-width:640px) { .desk-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); } .desk-form { grid-template-columns:1fr; } .desk-filter label { flex:1 1 140px; } .desk-detail { padding:14px; } }
@media(max-width:720px) {
  .app-sidebar { width:64px; }
  .sidebar-header { padding:0 14px; }
  .sidebar-brand-text,.nav-section-title,.sidebar-footer,.nav-item span { display:none; }
  .sidebar-nav { padding:12px 6px; gap:10px; }
  .nav-item { justify-content:center; min-height:42px; padding:10px; }
  .app-content { padding:16px; }
  .app-header { padding:10px 16px; }
}

.pro-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}
.pro-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
