/* ============================================================
   ADMIN MASTER - ESTILOS VISUAIS
   Design Executivo, Glassmorphism & Gestão Multi-Tenant
   ============================================================ */

:root {
  --bg-dark: #080c14;
  --bg-card: rgba(15, 23, 42, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.8);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --brand-red: #ef4444;
  --brand-red-glow: rgba(239, 68, 68, 0.35);
  --brand-emerald: #10b981;
  --brand-amber: #f59e0b;
  --brand-indigo: #6366f1;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(239, 68, 68, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  padding-bottom: 5rem;
  -webkit-font-smoothing: antialiased;
}

/* NAVBAR */
.admin-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2.5rem;
  background: rgba(8, 12, 20, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

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

.brand-badge {
  background: var(--brand-red);
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 14px var(--brand-red-glow);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.brand-role {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--brand-amber);
  letter-spacing: 1.2px;
}

.nav-user-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-profile-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
}

.nav-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 7px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.nav-link-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* CONTAINER */
.admin-container {
  max-width: 1360px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
}

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

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.icon-users { background: rgba(99, 102, 241, 0.15); border: 1px solid rgba(99, 102, 241, 0.3); }
.icon-tvs { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); }
.icon-online { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); }
.icon-media { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* SEÇÕES */
.admin-section {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

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

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.section-header p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.live-pill {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--brand-emerald);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 5px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

/* TABELA DE CLIENTES */
.clients-table-wrapper {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-table td {
  padding: 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #ffffff;
  vertical-align: middle;
}

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

.client-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
}

.user-badge {
  font-family: monospace;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
}

.status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.action-buttons-cell {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-action.open-dash {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

.btn-action.open-dash:hover {
  background: var(--brand-indigo);
  color: #ffffff;
}

.btn-action.danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

/* MONITOR GLOBAL DE TVS */
.global-tvs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
}

.tv-monitor-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
}

.tv-monitor-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

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

.tv-code-tag {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffffff;
  background: rgba(239, 68, 68, 0.15);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.tv-card-body h4 {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
}

.tv-card-body p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.tv-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.25s ease;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  animation: scaleUp 0.25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #ffffff;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

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

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

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

.input-text, .input-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}

.input-text:focus, .input-select:focus {
  border-color: var(--brand-red);
  background: rgba(255, 255, 255, 0.08);
}

.help-text {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 1rem;
}

/* BOTÕES GERAIS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--brand-red);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--brand-red-glow);
}

.btn-primary:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* TOAST */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  animation: slideInRight 0.3s ease;
}

.toast-content {
  background: #0f172a;
  border: 1px solid var(--brand-emerald);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.hidden { display: none !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleUp { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pix-form-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 640px) {
  .admin-navbar { padding: 1rem; flex-direction: column; gap: 12px; }
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ==============================================
   ESTILOS: SEÇÃO PIX & PLANOS
   ============================================== */
.pix-config-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.8rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  margin-bottom: 0.5rem;
}

.pix-config-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 1.2rem;
}

.pix-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000000;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.pix-config-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 3px;
}

.pix-config-header p {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.pix-form-grid {
  display: grid;
  grid-template-columns: 2fr 2fr 1.2fr;
  gap: 14px;
  align-items: flex-end;
}

.plan-price-tag {
  font-size: 1.05rem;
  font-weight: 800;
  color: #10b981;
}

.plan-sub-detail {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.status-badge.blocked {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.sub-status-info {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.btn-action.warn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.btn-action.warn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ffffff;
}

.btn-action.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.btn-action.success:hover {
  background: rgba(16, 185, 129, 0.3);
  color: #ffffff;
}

.btn-action.renew {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #818cf8;
}

.btn-action.renew:hover {
  background: rgba(99, 102, 241, 0.3);
  color: #ffffff;
}

.btn-action.pix {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #22d3ee;
}

.btn-action.pix:hover {
  background: rgba(6, 182, 212, 0.3);
  color: #ffffff;
}

/* CAIXA DE CÁLCULO DE VALOR NO MODAL */
.plan-calc-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  margin-bottom: 1.2rem;
}

.calc-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #34d399;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.calc-formula {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 4px;
}

.calc-total {
  font-size: 1.35rem;
  font-weight: 900;
  color: #10b981;
}

