/* ==========================================================================
   Design Tokens & CSS Variables
   ========================================================================== */
:root {
  --bg-main: #07090e;
  --bg-card: rgba(16, 22, 38, 0.75);
  --bg-card-hover: rgba(22, 31, 54, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.03);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.35);
  --border-glow: rgba(59, 130, 246, 0.5);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #020617;

  --accent-primary: #4f46e5;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%);
  --accent-gradient-hover: linear-gradient(135deg, #2563eb 0%, #4f46e5 50%, #7c3aed 100%);

  --color-emerald: #10b981;
  --color-amber: #f59e0b;
  --color-purple: #a855f7;
  --color-blue: #3b82f6;
  --color-rose: #f43f5e;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
  --shadow-glow: 0 0 35px -5px rgba(99, 102, 241, 0.4);
  --shadow-emerald: 0 0 25px -5px rgba(16, 185, 129, 0.4);

  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Ambient Background Glow */
.background-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  animation: floatOrb 20s ease-in-out infinite alternate;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #4f46e5, transparent 70%);
  top: -100px;
  left: -100px;
}

.orb-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #06b6d4, transparent 70%);
  top: 40%;
  right: -150px;
  animation-delay: -5s;
}

.orb-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #a855f7, transparent 70%);
  bottom: -100px;
  left: 20%;
  animation-delay: -10s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.1); }
}

/* Layout Container */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-arrow {
  color: var(--color-blue);
  margin: 0 4px;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.nav-status-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-pill strong {
  color: var(--text-primary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-emerald);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--color-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  border: none;
}

.btn-large {
  padding: 14px 28px;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 0 35px rgba(99, 102, 241, 0.6);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ==========================================================================
   Hero & Sync Control Card
   ========================================================================== */
.hero-card {
  padding: 36px 32px;
  background: linear-gradient(180deg, rgba(20, 27, 45, 0.9) 0%, rgba(13, 18, 30, 0.85) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.8), transparent);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-pill);
  color: #a5b4fc;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.hero-heading {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}

.hero-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 720px;
  margin-bottom: 28px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Config Drawer */
.config-drawer {
  margin-top: 24px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

.config-drawer.hidden {
  display: none;
}

.config-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-with-button {
  display: flex;
  gap: 10px;
}

.config-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

.config-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.config-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ==========================================================================
   Progress Bar & Steps
   ========================================================================== */
.progress-container {
  margin-top: 28px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
}

.progress-container.hidden {
  display: none;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.progress-status {
  color: #a5b4fc;
}

.progress-percent {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
  box-shadow: var(--shadow-glow);
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  gap: 8px;
}

.step {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.3s ease;
}

.step-active {
  color: #a5b4fc;
  font-weight: 700;
}

.step-complete {
  color: var(--color-emerald);
}

/* ==========================================================================
   Metrics Statistics Grid
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.stat-card {
  padding: 22px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.icon-purple {
  background: rgba(168, 85, 247, 0.15);
  color: var(--color-purple);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.icon-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.icon-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 2px 0;
  color: var(--text-primary);
}

.text-emerald {
  color: var(--color-emerald);
}

.stat-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Data Table Section
   ========================================================================== */
.table-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.table-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  color: var(--text-muted);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.88rem;
  min-width: 220px;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.select-filter {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
}

.select-filter option {
  background: #111827;
  color: #f3f4f6;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.user-name {
  font-weight: 600;
  color: var(--text-primary);
}

.phone-badge {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.email-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.price-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-emerald);
  background: rgba(16, 185, 129, 0.1);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.course-tag {
  font-size: 0.8rem;
  color: #cbd5e1;
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.receipt-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: #60a5fa;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  transition: all 0.2s ease;
}

.receipt-btn:hover {
  background: rgba(59, 130, 246, 0.2);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-success {
  background: rgba(16, 185, 129, 0.9);
  color: #fff;
}

.toast-error {
  background: rgba(244, 63, 94, 0.9);
  color: #fff;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .nav-status-group {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .hero-heading {
    font-size: 1.75rem;
  }
  .table-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .table-controls {
    width: 100%;
  }
  .search-box {
    width: 100%;
  }
  .search-box input {
    width: 100%;
  }
}
