:root {
  --bg-main: #050507;
  --bg-sidebar: rgba(10, 12, 16, 0.85);
  --bg-card: rgba(16, 20, 28, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(141, 209, 2, 0.4);
  --rydex-green: #8dd102;
  --rydex-green-glow: rgba(141, 209, 2, 0.35);
  --emerald: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --blue: #38bdf8;
  --text-white: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #64748b;
  --sidebar-width: 270px;
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-white);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background Dot Grid (Idêntico ao Rydex) */
.dot-grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 26px 26px;
}

/* Aurora Blobs */
.aurora-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.aurora-blob-1 {
  position: absolute;
  top: -100px;
  right: 10%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, var(--rydex-green-glow) 0%, transparent 65%);
  filter: blur(120px);
  opacity: 0.6;
}

.aurora-blob-2 {
  position: absolute;
  bottom: -150px;
  left: 20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.25) 0%, transparent 65%);
  filter: blur(140px);
  opacity: 0.5;
}

/* Layout Estrutural */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* SIDEBAR (MENU LATERAL) */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 14px;
}

.sidebar-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--border-active);
  box-shadow: 0 0 20px var(--rydex-green-glow);
}

.sidebar-brand h2 {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-brand p {
  font-size: 11px;
  color: var(--rydex-green);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1.5px;
}

/* Navegação do Menu Lateral */
.sidebar-nav {
  padding: 24px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 10px 14px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  border: 1px solid transparent;
}

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

.nav-item.active {
  background: rgba(141, 209, 2, 0.12);
  color: var(--rydex-green);
  border-color: rgba(141, 209, 2, 0.25);
  box-shadow: 0 4px 20px rgba(141, 209, 2, 0.15);
}

.nav-icon {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
}

/* Rodapé do Menu Lateral */
.sidebar-footer {
  padding: 18px 16px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.admin-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rydex-green), #059669);
  color: #000;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-info {
  flex: 1;
  overflow: hidden;
}

.admin-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-role {
  font-size: 11px;
  color: var(--rydex-green);
  font-weight: 600;
}

/* ÁREA DE CONTEÚDO PRINCIPAL */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 40px;
  max-width: calc(100vw - var(--sidebar-width));
}

/* Topbar Superior */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 20px;
}

.page-title h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.page-title p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

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

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--emerald);
}

.btn-primary {
  background: linear-gradient(135deg, var(--rydex-green), var(--emerald));
  color: #000;
  font-weight: 800;
  font-size: 13px;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px var(--rydex-green-glow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

/* SEÇÕES DINÂMICAS */
.view-section {
  display: none;
  animation: fadeIn 0.3s ease-out forwards;
}

.view-section.active {
  display: block;
}

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

/* CARDS DE ESTATÍSTICA ESTILO RYDEX */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 18px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
}

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

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-color, var(--rydex-green));
}

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

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

.metric-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.metric-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 6px;
}

.metric-footer {
  font-size: 12px;
  color: var(--text-dark);
}

/* BARRA DE FILTROS E BUSCA */
.filter-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 14px;
  flex: 1;
  max-width: 380px;
}

.search-input-wrapper input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  outline: none;
  width: 100%;
  margin-left: 10px;
}

.status-filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.pill-btn.active, .pill-btn:hover {
  background: rgba(141, 209, 2, 0.15);
  border-color: var(--rydex-green);
  color: var(--rydex-green);
}

/* TABELA DE LICENÇAS */
.table-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 14px;
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* CHAVE BADGE */
.key-badge {
  font-family: 'Barlow Condensed', monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 12px;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.key-badge:hover {
  border-color: var(--rydex-green);
  color: var(--rydex-green);
  box-shadow: 0 0 15px rgba(141, 209, 2, 0.2);
}

/* BADGES DE STATUS (ESTILO SENTINELA) */
.badge-status {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
}

.badge-ativo {
  background: rgba(141, 209, 2, 0.15);
  color: var(--rydex-green);
  border: 1px solid rgba(141, 209, 2, 0.3);
}

.badge-trial {
  background: rgba(245, 158, 11, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-expirado {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-bloqueado {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* BOTÕES DE AÇÃO */
.actions-cell {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.action-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: #e2e8f0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 14px;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-2px);
}

.action-btn.whatsapp:hover {
  background: #25d366;
  border-color: #25d366;
  color: #000;
}

.action-btn.renew:hover {
  background: var(--rydex-green);
  border-color: var(--rydex-green);
  color: #000;
}

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

/* FORMULÁRIO ESTILIZADO DE GERAÇÃO */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 32px;
  max-width: 700px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

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

.form-group-field label {
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
}

.form-group-field input, .form-group-field select {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-subtle);
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group-field input:focus, .form-group-field select:focus {
  border-color: var(--rydex-green);
}

/* TICKET PREVIEW CARD */
.ticket-preview {
  font-family: 'Barlow Condensed', sans-serif;
  background: rgba(10, 14, 20, 0.95);
  border: 2px solid var(--rydex-green);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 10px 30px var(--rydex-green-glow);
  margin-bottom: 24px;
}

/* TOAST */
.toast-alert {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #11151f;
  border: 1px solid var(--rydex-green);
  color: #fff;
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: none;
  z-index: 200;
  animation: slideToast 0.3s forwards;
}

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

/* RESPONSIVIDADE */
@media (max-width: 900px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
    max-width: 100vw;
    padding: 20px;
  }
}
