/* Reset and General Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-color: #06050b;
  --panel-bg: rgba(255, 255, 255, 0.03);
  --panel-border: rgba(255, 255, 255, 0.07);
  --panel-border-hover: rgba(255, 255, 255, 0.15);
  
  /* Brand Curated Colors */
  --primary: #7c3aed; /* Neon Purple */
  --primary-glow: rgba(124, 58, 237, 0.3);
  --primary-hover: #8b5cf6;
  
  --secondary: #06b6d4; /* Neon Cyan */
  --whatsapp: #22c55e; /* WhatsApp Green */
  --whatsapp-glow: rgba(34, 197, 94, 0.25);
  
  --danger: #f43f5e; /* Rose Red */
  --danger-glow: rgba(244, 63, 94, 0.3);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #64748b;
  
  --sidebar-width: 280px;
  --transition-speed: 0.3s;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Animated Blobs */
.blob-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  animation: float 25s infinite alternate;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: var(--primary);
  top: -10%;
  right: 10%;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: var(--secondary);
  bottom: -10%;
  left: 5%;
  animation-delay: -5s;
}

.blob-3 {
  width: 350px;
  height: 350px;
  background: var(--whatsapp);
  top: 40%;
  left: 40%;
  animation-delay: -10s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  100% {
    transform: translate(80px, 50px) scale(1.2) rotate(360deg);
  }
}

/* Main Layout Structure */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(10, 8, 18, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  padding: 30px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 45px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.brand-logo i {
  color: white;
  width: 24px;
  height: 24px;
}

.brand-text h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #d8b4fe);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px 18px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all var(--transition-speed);
  position: relative;
}

.menu-item i {
  width: 20px;
  height: 20px;
}

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

.menu-item.active {
  color: white;
  background: linear-gradient(to right, rgba(124, 58, 237, 0.15), rgba(6, 182, 212, 0.05));
  border-left: 3px solid var(--primary);
  box-shadow: inset 0 0 10px rgba(124, 58, 237, 0.05);
}

.log-indicator {
  position: absolute;
  right: 15px;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 700;
  display: none;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  border-top: 1px solid var(--panel-border);
  padding-top: 20px;
}

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

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--whatsapp), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  box-shadow: 0 0 10px var(--whatsapp-glow);
}

.user-details h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-details span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Content Area */
.content-area {
  flex-grow: 1;
  padding: 40px;
  overflow-y: auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.header-title h1 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 5px;
}

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

/* Badges */
.connection-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--panel-border);
}

.connection-status-badge.disconnected {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.2);
  color: var(--danger);
}

.connection-status-badge.connecting {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.2);
  color: var(--secondary);
}

.connection-status-badge.qr_ready {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.2);
  color: var(--primary-hover);
}

.connection-status-badge.ready {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.2);
  color: var(--whatsapp);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
}

.connection-status-badge.ready .status-dot {
  animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Glass Panels */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 25px;
  transition: border-color var(--transition-speed), transform var(--transition-speed);
}

.glass-card:hover {
  border-color: var(--panel-border-hover);
}

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

.card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

/* Tab Management */
.tab-pane {
  display: none;
  flex-direction: column;
  gap: 25px;
  animation: tabFadeIn 0.4s ease-out forwards;
}

.tab-pane.active {
  display: flex;
}

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

/* DASHBOARD TAB */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 25px;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Connection Portal Body */
.portal-body {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 15px;
}

.state-container h4 {
  font-size: 1.1rem;
  font-weight: 700;
}

.state-container p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 320px;
  line-height: 1.5;
}

.warning-icon {
  width: 50px;
  height: 50px;
  color: var(--danger);
  filter: drop-shadow(0 0 10px var(--danger-glow));
}

.success-glow {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px var(--whatsapp-glow);
  margin-bottom: 5px;
}

.success-icon {
  width: 36px;
  height: 36px;
  color: var(--whatsapp);
}

