:root {
  --bg-color: #0b0f19;
  --panel-bg: rgba(17, 24, 39, 0.75);
  --panel-border: rgba(255, 255, 255, 0.07);
  --panel-border-hover: rgba(255, 255, 255, 0.15);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-color: #10b981; /* WhatsApp Emerald */
  --accent-hover: #059669;
  --accent-glow: rgba(16, 185, 129, 0.25);
  
  --primary-btn: #4f46e5; /* Indigo */
  --primary-btn-hover: #4338ca;
  --primary-btn-glow: rgba(79, 70, 229, 0.25);

  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --danger-glow: rgba(239, 68, 68, 0.25);

  /* Status Colors */
  --status-ready-bg: rgba(16, 185, 129, 0.12);
  --status-ready-text: #34d399;
  --status-ready-border: rgba(16, 185, 129, 0.3);
  
  --status-qr-bg: rgba(245, 158, 11, 0.12);
  --status-qr-text: #fbbf24;
  --status-qr-border: rgba(245, 158, 11, 0.3);
  
  --status-info-bg: rgba(59, 130, 246, 0.12);
  --status-info-text: #60a5fa;
  --status-info-border: rgba(59, 130, 246, 0.3);
  
  --status-error-bg: rgba(239, 68, 68, 0.12);
  --status-error-text: #f87171;
  --status-error-border: rgba(239, 68, 68, 0.3);

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* Base resets & styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* Background Ambient Glows */
.bg-glow-1 {
  position: fixed;
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vh;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, rgba(0, 0, 0, 0) 70%);
  z-index: -1;
  pointer-events: none;
}

.bg-glow-2 {
  position: fixed;
  bottom: -10%;
  right: -10%;
  width: 50vw;
  height: 50vh;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.08) 0%, rgba(0, 0, 0, 0) 70%);
  z-index: -1;
  pointer-events: none;
}

.app-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--panel-border);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  background: linear-gradient(135deg, var(--accent-color) 0%, #3b82f6 100%);
  color: white;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.logo-icon i {
  width: 24px;
  height: 24px;
}

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.logo-text span {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-stats {
  display: flex;
  gap: 1rem;
}

.stat-badge {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.stat-dot.green {
  background-color: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-color);
}

.stat-dot.grey {
  background-color: var(--text-muted);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stat-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2rem;
  align-items: start;
}

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

/* Sections */
.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-header h2 i {
  color: var(--accent-color);
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Sessions Grid & Cards */
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.session-card {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px;
  transition: var(--transition-smooth);
}

.session-card:hover {
  border-color: var(--panel-border-hover);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.session-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.session-card-header h4 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.status-tag.ready {
  background: var(--status-ready-bg);
  color: var(--status-ready-text);
  border: 1px solid var(--status-ready-border);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.05);
}

.status-tag.qr {
  background: var(--status-qr-bg);
  color: var(--status-qr-text);
  border: 1px solid var(--status-qr-border);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.05);
}

.status-tag.initializing,
.status-tag.connecting {
  background: var(--status-info-bg);
  color: var(--status-info-text);
  border: 1px solid var(--status-info-border);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.05);
}

.status-tag.disconnected,
.status-tag.error {
  background: var(--status-error-bg);
  color: var(--status-error-text);
  border: 1px solid var(--status-error-border);
}

/* QR Code & Status Container in Card */
.session-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  margin: 1rem 0;
  position: relative;
  min-height: 160px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.05);
  padding: 1rem;
}

.qr-code-img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  background: #white;
  padding: 8px;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  animation: fadeIn 0.4s ease;
}

.session-ready-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--accent-color);
  gap: 0.5rem;
  text-align: center;
}

.session-ready-state i {
  width: 48px;
  height: 48px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.session-ready-state p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.session-status-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.session-error-state {
  color: var(--danger-color);
  font-size: 0.8rem;
  text-align: center;
  padding: 0 0.5rem;
}

.session-card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.75rem;
}

/* Control Panel (Sidebar) Cards */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel-card {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.card-header {
  margin-bottom: 1.25rem;
}

.card-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header h3 i {
  color: var(--text-secondary);
}

.card-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Forms */
.card-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input, 
.form-group select, 
.form-group textarea {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  width: 100%;
  outline: none;
  transition: var(--transition-smooth);
}

.form-group select {
  cursor: pointer;
}

.form-group select option {
  background-color: var(--bg-color);
  color: var(--text-primary);
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
  border-color: var(--primary-btn);
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.15);
  background: rgba(0, 0, 0, 0.35);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 100%;
}

.btn-primary {
  background: var(--primary-btn);
  color: white;
  box-shadow: 0 4px 12px var(--primary-btn-glow);
}

.btn-primary:hover {
  background: var(--primary-btn-hover);
  box-shadow: 0 4px 18px var(--primary-btn-glow);
}

.btn-accent {
  background: var(--accent-color);
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-accent:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 18px var(--accent-glow);
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger-color);
  border: 1px solid rgba(239, 68, 68, 0.2);
  width: auto;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger-color);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* Empty State / Loading State */
.loading-full, .empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  background: var(--panel-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-border);
  text-align: center;
  min-height: 250px;
}

.empty-state i {
  color: var(--text-muted);
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 380px;
}

/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-btn);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

.spinner.accent {
  border-top-color: var(--accent-color);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1000;
  max-width: 350px;
}

.toast {
  background: rgba(17, 24, 39, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  padding: 1rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.toast.success i {
  color: var(--accent-color);
}

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

.toast.error i {
  color: var(--danger-color);
}

.toast-content h5 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
}

.toast-content p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

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