/* ===== WATI-LIKE SAAS UPGRADES CSS v70 ===== */

/* ---- AI Toggle Switch ---- */
.ai-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #555;
  border-radius: 26px;
  transition: background 0.25s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
}
.toggle-switch input:checked + .toggle-slider { background: #25d366; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted, #aaa);
}
.toggle-label.on { color: #25d366; }
.toggle-label.off { color: #e05c5c; }

/* ---- Queue Status Badge (topbar) ---- */
#queueStatusBadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 1px solid rgba(37, 211, 102, 0.3);
  color: #25d366;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  animation: queuePulse 2s infinite;
}
#queueStatusBadge:hover {
  border-color: #25d366;
  background: rgba(37, 211, 102, 0.1);
}
#queueStatusBadge.empty {
  color: #888;
  border-color: rgba(255,255,255,0.1);
  animation: none;
}
@keyframes queuePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(37, 211, 102, 0); }
}

/* ---- Campaign Progress Bar ---- */
.campaign-progress-wrap {
  margin: 6px 0;
}
.campaign-progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  overflow: hidden;
}
.campaign-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #25d366, #128c7e);
  border-radius: 6px;
  transition: width 0.5s ease;
  min-width: 2px;
}
.campaign-progress-fill.failed { background: linear-gradient(90deg, #e05c5c, #c0392b); }
.campaign-progress-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted, #888);
  margin-top: 4px;
}
.campaign-progress-stats span { display: flex; align-items: center; gap: 3px; }
.campaign-progress-stats .stat-sent { color: #25d366; }
.campaign-progress-stats .stat-failed { color: #e05c5c; }
.campaign-progress-stats .stat-pending { color: #f39c12; }

/* ---- Duplicate Warning ---- */
.duplicate-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(243, 156, 18, 0.1);
  border: 1px solid rgba(243, 156, 18, 0.4);
  border-radius: 8px;
  font-size: 12px;
  color: #f39c12;
  margin-top: 4px;
  animation: fadeIn 0.2s ease;
}
.duplicate-warning a {
  color: #f39c12;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Block Button ---- */
.btn-block {
  background: rgba(224, 92, 92, 0.1);
  color: #e05c5c;
  border: 1px solid rgba(224, 92, 92, 0.3);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-block:hover { background: rgba(224, 92, 92, 0.2); border-color: #e05c5c; }
.btn-unblock {
  background: rgba(37, 211, 102, 0.1);
  color: #25d366;
  border: 1px solid rgba(37, 211, 102, 0.3);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-unblock:hover { background: rgba(37, 211, 102, 0.2); border-color: #25d366; }
.blocked-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(224, 92, 92, 0.15);
  color: #e05c5c;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(224, 92, 92, 0.3);
}

/* ---- Blocklist table ---- */
.blocklist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.blocklist-table th {
  text-align: left;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  color: #aaa;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.blocklist-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: middle;
}
.blocklist-table tr:hover td { background: rgba(255,255,255,0.03); }
.blocklist-table .empty-state { text-align: center; color: #666; padding: 32px; font-size: 13px; }

/* ---- Queue Monitor Panel ---- */
#queueMonitorPanel {
  background: linear-gradient(135deg, rgba(37,211,102,0.05), rgba(18,140,126,0.05));
  border: 1px solid rgba(37, 211, 102, 0.15);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}
#queueMonitorPanel h4 { margin: 0 0 12px; font-size: 13px; color: #25d366; }
.queue-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}
.queue-stat-card {
  text-align: center;
  padding: 12px 8px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
}
.queue-stat-card .qval { font-size: 22px; font-weight: 700; color: #fff; display: block; }
.queue-stat-card .qlabel { font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; display: block; }

/* ---- AI Status indicator in client list ---- */
.ai-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.ai-status-pill.on { background: rgba(37,211,102,0.15); color: #25d366; border: 1px solid rgba(37,211,102,0.3); }
.ai-status-pill.off { background: rgba(224,92,92,0.12); color: #e05c5c; border: 1px solid rgba(224,92,92,0.25); }

/* ---- Campaign analytics modal ---- */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.analytics-card {
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.07);
}
.analytics-card .aval { font-size: 24px; font-weight: 700; color: #fff; display: block; }
.analytics-card .alabel { font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 3px; display: block; }
.analytics-card.delivered .aval { color: #25d366; }
.analytics-card.read .aval { color: #53bdeb; }
.analytics-card.failed .aval { color: #e05c5c; }
.analytics-card.pending .aval { color: #f39c12; }

/* ---- Queue delay input ---- */
.queue-delay-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.queue-delay-row label { font-size: 13px; color: #aaa; min-width: 160px; }
.queue-delay-row input[type=range] { flex: 1; accent-color: #25d366; }
.queue-delay-row .delay-val { font-size: 13px; font-weight: 600; color: #25d366; min-width: 40px; text-align: right; }

/* ---- Modal overlay ---- */
.saas-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.saas-modal {
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.saas-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.saas-modal-header h3 { margin: 0; font-size: 16px; }
.saas-modal-close { background: none; border: none; color: #888; font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.saas-modal-close:hover { color: #fff; background: rgba(255,255,255,0.1); }
