/* ==========================================================================
   WhatsApp Nexus - Premium Dark Aesthetic Design System
   ========================================================================== */

:root {
  --bg-dark: #090d16;
  --bg-card: #121826;
  --bg-card-hover: #172033;
  --bg-sidebar: #0d121f;
  --bg-input: #1b2438;
  
  --primary-whatsapp: #25D366;
  --primary-whatsapp-hover: #1eb956;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-orange: #f97316;
  --accent-red: #ef4444;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-active: rgba(37, 211, 102, 0.4);

  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-glow: 0 0 20px rgba(37, 211, 102, 0.15);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ==========================================================================
   SIDEBAR NAVIGATION
   ========================================================================== */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.2), rgba(59, 130, 246, 0.2));
  border: 1px solid rgba(37, 211, 102, 0.4);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--primary-whatsapp);
  box-shadow: var(--shadow-glow);
}

.glow-icon {
  filter: drop-shadow(0 0 8px rgba(37, 211, 102, 0.6));
}

.brand-text h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-text h2 span {
  color: var(--primary-whatsapp);
}

.version-tag {
  font-size: 11px;
  color: var(--text-muted);
  background-color: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.nav-item i {
  font-size: 16px;
  width: 20px;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 211, 102, 0.15), rgba(37, 211, 102, 0.03));
  border-left: 3px solid var(--primary-whatsapp);
  color: var(--primary-whatsapp);
  font-weight: 600;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.channel-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-card);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--text-dim);
}

.status-indicator.online {
  background-color: var(--primary-whatsapp);
  box-shadow: 0 0 8px var(--primary-whatsapp);
}

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

