:root {
  --bg-dark: #0b0e14;
  --bg-card: rgba(22, 27, 38, 0.75);
  --bg-card-hover: rgba(30, 37, 52, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #7c3aed;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --accent-purple: #7c3aed;
  --accent-purple-glow: rgba(124, 58, 237, 0.35);
  --accent-cyan: #06b6d4;
  --accent-red: #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.3);
  --accent-amber: #f59e0b;
  --accent-green: #10b981;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(124, 58, 237, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

/* LOGIN SCREEN */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: rgba(22, 27, 38, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.4s ease-out;
}

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

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem auto;
  color: #fff;
  box-shadow: 0 0 25px var(--accent-purple-glow);
}

.login-brand-icon svg {
  width: 30px;
  height: 30px;
}

.login-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

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

.input-icon-wrapper .input-icon {
  position: absolute;
  left: 1rem;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-icon-wrapper input {
  padding-left: 2.75rem !important;
  padding-right: 2.75rem !important;
}

.btn-toggle-pass {
  position: absolute;
  right: 0.8rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  align-items: center;
}

.btn-toggle-pass:hover { color: var(--text-main); }

.login-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 1.2rem;
  text-align: center;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 0.8rem 1.25rem;
  font-size: 0.95rem;
}

/* APP MAIN WRAPPER */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* HEADER */
.app-header {
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 1rem 2rem;
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 20px var(--accent-purple-glow);
}

.brand-icon svg {
  width: 24px;
  height: 24px;
}

.login-brand-icon-custom {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.login-logo-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.4));
}

.brand-icon-custom {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.3));
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #c084fc;
  background: rgba(124, 58, 237, 0.15);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  border: 1px solid rgba(192, 132, 252, 0.2);
}

.user-badge svg { width: 16px; height: 16px; }

.btn-icon-only {
  padding: 0.65rem;
  border-radius: var(--radius-md);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-family);
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), #6366f1);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-purple-glow);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.btn-danger {
  background: linear-gradient(135deg, var(--accent-red), #dc2626);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-red-glow);
}

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

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

/* MAIN CONTENT */
.main-content {
  max-width: 1300px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 2rem;
  flex: 1;
}

/* METRICS GRID */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: var(--transition);
}

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

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

.metric-icon svg { width: 26px; height: 26px; }

.icon-purple { background: rgba(124, 58, 237, 0.15); color: var(--accent-purple); }
.icon-red { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.icon-blue { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }

.metric-data .metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.metric-data h3 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 0.1rem;
}

/* SECTION & TOOLBAR */
.content-section {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 300px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 0.75rem 2.8rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: var(--font-family);
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

.search-box #btn-clear-search {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
}

.toolbar-actions {
  display: flex;
  gap: 0.75rem;
}

/* DATA TABLE */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

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

.data-table th {
  background: rgba(15, 20, 30, 0.8);
  padding: 1rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

.agid-badge {
  font-family: monospace;
  background: rgba(124, 58, 237, 0.15);
  color: #c084fc;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: 1px solid rgba(192, 132, 252, 0.2);
}

.player-name-cell { font-weight: 600; color: var(--text-main); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

.badge-low { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }

.action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.text-right { text-align: right; }
.justify-center { justify-content: center; }
.text-center { text-align: center; }

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-card {
  background: #121824;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
  transition: var(--transition);
}

.modal-overlay.active .modal-card { transform: scale(1); }

.modal-lg { max-width: 750px; }
.modal-sm { max-width: 400px; }

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title-group { display: flex; align-items: center; gap: 0.75rem; }
.modal-header-icon { width: 24px; height: 24px; color: var(--accent-purple); }
.text-accent { color: var(--accent-purple); }

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
}

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

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  display: flex;
}

.btn-close-modal:hover { color: var(--text-main); }

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* FORM ELEMENTS */
.form-group { margin-bottom: 1.2rem; }

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.required { color: var(--accent-red); }

.form-group input, .form-group textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

/* HISTORY LIST */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.history-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  transition: var(--transition);
}

.history-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.history-info { flex: 1; }

.history-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.history-reason {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.4;
}

.danger-icon-circle {
  width: 56px;
  height: 56px;
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem auto;
}

.modal-padding-lg { padding: 2rem 1.5rem; }

.target-info-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed var(--border-color);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  margin-top: 1rem;
  font-size: 0.85rem;
}

/* AUDIT LIST */
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.audit-item {
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--accent-purple);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.85rem;
}

.audit-item.ELIMINAR_ADVERTENCIA {
  border-left-color: var(--accent-red);
}

.audit-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}

/* LOADING & EMPTY STATES */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--text-muted);
}

.spin { animation: spin 1s linear infinite; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
}

.empty-state i {
  width: 48px;
  height: 48px;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 200;
}

.toast {
  background: #1a2234;
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  color: var(--text-main);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-success { border-left: 4px solid var(--accent-green); }
.toast-error { border-left: 4px solid var(--accent-red); }

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

.input-readonly {
  background: rgba(124, 58, 237, 0.08) !important;
  border-color: rgba(124, 58, 237, 0.25) !important;
  color: #c084fc !important;
  font-weight: 600;
  cursor: not-allowed;
}

.field-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

/* SETTINGS TABS & MODAL STYLES */
.settings-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.tab-btn svg { width: 16px; height: 16px; }

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: rgba(124, 58, 237, 0.15);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.2);
}

.tab-btn.tab-danger.active {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease-out; }

.settings-section h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.section-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.margin-top-lg { margin-top: 1.5rem; }
.margin-top-md { margin-top: 1rem; }

.admins-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-card-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-role-badge {
  background: rgba(124, 58, 237, 0.2);
  color: #c084fc;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
}

.backup-box {
  background: rgba(6, 182, 212, 0.05);
  border: 1px dashed rgba(6, 182, 212, 0.3);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.backup-icon {
  width: 48px;
  height: 48px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.backup-info { flex: 1; min-width: 200px; }
.backup-info h4 { font-size: 1rem; font-weight: 700; }
.backup-info p { font-size: 0.8rem; color: var(--text-muted); }

.danger-zone-box {
  background: rgba(239, 68, 68, 0.05);
  border: 1px dashed rgba(239, 68, 68, 0.3);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
}

.danger-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.danger-icon {
  width: 32px;
  height: 32px;
  color: var(--accent-red);
  flex-shrink: 0;
}

.warning-text {
  font-size: 0.85rem;
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.75rem;
  border-radius: var(--radius-md);
}
