﻿/* ============================================
   WZSport Dashboard â€” Dark Mode + Glassmorphism
   ============================================ */

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --accent-pink: #ec4899;
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-3: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --gradient-4: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15);
  --radius: 12px;
  --radius-lg: 16px;
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ========================
   Header
   ======================== */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-1);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glow);
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.whatsapp-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}

.status-dot.online {
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: pulse-green 2s infinite;
}

.status-dot.offline {
  background: var(--accent-red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ========================
   Buttons
   ======================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-1);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

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

.btn-danger {
  background: var(--gradient-4);
  color: white;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ========================
   Stats Grid
   ======================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 24px 32px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
}

.stat-total::before { background: var(--gradient-1); }
.stat-sent::before { background: var(--gradient-2); }
.stat-pending::before { background: var(--gradient-3); }
.stat-failed::before { background: var(--gradient-4); }
.stat-me::before { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-sf::before { background: linear-gradient(135deg, #f59e0b, #eab308); }
.stat-shopee::before { background: linear-gradient(135deg, #ee4d2d, #ff5722); }

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.stat-icon {
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border-radius: var(--radius);
  flex-shrink: 0;
}

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

.stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========================
   Tabs
   ======================== */

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 32px;
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-purple);
}

.tab-content {
  display: none;
  padding: 0 32px 32px;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* ========================
   Tables
   ======================== */

.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-glass);
}

tbody td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:last-child td {
  border-bottom: none;
}

td.empty {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* ========================
   Badges
   ======================== */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-me {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-sf {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-li {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-shopee {
  background: rgba(238, 77, 45, 0.15);
  color: #ee4d2d;
  border: 1px solid rgba(238, 77, 45, 0.3);
}

.badge-status-posted {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-status-delivered {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-status-released {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

/* ========================
   Text helpers
   ======================== */

.text-success { color: var(--accent-green); }
.text-error { color: var(--accent-red); }
.text-warning { color: var(--accent-orange); }

.tracking-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.tracking-link:hover {
  text-decoration: underline;
}

.carrier-link {
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  margin-top: 4px;
  transition: opacity 0.2s;
}

.carrier-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ========================
   Customer Form
   ======================== */

.customer-form {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.customer-form h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.form-description {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

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

.input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ========================
   Webhook Info
   ======================== */

.webhook-alert {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
}

.webhook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.webhook-info {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.webhook-info h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.webhook-info p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.webhook-url {
  display: block;
  padding: 10px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--accent-blue);
  margin-bottom: 8px;
  -webkit-user-select: all;
  user-select: all;
}

.webhook-events {
  font-size: 12px;
}

.webhook-events code {
  background: var(--bg-glass);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--accent-purple);
}

/* ========================
   Toast Notifications
   ======================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: white;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  background: linear-gradient(135deg, #10b981, #059669);
}

.toast-error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* ========================
   Responsive
   ======================== */

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

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 16px;
  }

  .tabs {
    padding: 0 16px;
    overflow-x: auto;
  }

  .tab-content {
    padding: 0 16px 16px;
  }

  .form-row {
    flex-direction: column;
  }

  .table-container {
    overflow-x: auto;
  }
}

/* ========================
   QR Code Modal
   ======================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-card h2 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.modal-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.qr-container {
  background: var(--surface);
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  display: inline-block;
}

.qr-container img {
  display: block;
  width: 250px;
  height: 250px;
}

.modal-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
}


.link-ngrok {
  color: #60a5fa;
}

.webhook-input-group {
  display: flex; 
  gap: 8px; 
  align-items: center; 
  margin-bottom: 12px;
}

.flex-1 {
  flex: 1;
}

.no-margin {
  margin-bottom: 0 !important;
}

.btn-setup {
  padding: 10px 15px; 
  white-space: nowrap;
}

/* Tabs Styles */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab-btn {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--primary);
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Templates Editor */
.templates-grid {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  min-height: 500px;
}
.template-list {
  border-right: 1px solid var(--border);
  padding: 1rem 0;
}
.template-item {
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s;
}
.template-item:hover {
  background: var(--border);
}
.template-item.active {
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary);
  font-weight: 500;
  border-right: 3px solid var(--primary);
}
.template-editor {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}
.template-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.variables-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--background);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.var-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--primary);
  font-family: monospace;
}
.var-btn:hover {
  background: var(--border);
  border-color: var(--primary);
}
.template-textarea {
  flex: 1;
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--text-primary);
  font-family: monospace;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 300px;
  margin-bottom: 1rem;
}
.template-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}