/* ============================================================= 
   ProxyMFA - Global Styles
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-primary: #0d0d1a;
  --bg-secondary: #12122a;
  --bg-card: #1a1a35;
  --bg-card-hover: #202044;
  --accent-primary: #6c63ff;
  --accent-secondary: #a78bfa;
  --accent-glow: rgba(108, 99, 255, 0.4);
  --accent-danger: #ef4444;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --text-primary: #f0f0ff;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --border-color: rgba(108, 99, 255, 0.2);
  --border-hover: rgba(108, 99, 255, 0.5);
  --shadow-glow: 0 0 40px rgba(108, 99, 255, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* --- Fondo animado ----------------------------------------------- */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 80% at 20% 10%, rgba(108, 99, 255, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 80% 90%, rgba(167, 139, 250, 0.06) 0%, transparent 60%),
    var(--bg-primary);
  pointer-events: none;
}

.bg-mesh::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(108, 99, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108, 99, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 0%, transparent 80%);
}

/* --- Layout ------------------------------------------------------ */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Cards ------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(12px);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 60px rgba(108, 99, 255, 0.2);
}

/* --- Formularios ------------------------------------------------- */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-primary);
  background: rgba(108, 99, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

input.error {
  border-color: var(--accent-danger);
}

.field-error {
  font-size: 0.8rem;
  color: var(--accent-danger);
  margin-top: 6px;
  display: none;
}

.field-error.visible {
  display: block;
}

/* --- Botones ----------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(108, 99, 255, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(108, 99, 255, 0.5);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

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

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

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: var(--accent-danger);
}

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: var(--accent-success);
}

.btn-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--accent-warning);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
}

.btn-full {
  width: 100%;
}

/* --- Alertas ----------------------------------------------------- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  display: none;
  animation: slideIn 0.3s ease;
}

.alert.visible {
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

/* --- Header / Nav ------------------------------------------------ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 26, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: 1200px;
  margin: 0 auto;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--text-primary);
  background: rgba(108, 99, 255, 0.12);
}

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

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

thead {
  background: rgba(108, 99, 255, 0.08);
}

th {
  padding: 14px 20px;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 16px 20px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(108, 99, 255, 0.08);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: var(--transition);
}

tbody tr:hover {
  background: rgba(108, 99, 255, 0.05);
}

/* --- Badges ------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

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

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

.badge-admin {
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent-secondary);
  border: 1px solid rgba(108, 99, 255, 0.3);
}

.badge-verified {
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-unverified {
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* --- QR Code ----------------------------------------------------- */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: rgba(108, 99, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
}

.qr-container img {
  border-radius: var(--radius-sm);
  display: block;
}

.secret-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 16px;
  border-radius: 6px;
  color: var(--accent-secondary);
  letter-spacing: 0.1em;
  word-break: break-all;
  border: 1px solid var(--border-color);
}

/* --- Spinner ----------------------------------------------------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.spinner.visible {
  display: inline-block;
}

/* --- OTP Input --------------------------------------------------- */
.otp-input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  letter-spacing: 0.5em;
  text-align: center;
}

/* --- Divider ----------------------------------------------------- */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: 24px 0;
}

/* --- Page Title -------------------------------------------------- */
.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* --- Logo central ------------------------------------------------ */
.logo-center {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 24px;
  box-shadow: 0 0 40px rgba(108, 99, 255, 0.4);
}

/* --- Animaciones ------------------------------------------------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 30px rgba(108, 99, 255, 0.2); }
  50% { box-shadow: 0 0 60px rgba(108, 99, 255, 0.4); }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease;
}

.animate-pulse-glow {
  animation: pulse-glow 3s ease-in-out infinite;
}

/* --- Steps (para flujo de creación de usuario) ------------------- */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 40px;
}

.step {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 10px;
}

.step:last-child {
  flex: none;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  background: var(--bg-card);
  transition: var(--transition);
  flex-shrink: 0;
}

.step.active .step-num {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(108, 99, 255, 0.1);
}

.step.done .step-num {
  border-color: var(--accent-success);
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
}

.step-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.step.active .step-label {
  color: var(--text-primary);
}

.step.done .step-label {
  color: var(--accent-success);
}

.step-connector {
  height: 2px;
  flex: 1;
  background: var(--border-color);
  margin: 0 12px;
}

/* --- Action bar -------------------------------------------------- */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Empty state ------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* --- Modal ------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  transform: scale(0.95);
  transition: transform 0.3s ease;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
  .card { padding: 24px 20px; }
  .container { padding: 0 16px; }
  .navbar { padding: 0 16px; }
  th, td { padding: 12px 14px; }
  .steps { flex-direction: column; align-items: flex-start; }
  .step-connector { width: 2px; height: 20px; margin: 4px 17px; }
}
