@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --bg-dark: #0f172a;
  --bg-panel: #1e293b;
  --bg-card: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --primary: #10b981; /* WhatsApp Green */
  --primary-hover: #059669;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Glassmorphism */
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);

  --sidebar-width: 260px;
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  padding: 0; /* Changed to handle header/menu separately */
  z-index: 100;
  height: 100vh;
  overflow-y: auto; /* Enable vertical scrollbar inside sidebar */
}

.sidebar-header {
  padding: 30px 24px 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.logo i {
  color: var(--primary);
  font-size: 1.6rem;
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.4));
}

#user-profile-info {
  margin-top: 25px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

#user-initial {
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%) !important;
}

#user-display-name {
  color: var(--text-main);
  letter-spacing: 0.2px;
}

#user-display-role {
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 2px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px;
  flex: 1;
}

.nav-link, .nav-link-static {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-link:hover, .nav-link-static:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  transform: translateX(4px);
}

.nav-link.active {
  background: rgba(16, 185, 129, 0.08);
  color: var(--primary);
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.15);
  box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.1);
}

.nav-link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  opacity: 0.8;
}

.nav-link.active i {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.5));
}

/* ─── MAIN CONTENT ─── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 32px 40px;
}

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

.header h1 {
  font-size: 1.8rem;
  font-weight: 600;
}

/* ─── VIEWS ─── */
.view-section {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.view-section.active {
  display: block;
}

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

/* ─── CARDS & STATS ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.03);
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-title {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ─── TABLES ─── */
.table-container {
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  overflow-x: auto; /* Enable horizontal scroll if table is too wide */
  box-shadow: var(--glass-shadow);
  width: 100%;
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 600px; /* Prevent header content from squishing */
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px; /* Ensure table doesn't get too squeezed */
}

th, td {
  padding: 12px 16px; /* Reduced padding for better fit */
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap; /* Prevent text wrapping by default */
}

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
}

/* Allow message content to wrap or truncate */
.cell-message {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions-cell {
  width: 130px;
  min-width: 130px;
  text-align: right;
}

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

/* ─── EMPTY STATES ─── */
.empty-state-card {
  max-width: 500px;
  margin: 60px auto;
  padding: 60px 40px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  backdrop-filter: blur(15px);
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.empty-state-icon {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 30px;
  font-size: 3rem;
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.1);
}

.empty-state-card h3 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.empty-state-card p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 32px;
}

.empty-state-card .btn-primary {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
}

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

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

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