.device-details-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 15px;
  margin-top: 15px;
  text-align: left;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.detail-item .label {
  color: var(--text-muted);
}

/* Spinner Loader */
.spinner-loader {
  width: 40px;
  height: 40px;
  position: relative;
}

.double-bounce1, .double-bounce2 {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--secondary);
  opacity: 0.6;
  position: absolute;
  top: 0;
  left: 0;
  animation: sk-bounce 2.0s infinite ease-in-out;
}

.double-bounce2 {
  animation-delay: -1.0s;
  background-color: var(--primary);
}

@keyframes sk-bounce {
  0%, 100% { 
    transform: scale(0.0);
  } 50% { 
    transform: scale(1.0);
  }
}

/* QR Code Display Container */
.qr-container {
  display: flex;
  align-items: center;
  gap: 30px;
  width: 100%;
}

@media (max-width: 640px) {
  .qr-container {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }
}

/* Linking Options Tabs */
.linking-options {
  width: 100%;
}

.linking-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 4px;
}

.linking-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-speed);
}

.linking-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.linking-tab.active {
  color: white;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Phone Container Styles */
.phone-container {
  display: flex;
  gap: 30px;
  width: 100%;
  animation: tabFadeIn 0.3s ease-out forwards;
}

@media (max-width: 640px) {
  .phone-container {
    flex-direction: column;
    gap: 20px;
  }
}

.phone-link-form {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.phone-link-form h4, .phone-instructions h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.phone-link-form .description {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.phone-instructions {
  flex: 1;
}

.phone-instructions h4 {
  margin-bottom: 12px;
}

.phone-instructions ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.phone-instructions strong {
  color: var(--text-main);
}

/* Pairing Code Box */
.pairing-code-display {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 15px;
  margin-top: 10px;
  text-align: center;
  animation: tabFadeIn 0.3s ease-out forwards;
}

.pairing-code-display .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 8px;
}

.code-box-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.code-box {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--secondary);
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(6, 182, 212, 0.2);
  padding: 8px 24px;
  border-radius: 8px;
  flex-grow: 1;
  text-align: center;
}

.copy-code-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-speed);
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--panel-border-hover);
  color: white;
}

.expiry-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.qr-frame {
  position: relative;
  width: 180px;
  height: 180px;
  background: white;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Hologram Scanning Bar */
.scan-bar {
  position: absolute;
  width: calc(100% - 20px);
  height: 4px;
  background: linear-gradient(to right, rgba(34, 197, 94, 0), var(--whatsapp), rgba(34, 197, 94, 0));
  box-shadow: 0 0 10px var(--whatsapp);
  left: 10px;
  animation: scan 2.5s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { top: 10px; }
  50% { top: 166px; }
}

.qr-instructions {
  flex-grow: 1;
}

.qr-instructions h4 {
  font-size: 1.05rem;
  margin-bottom: 12px;
  color: var(--text-main);
  font-weight: 700;
}

.qr-instructions ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.qr-instructions strong {
  color: var(--text-main);
}

/* Stats Layout */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  height: 100%;
}

.stat-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition-speed);
}

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

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-icon.sent { background: rgba(6, 182, 212, 0.1); color: var(--secondary); }
.stat-icon.received { background: rgba(124, 58, 237, 0.1); color: var(--primary); }
.stat-icon.automated { background: rgba(34, 197, 94, 0.1); color: var(--whatsapp); }
.stat-icon.active-time { background: rgba(255, 255, 255, 0.05); color: var(--text-main); }

