/* Super Admin Master Portal CSS */
:root {
  --bg: #090d16;
  --panel: #0f172a;
  --panel2: #1e293b;
  --panel-border: rgba(255, 255, 255, 0.08);
  --accent: #4f7cff;
  --accent-hover: #3a68ea;
  --accent-soft: rgba(79, 124, 255, 0.15);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.15);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.15);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Utilities */
.hidden { display: none !important; }
.error { color: var(--danger); font-size: 12px; margin-top: 6px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  background: var(--panel2);
  color: var(--text);
}
.btn:hover { background: #2d3d57; }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(79, 124, 255, 0.35);
}
.btn.primary:hover { background: var(--accent-hover); }

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

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

.btn.danger.ghost {
  background: var(--danger-soft);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}
.btn.danger.ghost:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge.active { background: var(--ok-soft); color: var(--ok); }
.badge.expired { background: var(--danger-soft); color: var(--danger); }
.badge.suspended { background: var(--warn-soft); color: var(--warn); }
.badge.in-session {
  background: rgba(79, 124, 255, 0.2);
  color: var(--accent);
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 124, 255, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(79, 124, 255, 0); }
}

/* Clean Enterprise Login View */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

.login-brand-header {
  margin-bottom: 2px;
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f8fafc;
  margin: 0;
}
.login-subtitle {
  font-size: 13px;
  color: #94a3b8;
  margin: 4px 0 0;
  line-height: 1.4;
}

.form-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field-group label {
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
}

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

.input-icon-wrap input {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #f8fafc;
  padding: 10px 38px 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-icon-wrap input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.pwd-toggle-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.pwd-toggle-btn:hover {
  opacity: 1;
}

/* Enterprise Primary Login Button */
.login-btn-primary {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.08s ease;
}
.login-btn-primary:hover {
  background: #1d4ed8;
}
.login-btn-primary:active {
  background: #1e40af;
  transform: scale(0.99);
}
.login-btn-primary:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none;
}

/* Spinner */
.btn-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  margin-right: 8px;
}

/* Error Banner */
.error-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: #fca5a5;
  line-height: 1.4;
}

/* Master Topbar */
.master-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  font-size: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.version-tag {
  font-size: 11px;
  color: var(--muted);
  background: var(--panel2);
  padding: 2px 6px;
  border-radius: 4px;
}

.topbar-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--panel2);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  font-size: 12px;
}
.metric-pill.active {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
}
.metric-num {
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}
.metric-pill.active .metric-num { color: var(--ok); }
.metric-lbl { color: var(--muted); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Content Area */
.master-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Sections */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title h2 {
  font-size: 18px;
  font-weight: 700;
}

.section-hint {
  font-size: 12px;
  color: var(--muted);
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background: var(--ok);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px var(--ok);
  animation: pulse-green 1.5s infinite;
}

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

/* Surveillance Grid */
.surveillance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.interview-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.interview-card:hover {
  transform: translateY(-2px);
  border-color: rgba(79, 124, 255, 0.4);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--panel-border);
}

.card-client-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.card-client-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.card-device-name {
  font-size: 11px;
  color: var(--muted);
}

.card-timer-badge {
  font-family: Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--ok);
}

.card-canvas-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--panel-border);
}
.card-actions button {
  flex: 1;
}

.empty-state {
  background: var(--panel);
  border: 1px dashed var(--panel-border);
  border-radius: 12px;
  padding: 36px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-icon { font-size: 32px; }
.empty-state h3 { font-size: 15px; font-weight: 700; }
.empty-state p { font-size: 13px; color: var(--muted); }

/* Clients Table */
.table-container {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  overflow-x: auto;
}

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

.clients-table th {
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--panel-border);
}

.clients-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--panel-border);
  vertical-align: middle;
}

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

.client-name-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.client-name-cell strong { font-size: 13px; color: #fff; }
.client-notes { font-size: 11px; color: var(--muted); }

.credentials-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: Consolas, monospace;
  font-size: 12px;
}
.cred-user { color: var(--accent-hover); }
.cred-pass { color: var(--muted); }

.countdown-cell {
  font-family: Consolas, monospace;
  font-weight: 700;
  font-size: 13px;
}
.countdown-cell.live { color: var(--ok); }
.countdown-cell.warning { color: var(--warn); }
.countdown-cell.expired { color: var(--danger); }

.actions-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.search-input {
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  outline: none;
  min-width: 280px;
}
.search-input:focus { border-color: var(--accent); }

/* Modals */
.master-modal {
  border: none;
  background: transparent;
  padding: 0;
  margin: auto;
  outline: none;
}
.master-modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-card {
  width: 540px;
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.modal-close-btn:hover { color: #fff; }

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.form-group input,
.form-select {
  padding: 9px 12px;
  background: var(--panel2);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  outline: none;
}
.form-group input:focus,
.form-select:focus { border-color: var(--accent); }

.input-with-action {
  display: flex;
  gap: 6px;
}
.input-with-action input { flex: 1; }

.duration-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.preset-btn {
  cursor: pointer;
}
.preset-btn input { display: none; }
.preset-btn span {
  display: block;
  padding: 7px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  background: var(--panel2);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  transition: all 0.15s ease;
}
.preset-btn input:checked + span {
  background: rgba(79, 124, 255, 0.2);
  border-color: var(--accent);
  color: #fff;
}

.extend-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--panel-border);
}

/* Fullscreen Monitor Dialog */
.monitor-modal {
  width: 95vw;
  height: 95vh;
  max-width: 95vw;
  max-height: 95vh;
  border: none;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin: auto;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
}
.monitor-modal::backdrop {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}
.monitor-modal-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.monitor-modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
}
.monitor-modal-actions {
  display: flex;
  gap: 8px;
}
.monitor-canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}
#fs-monitor-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