.btn-nuclear {
  background: linear-gradient(135deg, #ef4444 0%, #991b1b 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-nuclear:hover {
  background: linear-gradient(135deg, #f87171 0%, #b91c1c 100%);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
  transform: translateY(-2px);
  color: white;
}

.btn-nuclear i {
  animation: nuclear-pulse 2s infinite;
}

@keyframes nuclear-pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

/* ─── BADGES ─── */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.active, .badge.connected, .badge.sent {
  background: rgba(16, 185, 129, 0.1);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.disconnected, .badge.failed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge.pending, .badge.queued, .badge.qr, .badge.connecting {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge.banned {
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ─── ACTION BUTTONS ─── */
.btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
}

.btn-icon:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-icon.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-icon.info:hover {
  background: var(--info);
  border-color: var(--info);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.status-badge.sent { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
.status-badge.delivered { background: rgba(59, 130, 246, 0.1); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.2); }
.status-badge.read { background: rgba(52, 183, 241, 0.1); color: #34b7f1; border: 1px solid rgba(52, 183, 241, 0.2); }
.status-badge.failed { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.status-badge.received { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; border: 1px solid rgba(139, 92, 246, 0.2); }

/* ─── FORMS & MODALS ─── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

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

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 500px;
  padding: 32px;
  transform: translateY(20px);
  transition: var(--transition);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

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

.modal-header h2 {
  font-size: 1.4rem;
}

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

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

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* ─── QR CODE CONTAINER ─── */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: white;
  border-radius: 12px;
  margin: 20px 0;
}
.qr-container img {
  max-width: 250px;
  width: 100%;
  border-radius: 8px;
}
.qr-placeholder {
  width: 250px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #64748b;
  border-radius: 8px;
}

/* ─── UTILS ─── */
.text-center { text-align: center; }
.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }
.flex-row { display: flex; gap: 12px; }
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }

/* LIVE CHAT UI */
.chat-container {
  display: flex;
  height: calc(100vh - 160px);
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  margin-top: 20px;
}
/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.chat-sidebar {
  width: 300px;
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.02);
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-outline:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.chat-sidebar-list {
  flex: 1;
  overflow-y: auto;
}
.chat-sidebar-item {
  padding: 15px;
  border-bottom: 1px solid var(--glass-border);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.chat-sidebar-item:hover, .chat-sidebar-item.active {
  background: rgba(255, 255, 255, 0.05);
}
.chat-sidebar-item .phone {
  font-weight: 500;
  color: var(--text-main);
}
.chat-sidebar-item .preview {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-dark);
}
.empty-chat {
  justify-content: center;
  align-items: center;
}
.chat-header {
  padding: 15px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--glass-border);
}
.chat-history {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0; /* Penting untuk scroll dalam flexbox */
  background: rgba(0, 0, 0, 0.1);
}
.chat-bubble {
  max-width: 70%;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
}
.chat-bubble.incoming {
  background: var(--bg-panel);
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}
.chat-bubble.outgoing {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}
.chat-time {
  font-size: 0.7rem;
  opacity: 0.7;
  display: block;
  text-align: right;
  margin-top: 5px;
}
.chat-bubble:hover .fa-trash-can {
  opacity: 0.6 !important;
}

.chat-bubble .fa-trash-can:hover {
  opacity: 1 !important;
  color: var(--danger);
}

.chat-input-area {
  padding: 15px;
  background: var(--bg-panel);
  border-top: 1px solid var(--glass-border);
}
/* Sync Overlay */
.sync-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.sync-card {
  background: var(--bg-panel);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  max-width: 400px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.sync-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* SESSIONS GRID & CARDS */
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.session-card {
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.session-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: var(--glass-shadow);
}

.session-card .status-indicator {
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
}

.session-card.active .status-indicator { background: var(--success); }
.session-card.disconnected .status-indicator { background: var(--danger); }
.session-card.connecting .status-indicator { background: var(--warning); }

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

.session-info h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-main);
}

.session-info p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.session-stats {
  display: flex;
  gap: 15px;
  padding: 12px 0;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}

.session-stat-item {
  flex: 1;
}

.session-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.session-stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.session-actions {
  display: flex;
  gap: 10px;
  margin-top: 5px;
}

.session-actions .btn {
  flex: 1;
}

/* SMALL TOGGLE SWITCH */
.switch-sm {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}
.switch-sm input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider-sm {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-dark);
  transition: .4s;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
}
.slider-sm:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider-sm {
  background-color: var(--primary);
}
input:checked + .slider-sm:before {
  transform: translateX(14px);
}

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

.toast {
  min-width: 300px;
  max-width: 400px;
  padding: 16px 20px;
  border-radius: 12px;
  background: rgba(23, 23, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: white;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transition: all 0.3s ease;
}

.toast.hiding {
  opacity: 0;
  transform: translateX(100%);
}

.toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.toast-content {
  flex-grow: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.85rem;
  opacity: 0.8;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.success .toast-icon { color: var(--success); }

.toast.error { border-left: 4px solid var(--danger); }
.toast.error .toast-icon { color: var(--danger); }

.toast.info { border-left: 4px solid var(--info); }
.toast.info .toast-icon { color: var(--info); }

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

/* Status Actions */
.status-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon.mini {
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon.warning {
  background: rgba(255, 193, 7, 0.1);
  color: #ffc107;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.btn-icon.warning:hover {
  background: #ffc107;
  color: #000;
}

/* ─── ADDITIONAL BUTTON STYLES ─── */
.btn-warning {
  background: var(--warning);
  color: #000;
  border: none;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
}

.btn-warning:hover {
  background: #d97706; /* Darker amber */
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-outline-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
}

.btn-outline-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ─── SWITCH TOGGLE ─── */
.switch-small {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}
.switch-small input { opacity: 0; width: 0; height: 0; }
.slider-small {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border-radius: 20px;
}
.slider-small:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider-small { background-color: var(--primary); }
input:checked + .slider-small:before { transform: translateX(14px); }

/* ─── CAMPAIGN CARDS ─── */
.campaign-card {
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.campaign-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: var(--glass-shadow);
}

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

.campaign-card-title h3 {
  font-size: 1.1rem;
  margin-bottom: 4px;
  color: var(--text-main);
}

.campaign-progress-container {
  margin: 10px 0;
}

.campaign-progress-bar {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.campaign-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #3b82f6 100%);
  transition: width 0.5s ease;
}

.campaign-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.campaign-stat-item {
  text-align: center;
}

.campaign-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.campaign-stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.campaign-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* ─── TOGGLE SIDEBAR BUTTON (MOBILE) ─── */
.sidebar-toggle-btn {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  width: 44px;
  height: 44px;
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-main);
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 10001; /* Very high z-index to stay on top of main content */
  pointer-events: auto; /* Ensure it is clickable */
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
}

.sidebar-toggle-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ─── RESPONSIVE DESIGN ─── */
@media (max-width: 992px) {
  .sidebar-toggle-btn {
    display: flex;
  }
  
  .sidebar {
    position: fixed;
    left: -260px; /* Hidden offscreen on left */
    top: 0;
    bottom: 0;
    height: 100vh;
    width: 260px;
    z-index: 10002; /* Higher than toggle button to overlay it when opened */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    border-right: 1px solid var(--glass-border);
  }
  
  .sidebar.open {
    left: 0; /* Slide in */
  }
  
  .sidebar-header {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .sidebar-close-btn {
    display: block !important;
  }

  .nav-menu {
    flex-direction: column;
    padding: 10px 16px;
    overflow-y: visible;
  }

  .nav-link, .nav-link-static {
    padding: 12px 16px;
    white-space: normal;
    font-size: 0.95rem;
  }

  .main-content {
    padding: 80px 20px 30px; /* Space on top for toggle button */
    overflow-y: auto;
    width: 100%;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .header > div, .header > button, .header > input {
    width: 100%;
  }

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

  .chat-container {
    flex-direction: column;
    height: 600px;
  }

  .chat-sidebar {
    width: 100%;
    height: 150px;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
  }

  .modal {
    padding: 20px;
    margin: 10px;
    max-height: 90vh;
    overflow-y: auto;
  }
}