.stat-number {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

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

/* Terminal Console Log Styles */
.full-width-card {
  width: 100%;
}

.terminal-body {
  background: rgba(5, 4, 8, 0.95);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 15px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.825rem;
  line-height: 1.6;
  overflow-y: auto;
  color: #c9d1d9;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.terminal-body.compact {
  height: 200px;
}

.terminal-body.full-height {
  height: calc(100vh - 230px);
}

.log-row {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  padding-bottom: 4px;
}

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

.log-time {
  color: var(--text-dark);
  flex-shrink: 0;
  user-select: none;
}

.log-badge {
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  width: 75px;
}

.log-message {
  white-space: pre-wrap;
  word-break: break-all;
}

/* Log Color Coding */
.log-row.system .log-badge { color: var(--secondary); }
.log-row.system { background: rgba(6, 182, 212, 0.02); }

.log-row.whatsapp .log-badge { color: var(--primary-hover); }
.log-row.whatsapp { background: rgba(139, 92, 246, 0.02); }

.log-row.receive .log-badge { color: var(--whatsapp); }
.log-row.receive { background: rgba(34, 197, 94, 0.02); }

.log-row.send .log-badge { color: #d8b4fe; }
.log-row.send { background: rgba(216, 180, 254, 0.02); }

.log-row.error .log-badge { color: var(--danger); }
.log-row.error { background: rgba(244, 63, 94, 0.03); color: #fecdd3; }

/* AUTO-RESPONDERS TAB */
.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.search-box {
  position: relative;
  flex-grow: 1;
  max-width: 400px;
}

.search-box i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

.search-box input {
  width: 100%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 15px 12px 45px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--transition-speed);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Button UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-speed);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--panel-border-hover);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #e11d48);
  color: white;
  box-shadow: 0 4px 15px var(--danger-glow);
}

.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.4);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1rem;
}

/* Rules Grid Cards */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.rule-card {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.rule-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.trigger-tag {
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.2);
  color: #c084fc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-action {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-speed);
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.btn-action.delete:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.2);
  color: var(--danger);
}

.rule-match-pill {
  font-size: 0.725rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.rule-reply-preview {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--panel-border);
  padding: 12px;
  border-radius: 10px;
  flex-grow: 1;
  white-space: pre-wrap;
  max-height: 120px;
  overflow-y: auto;
}

.rule-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

/* iOS Toggle Slider */
.toggle-container {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-container input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-slider {
  width: 44px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  position: relative;
  transition: all var(--transition-speed);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: white;
  top: 3px;
  left: 3px;
  transition: all var(--transition-speed);
}

.toggle-container input:checked + .toggle-slider {
  background-color: var(--whatsapp);
  box-shadow: 0 0 8px var(--whatsapp-glow);
}

.toggle-container input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Form Styles */
.sleek-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-icon i,
.input-with-icon svg.lucide,
.input-with-icon > svg {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
  z-index: 2;
}

.input-with-icon input {
  width: 100%;
  padding-left: 45px !important;
  box-sizing: border-box;
}

.input-with-icon.has-toggle input {
  padding-right: 44px !important;
}

.password-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 6px;
  transition: color var(--transition-speed), background var(--transition-speed);
  z-index: 5;
}

.password-toggle-btn:hover {
  color: var(--text-main);
  background: rgba(125, 125, 125, 0.12);
}

.password-toggle-btn i,
.password-toggle-btn svg {
  position: static !important;
  transform: none !important;
  width: 18px;
  height: 18px;
  pointer-events: auto !important;
}

.sleek-form input[type="text"],
.sleek-form input[type="password"],
.sleek-form input[type="number"],
.sleek-form input[type="email"],
.sleek-form textarea,
.sleek-form select {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 15px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-speed);
}

.sleek-form input[type="text"]:focus,
.sleek-form input[type="password"]:focus,
.sleek-form input[type="number"]:focus,
.sleek-form input[type="email"]:focus,
.sleek-form textarea:focus,
.sleek-form select:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.sleek-form input::placeholder,
.sleek-form textarea::placeholder {
  color: var(--text-muted);
}

.input-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* MANUAL MESSENGER TAB */
.messenger-container {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 25px;
}

@media (max-width: 900px) {
  .messenger-container {
    grid-template-columns: 1fr;
  }
}

