:root {
  --bg-admin: #080a11;
  --bg-panel: #101422;
  --bg-card: #161b2d;
  --bg-input: #0a0d17;
  --border-color: rgba(255, 255, 255, 0.09);
  --border-active: rgba(99, 102, 241, 0.4);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-indigo: #6366f1;
  --accent-indigo-light: #818cf8;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-granny: #ec4899;
  --accent-piper: #8b5cf6;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

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

body {
  background-color: var(--bg-admin);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Ambient glow */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
}

.glow-admin-top {
  width: 500px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
}

.glow-admin-bottom {
  width: 450px;
  height: 350px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, transparent 70%);
  bottom: -50px;
  right: -50px;
}

/* -------------------------------------------------------------
   ADMIN LOGIN MODAL (STUNNING MODERN GLASSMORPHISM)
------------------------------------------------------------- */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(14, 18, 30, 0.94) 0%, rgba(5, 7, 13, 0.98) 100%);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.admin-modal-card {
  background: linear-gradient(145deg, rgba(22, 27, 44, 0.85) 0%, rgba(13, 16, 28, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 44px 36px 36px;
  max-width: 460px;
  width: 100%;
  box-shadow: 
    0 30px 80px rgba(0, 0, 0, 0.9), 
    0 0 60px rgba(99, 102, 241, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  text-align: center;
  position: relative;
  animation: modalPop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.93) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.admin-lock-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 20px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.1) 100%);
  border: 1px solid rgba(129, 140, 248, 0.4);
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.35);
}

.lock-icon-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
  filter: blur(6px);
  z-index: 0;
}

.admin-lock-svg {
  position: relative;
  z-index: 1;
  color: #c7d2fe;
}

.brand-badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.admin-login-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 10px;
}

.admin-login-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 26px;
  padding: 0 10px;
}

.admin-login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group-login {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.form-group-login label {
  font-size: 0.82rem;
  font-weight: 500;
  color: #cbd5e1;
  margin-left: 2px;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-icon-wrapper input {
  width: 100%;
  background: rgba(8, 10, 18, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 13px 44px 13px 42px;
  color: #fff;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  transition: all 0.25s ease;
}

.input-icon-wrapper input:focus {
  outline: none;
  background: rgba(12, 15, 26, 0.95);
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), 0 0 20px rgba(99, 102, 241, 0.2);
}

.pass-toggle-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s;
}

.pass-toggle-btn:hover {
  color: #fff;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.btn-primary-admin {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 13px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 18px rgba(79, 70, 229, 0.4);
}

.btn-primary-admin:hover {
  background: linear-gradient(135deg, #7174f4 0%, #5a52eb 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.55);
}

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

.admin-login-footer {
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 16px;
}

/* -------------------------------------------------------------
   MAIN DASHBOARD STYLES
------------------------------------------------------------- */
.admin-header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
}

.logo-accent {
  color: #818cf8;
}

.badge-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-outline {
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.1);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-outline:hover {
  background: rgba(99, 102, 241, 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.2s;
}

.btn-secondary:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.dashboard-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.admin-main {
  padding: 28px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.metric-card.live-card {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, var(--bg-panel) 100%);
}

.metric-card.locked-card-alert {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, var(--bg-panel) 100%);
}

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

.metric-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.live-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 10px var(--accent-red);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 8px;
}

.metric-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tag-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.74rem;
  margin-right: 4px;
  margin-top: 4px;
}

.tag-granny {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.tag-piper {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.tag-locked {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 24px;
}

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

.panel-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.panel-header {
  margin-bottom: 20px;
}

.panel-header h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
}

.panel-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
}

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

.panel-divider {
  height: 1px;
  background: var(--border-color);
  margin: 24px 0 20px;
}

/* Form controls */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

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

.form-input,
.form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  transition: border-color 0.2s;
  width: 100%;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.font-mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.form-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
}

.form-hint code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.72rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7174f4 0%, #5a52eb 100%);
}

.save-msg {
  color: var(--accent-green);
  font-size: 0.82rem;
  font-weight: 500;
}

.btn-small {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.btn-unlock {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-unlock:hover {
  background: rgba(16, 185, 129, 0.3);
  color: #fff;
}

.btn-danger-small {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-danger-small:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Embed Preview */
.preview-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.preview-box h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.preview-aspect {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.preview-empty {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.preview-aspect iframe,
.preview-aspect video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Active Viewers List */
.active-viewers-container {
  min-height: 80px;
  margin-bottom: 10px;
}

.empty-state {
  text-align: center;
  padding: 24px 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

.active-cards-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.viewer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.viewer-card-meta {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.viewer-duration {
  font-size: 0.72rem;
  color: #10b981;
  font-family: var(--font-mono);
}

/* Activity & Locked Tables */
.table-scroll {
  max-height: 280px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.data-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 9px 12px;
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

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

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
