/* CSS Reset & Variables */
:root {
  --font-family: 'Outfit', sans-serif;
  --bg-color: #0b0914;
  --card-bg: rgba(20, 16, 36, 0.65);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --accent-color: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.3);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --failure: #f43f5e;
  --failure-glow: rgba(244, 63, 94, 0.2);
  --warning: #fbbf24;
  --warning-glow: rgba(251, 191, 36, 0.2);
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Background Glowing Accents */
.glow-bg {
  position: absolute;
  top: -10%;
  left: 20%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.08) 50%, rgba(0,0,0,0) 70%);
  z-index: -1;
  pointer-events: none;
}

/* Header */
.app-header {
  padding: 2.5rem 2rem 1.5rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.header-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}

.logo-pulse {
  width: 14px;
  height: 14px;
  background-color: var(--accent-color);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 12px var(--accent-color);
}

.logo-pulse::after {
  content: '';
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border: 2px solid var(--accent-color);
  border-radius: 50%;
  animation: pulse-ring 2s infinite ease-out;
}

.app-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 300;
}

/* Layout Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem 2rem;
  flex: 1;
}

/* Card Component */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  padding: 1.8rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

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

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #fff;
}

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

/* Impersonation list */
.users-stack {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.user-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-smooth);
}

.user-item:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
}

.user-item.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.user-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.2rem;
}

.user-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.user-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.user-item.active .user-badge {
  background: var(--accent-color);
  color: #fff;
}

/* Main Content Area */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Batch Form */
.batch-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 1.2rem;
}

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
}

.form-group textarea {
  height: 90px;
  resize: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
}

/* Recipients Checkboxes Grid */
.recipients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
  background: rgba(0, 0, 0, 0.15);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.recipient-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.recipient-checkbox-label input {
  accent-color: var(--accent-color);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.8rem;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-color) 0%, #6366f1 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-icon {
  width: 16px;
  height: 16px;
  transition: var(--transition-smooth);
}

.btn-primary:hover .btn-icon {
  transform: translateX(4px);
}

/* Stream status header */
.stream-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-offline {
  background: rgba(244, 63, 94, 0.1);
  color: var(--failure);
  border-color: rgba(244, 63, 94, 0.2);
}

.status-connecting {
  background: rgba(251, 191, 36, 0.1);
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.2);
}

.status-online {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

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

.status-online .status-dot {
  animation: pulse-ring 1.5s infinite ease-out;
}

/* Notifications feed */
.notifications-feed {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.notifications-feed::-webkit-scrollbar {
  width: 6px;
}
.notifications-feed::-webkit-scrollbar-track {
  background: transparent;
}
.notifications-feed::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* Empty feed state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-secondary);
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 300px;
}

/* Notification Item Card */
.notification-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-left: 4px solid var(--accent-color);
  border-radius: 10px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: slide-up-fade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.notification-card.delivered {
  border-left-color: var(--success);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.03) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.notification-card.dead {
  border-left-color: var(--failure);
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.03) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.notification-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.notif-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.notif-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.notif-badge.delivered {
  background: var(--success-glow);
  color: #34d399;
}

.notif-badge.dead {
  background: var(--failure-glow);
  color: #fb7185;
}

.notif-message {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.notif-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  padding-top: 0.5rem;
}

.notif-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.notif-error {
  font-size: 0.8rem;
  color: #fda4af;
  background: rgba(244, 63, 94, 0.08);
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(244, 63, 94, 0.15);
}

/* Spinner helper */
.loading-spinner {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 1.5rem;
}

/* Footer */
.app-footer {
  padding: 2rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  max-width: 1400px;
  width: 100%;
  margin: 2rem auto 0;
}

/* Keyframes Animations */
@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.5);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(139, 92, 246, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
  }
}

@keyframes slide-up-fade {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive design */
@media (max-width: 960px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