.type-selectors {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.type-selector {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition-speed);
  background: rgba(255, 255, 255, 0.01);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.type-selector input {
  display: none;
}

.type-selector:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
}

.type-selector.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(6, 182, 212, 0.04));
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.1);
}

.type-selector i {
  width: 18px;
  height: 18px;
}

/* Dropzone Styles */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 30px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.01);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-speed);
}

.dropzone:hover {
  border-color: var(--secondary);
  background: rgba(6, 182, 212, 0.02);
}

.hidden-input {
  display: none;
}

.dropzone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  color: var(--text-muted);
  transition: color var(--transition-speed);
}

.dropzone:hover .dropzone-icon {
  color: var(--secondary);
}

.dropzone-prompt p {
  font-size: 0.9rem;
  color: var(--text-main);
}

.dropzone-prompt p span {
  color: var(--secondary);
  font-weight: 600;
  text-decoration: underline;
}

.file-limits {
  font-size: 0.725rem;
  color: var(--text-muted);
}

.dropzone-file-preview {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  padding: 12px 18px;
  border-radius: 10px;
  text-align: left;
}

.preview-file-icon {
  width: 32px;
  height: 32px;
  color: var(--secondary);
}

.preview-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.preview-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 220px;
}

.preview-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-clear-file {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-speed);
}

.btn-clear-file:hover {
  color: var(--danger);
}

/* Instructions card on messenger */
.instructions-card {
  height: max-content;
}

.instructions-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.step-guide {
  display: flex;
  gap: 15px;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--secondary);
}

.step-text h5 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* SYSTEM LOGS TAB */
.console-card {
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(10, 8, 18, 0.7);
  border-bottom: 1px solid var(--panel-border);
}

.console-actions {
  display: flex;
  gap: 8px;
}

.filter-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.filter-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.03);
}

.filter-btn.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: white;
}

/* MODAL STYLING */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 4, 8, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-speed) ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  transform: scale(0.9);
  transition: transform var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.12);
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h3 {
  font-size: 1.25rem;
  letter-spacing: -0.4px;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

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

.row-group {
  margin: 5px 0;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  max-width: 350px;
}

.toast {
  background: rgba(10, 8, 18, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-left: 4px solid var(--primary);
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
  color: white;
  padding: 14px 20px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast.success { border-left-color: var(--whatsapp); }
.toast.info { border-left-color: var(--secondary); }
.toast.error { border-left-color: var(--danger); }

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

.toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--whatsapp); }
.toast.info .toast-icon { color: var(--secondary); }
.toast.error .toast-icon { color: var(--danger); }

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

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   MOBILE & RESPONSIVE DESIGN STYLES
   ========================================================================== */

/* Mobile-only toggle buttons */
.hamburger-btn {
  display: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--panel-border-hover);
}

