/* ==============================================================================
   🎬 SyncStream Enterprise Super Admin Console CSS
   Futuristic Cyber Dark Theme with Glassmorphism and Neon Accents
   ============================================================================== */

:root {
  --bg-base: #07080c;
  --bg-card: rgba(18, 21, 33, 0.75);
  --bg-elevated: rgba(28, 33, 52, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(54, 80, 253, 0.4);
  
  --accent-primary: #3650fd;
  --accent-glow: rgba(54, 80, 253, 0.35);
  --color-green: #22c55e;
  --color-amber: #f59e0b;
  --color-red: #ef4444;
  --color-purple: #a855f7;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Vazirmatn', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-family);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.6;
}

/* Ambient Background Glow */
.admin-bg-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(circle, rgba(54, 80, 253, 0.12) 0%, rgba(168, 85, 247, 0.05) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* --------------------------------------------------------------------------
   LOGIN OVERLAY CARD
   -------------------------------------------------------------------------- */
.admin-login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 8, 12, 0.94);
  backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 32px var(--accent-glow);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  text-align: center;
}

.shield-badge {
  font-size: 42px;
  margin-bottom: 12px;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.login-form {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Input Styles */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.input-group input,
.input-group select,
.input-group textarea,
.search-input,
.filter-select,
.input-control {
  background: rgba(10, 13, 22, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus,
.search-input:focus,
.filter-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #2539c8 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent {
  background: rgba(54, 80, 253, 0.15);
  border: 1px solid var(--accent-primary);
  color: #ffffff;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.btn-danger-sm {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-danger-sm:hover {
  background: #ef4444;
  color: #ffffff;
}

.error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   LAYOUT: TOPBAR & MAIN CONTAINER
   -------------------------------------------------------------------------- */
.admin-layout {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  height: 64px;
  background: rgba(14, 17, 26, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-shield {
  font-size: 26px;
}

.brand-text h2 {
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-enterprise {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
}

.server-status-pill {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-green);
  box-shadow: 0 0 8px var(--color-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.live-clock {
  font-family: monospace;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.admin-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.role-chip {
  background: rgba(54, 80, 253, 0.25);
  color: #93c5fd;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

/* --------------------------------------------------------------------------
   BODY & SIDEBAR
   -------------------------------------------------------------------------- */
.admin-body {
  display: flex;
  flex: 1;
}

.admin-sidebar {
  width: 240px;
  background: rgba(12, 15, 23, 0.65);
  border-left: 1px solid var(--border-subtle);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  text-align: right;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.2s;
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(54, 80, 253, 0.15);
  color: #ffffff;
  border-right: 3px solid var(--accent-primary);
}

.pill-count {
  margin-right: auto;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.badge-warning {
  margin-right: auto;
  background: var(--color-amber);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

/* --------------------------------------------------------------------------
   MAIN CONTENT TABS
   -------------------------------------------------------------------------- */
.admin-content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
  max-width: 1400px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

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

.section-header h3 {
  font-size: 20px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   TAB 1: METRICS GRID & PANELS
   -------------------------------------------------------------------------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.glow-blue { background: rgba(54, 80, 253, 0.15); color: #3650fd; border: 1px solid rgba(54, 80, 253, 0.3); }
.glow-purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.3); }
.glow-green { background: rgba(34, 197, 94, 0.15); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); }
.glow-amber { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }

.metric-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.metric-subtitle {
  font-size: 11px;
  color: var(--text-dim);
}

.text-green { color: var(--color-green); font-weight: 700; }
.text-danger { color: var(--color-red); }

.dashboard-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.panel-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
}

.flex-1 { flex: 1; min-width: 300px; }

.panel-header {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-header h4 {
  font-size: 15px;
  font-weight: 700;
}

.lead-channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.lead-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 12px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.lead-chip-channel {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.lead-chip-count {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
}

.server-specs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

/* --------------------------------------------------------------------------
   TAB 2: CONTROLS & KILL-SWITCHES
   -------------------------------------------------------------------------- */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 800px;
}

.switch-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.switch-card.danger-zone {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.04);
}

.switch-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.switch-desc {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.3s;
  border-radius: var(--radius-pill);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--color-green);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
}

.toggle-switch input:checked + .toggle-slider.danger {
  background-color: var(--color-red);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

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

.form-actions {
  margin-top: 10px;
}

/* --------------------------------------------------------------------------
   TAB 3: DATA TABLES (USERS & AUDIT)
   -------------------------------------------------------------------------- */
.crm-filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 220px;
}

.table-responsive {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 13px;
}

.data-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 16px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.text-center { text-align: center; }

/* Status Badges */
.badge-status {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
}

.badge-status.active { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-status.banned { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-status.suspended { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }

.badge-role {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
}

.badge-role.super_admin { background: #ef4444; color: #fff; }
.badge-role.admin { background: #3650fd; color: #fff; }
.badge-role.user { background: rgba(255, 255, 255, 0.1); color: var(--text-muted); }

.table-actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}

.btn-icon:hover {
  background: var(--accent-primary);
  color: #fff;
}

/* --------------------------------------------------------------------------
   TAB 4: ROOM CARDS
   -------------------------------------------------------------------------- */
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.room-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.room-name {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.room-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.room-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* --------------------------------------------------------------------------
   TAB 5: BROADCAST LAYOUT
   -------------------------------------------------------------------------- */
.broadcast-layout {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.broadcast-form {
  flex: 1.2;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.broadcast-preview {
  flex: 1;
  min-width: 280px;
}

.form-row {
  display: flex;
  gap: 14px;
}

.announcement-banner-preview {
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid;
  transition: all 0.3s ease;
}

.announcement-banner-preview.info { background: rgba(54, 80, 253, 0.15); border-color: rgba(54, 80, 253, 0.4); color: #93c5fd; }
.announcement-banner-preview.warning { background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.4); color: #fde68a; }
.announcement-banner-preview.danger { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.announcement-banner-preview.success { background: rgba(34, 197, 94, 0.15); border-color: rgba(34, 197, 94, 0.4); color: #86efac; }

.banner-icon { font-size: 20px; flex-shrink: 0; }
.banner-body strong { display: block; font-size: 14px; margin-bottom: 4px; color: #fff; }
.banner-body p { font-size: 13px; opacity: 0.9; }

/* --------------------------------------------------------------------------
   MODALS
   -------------------------------------------------------------------------- */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.8);
  width: 100%;
  max-width: 650px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.admin-modal-card.modal-sm { max-width: 440px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: rgba(20, 24, 38, 0.95);
  border: 1px solid var(--border-subtle);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease-out;
}

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

.toast.success { border-color: var(--color-green); }
.toast.error { border-color: var(--color-red); }