.channel-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.channel-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px 32px;
  background-color: var(--bg-dark);
}

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.header-title h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-title p {
  font-size: 13px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.channel-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.channel-select-wrapper i {
  position: absolute;
  left: 12px;
  color: var(--primary-whatsapp);
  font-size: 14px;
  pointer-events: none;
}

.channel-select {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 16px 10px 36px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

/* TAB PANES */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* ==========================================================================
   CARDS & GRIDS
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.accent-green .stat-icon { background: rgba(37, 211, 102, 0.15); color: var(--primary-whatsapp); }
.accent-blue .stat-icon { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.accent-purple .stat-icon { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.accent-orange .stat-icon { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }

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

.stat-value {
  font-size: 24px;
  font-weight: 800;
  margin: 2px 0;
}

.stat-trend {
  font-size: 11px;
  color: var(--primary-whatsapp);
  font-weight: 500;
}

.dashboard-grid, .split-view {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.card-hero {
  flex: 1.5;
  background: linear-gradient(145deg, #121826, #161e30);
  border: 1px solid rgba(37, 211, 102, 0.2);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background-color: rgba(37, 211, 102, 0.15);
  color: var(--primary-whatsapp);
  border: 1px solid rgba(37, 211, 102, 0.3);
}

.credential-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cred-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.cred-key {
  color: var(--text-muted);
  font-weight: 500;
}

.cred-val {
  font-family: var(--font-mono);
  color: var(--primary-whatsapp);
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
}

.truncate-token {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-action-buttons {
  display: flex;
  gap: 12px;
}

/* BUTTONS */
.btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary-whatsapp);
  color: #000;
}

.btn-primary:hover {
  background-color: var(--primary-whatsapp-hover);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.btn-success {
  background-color: var(--primary-whatsapp);
  color: #000;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }

/* FORMS & INPUTS */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary-whatsapp);
  box-shadow: 0 0 10px rgba(37, 211, 102, 0.2);
}

.code-font {
  font-family: var(--font-mono);
  font-size: 13px;
}

.help-text {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  display: block;
}

.form-row {
  display: flex;
  gap: 16px;
}

.flex-1 { flex: 1; }

/* FILE DROPZONE */
.upload-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.upload-dropzone:hover {
  border-color: var(--primary-whatsapp);
  background-color: rgba(37, 211, 102, 0.04);
}

.upload-dropzone i {
  font-size: 28px;
  color: var(--primary-whatsapp);
  margin-bottom: 8px;
}

.upload-dropzone p span {
  color: var(--primary-whatsapp);
  font-weight: 600;
}

.upload-dropzone input[type="file"] {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* ==========================================================================
   SMARTPHONE WHATSAPP MOCKUP
   ========================================================================== */
.phone-preview-card {
  width: 380px;
  flex-shrink: 0;
}

.center-content {
  display: flex;
  justify-content: center;
  align-items: center;
}

.whatsapp-phone-mockup {
  width: 320px;
  height: 560px;
  background-color: #0b141a;
  border: 8px solid #202c33;
  border-radius: 36px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

.notch {
  width: 100px;
  height: 14px;
  background-color: #202c33;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  margin: 0 auto 6px auto;
}

.phone-header {
  background-color: #202c33;
  padding: 0 12px 10px 12px;
}

.phone-contact {
  display: flex;
  align-items: center;
  gap: 10px;
}

.phone-contact .avatar {
  width: 34px;
  height: 34px;
  background-color: var(--primary-whatsapp);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.phone-contact .contact-details {
  display: flex;
  flex-direction: column;
}

.phone-contact .name {
  font-size: 13px;
  font-weight: 600;
  color: #e9edef;
}

.phone-contact .status {
  font-size: 10px;
  color: #8696a0;
}

.phone-screen {
  flex: 1;
  padding: 16px 12px;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 16px 16px;
  display: flex;
  flex-direction: column;
}

.chat-date {
  align-self: center;
  background-color: #182229;
  color: #8696a0;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.whatsapp-bubble {
  align-self: flex-start;
  background-color: #005c4b;
  color: #e9edef;
  padding: 10px 12px;
  border-radius: 8px;
  border-top-left-radius: 0;
  max-width: 85%;
  font-size: 12px;
  line-height: 1.4;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.highlight-var {
  background: rgba(255, 255, 255, 0.2);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
  color: #fff;
}

.bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 6px;
  font-size: 9px;
  color: #8696a0;
}

.read-ticks {
  color: #53bdeb;
}

.phone-footer {
  background-color: #111b21;
  padding: 8px;
  text-align: center;
  font-size: 10px;
  color: #8696a0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   CODE GENERATOR & TERMINAL OUTPUT
   ========================================================================== */
.code-lang-selector {
  display: flex;
  gap: 6px;
}

.lang-btn {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

.lang-btn.active {
  background-color: var(--primary-whatsapp);
  color: #000;
  border-color: var(--primary-whatsapp);
  font-weight: 600;
}

.code-block-wrapper {
  position: relative;
  margin: 16px 0 24px 0;
}

.copy-btn {
  position: absolute;
  top: 12px; right: 12px;
  background-color: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

pre {
  background-color: #0d1117;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #e6edf3;
}

.terminal-output-card {
  background-color: #0d1117;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.terminal-header {
  background-color: #161b22;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.terminal-body {
  padding: 16px;
  max-height: 300px;
  overflow-y: auto;
}

/* TABLES */
.table-responsive {
  overflow-x: auto;
}

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

.data-table th {
  background-color: var(--bg-input);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

/* CHANNELS GRID */
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.channel-card {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.channel-card.is-default {
  border-color: var(--primary-whatsapp);
}

/* MODAL OVERLAY */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden { display: none; }

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 480px;
  max-width: 90%;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.close-btn {
  background: none; border: none;
  color: var(--text-muted); font-size: 24px; cursor: pointer;
}

.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px;
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 2000;
}

.toast {
  background-color: var(--bg-card);
  border: 1px solid var(--primary-whatsapp);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  animation: slideIn 0.3s ease;
}

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

.mini-log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mini-log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background-color: var(--bg-input);
  border-radius: 6px;
  font-size: 12px;
}

.otp-verify-box {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}

.result-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.hidden { display: none !important; }