.mobile-only-btn {
  display: none;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 4, 8, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* RESPONSIVE BREAKPOINT: Tablet & Mobile (<= 768px) */
@media (max-width: 768px) {
  /* Toggle buttons visibility */
  .hamburger-btn {
    display: flex;
  }

  .mobile-only-btn {
    display: flex;
    margin-left: auto;
  }

  /* Structural Overhauls */
  .app-container {
    flex-direction: column;
  }

  /* Sticky Header on mobile */
  .content-header {
    background: rgba(6, 5, 11, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--panel-border);
    margin-bottom: 25px;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    margin-left: -40px;
    margin-right: -40px;
    margin-top: -40px;
    z-index: 90;
    gap: 15px;
  }

  .content-area {
    padding: 20px 20px 40px 20px;
    height: auto;
    min-height: calc(100vh - 74px);
    overflow-y: visible;
  }

  /* Slide-out mobile drawer */
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 1000;
    background: rgba(10, 8, 18, 0.96);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.active {
    transform: translateX(280px);
  }

  .sidebar-brand {
    margin-bottom: 30px;
  }

  /* Grid Adjustments */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .messenger-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* QR Code Responsive adjustments */
  .qr-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }

  .qr-instructions ol {
    text-align: left;
    max-width: 320px;
    margin: 0 auto;
  }

  /* Rules list adjustments */
  .actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .search-box {
    max-width: 100%;
  }

  .btn {
    width: 100%;
  }

  .rules-grid {
    grid-template-columns: 1fr;
  }

  /* Logs console responsiveness */
  .console-header {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .console-actions {
    flex-wrap: wrap;
    justify-content: center;
  }

  .filter-btn {
    flex-grow: 1;
    text-align: center;
  }

  .terminal-body.full-height {
    height: calc(100vh - 350px);
  }

  /* Modal responsiveness */
  .modal-content {
    width: 92%;
    margin: 20px auto;
    padding: 20px;
  }

  .modal-actions {
    flex-direction: column;
    gap: 10px;
  }

  .modal-actions .btn {
    width: 100%;
  }
}

/* RESPONSIVE BREAKPOINT: Very Small Mobile (<= 480px) */
@media (max-width: 480px) {
  .content-header {
    margin-left: -20px;
    margin-right: -20px;
    margin-top: -20px;
    padding: 12px 15px;
    gap: 10px;
  }

  .header-title h1 {
    font-size: 1.4rem;
  }

  .header-title p {
    font-size: 0.8rem;
  }

  .connection-status-badge {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .stat-box {
    padding: 15px;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    justify-content: flex-start;
  }

  .stat-icon {
    margin-bottom: 0;
  }

  .stat-number {
    font-size: 1.4rem;
    margin-bottom: 0;
  }

  .terminal-body {
    font-size: 0.75rem;
    padding: 10px 15px;
  }

  .type-selectors {
    grid-template-columns: 1fr;
  }

  .dropzone {
    padding: 20px 10px;
  }
}

/* ==========================================================================
   AUTHENTICATION PORTAL AND CARDS STYLES
   ========================================================================== */
.auth-portal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 5, 11, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.auth-portal.active {
  display: flex;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 35px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: authCardFade 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.auth-card .form-group {
  text-align: left;
}

.auth-card .form-group label {
  text-align: left;
  display: block;
}

@keyframes authCardFade {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-header {
  margin-bottom: 30px;
}

.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px auto;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.auth-logo i {
  color: white;
  width: 28px;
  height: 28px;
}

.auth-header h2 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  background: linear-gradient(to right, #ffffff, #d8b4fe);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.auth-footer {
  margin-top: 25px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-footer span {
  color: var(--secondary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  transition: color var(--transition-speed);
}

.auth-footer span:hover {
  color: var(--primary-hover);
}

/* ==========================================================================
   SLEEK ADMIN TABLE & ROLE BADGES STYLES
   ========================================================================== */
.sleek-table {
  width: 100%;
  border-collapse: collapse;
}

.sleek-table tr {
  border-bottom: 1px solid var(--panel-border);
  transition: background-color var(--transition-speed);
}

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

.sleek-table th, 
.sleek-table td {
  padding: 16px 20px;
  font-size: 0.9rem;
}

.sleek-table th {
  font-weight: 600;
  color: var(--text-muted);
}

.sleek-table td {
  color: var(--text-light);
  vertical-align: middle;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.admin {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.role-badge.user {
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

/* ==========================================================================
   DYNAMIC HEADER BOT INSTANCE SELECTOR STYLES
   ========================================================================== */
.bot-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  padding: 6px 14px;
  border-radius: 12px;
  transition: all var(--transition-speed);
}

.bot-selector-wrapper:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.bot-selector-wrapper .selector-icon {
  width: 16px;
  height: 16px;
  color: var(--secondary);
}

.sleek-select {
  background: transparent;
  border: none;
  color: var(--text-light);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  padding-right: 10px;
}

.sleek-select option {
  background: #0f172a;
  color: var(--text-light);
  font-weight: 500;
}
