/* =============================================
   Panel de Altas - Metodo Beast
   Premium Dark Theme - #FF3131 + #000000
   ============================================= */

/* --- Custom Properties --- */
:root {
  --color-bg: #0a0a0a;
  --color-surface: #111111;
  --color-surface-elevated: #1a1a1a;
  --color-surface-hover: #222222;
  --color-text: #f0f0f0;
  --color-text-secondary: #a0a0a0;
  --color-text-muted: #666666;
  --color-border: #2a2a2a;
  --color-border-subtle: #1f1f1f;
  --color-primary: #FF3131;
  --color-primary-hover: #ff4d4d;
  --color-primary-muted: rgba(255, 49, 49, 0.12);
  --color-primary-glow: rgba(255, 49, 49, 0.25);
  --color-success: #22c55e;
  --color-success-bg: rgba(34, 197, 94, 0.1);
  --color-success-border: rgba(34, 197, 94, 0.25);
  --color-error: #ef4444;
  --color-error-bg: rgba(239, 68, 68, 0.1);
  --color-error-border: rgba(239, 68, 68, 0.25);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  --color-warning-border: rgba(245, 158, 11, 0.25);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(255, 49, 49, 0.15);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--color-primary);
  color: #fff;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 49, 49, 0.2); }
  50% { box-shadow: 0 0 20px rgba(255, 49, 49, 0.35); }
}

/* --- Header --- */
.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(17, 17, 17, 0.9);
  animation: slideDown var(--transition-smooth) ease-out;
}

.header-inner {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.header-logo {
  height: 32px;
  width: auto;
  transition: transform var(--transition-smooth);
}

.header-brand:hover .header-logo {
  transform: scale(1.05);
}

.header-brand-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-brand strong {
  color: var(--color-text);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-separator {
  color: var(--color-border);
  margin: 0 2px;
  user-select: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.nav-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  position: relative;
  font-weight: 450;
}

.nav-link:hover {
  color: var(--color-text);
  background: var(--color-surface-hover);
}

.nav-link.active {
  color: var(--color-primary);
  background: var(--color-primary-muted);
}

.nav-user {
  color: var(--color-text-muted);
  font-size: 13px;
  padding: 0 12px;
}

.nav-separator {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  margin: 0 4px;
}

.nav-logout {
  color: var(--color-text-muted) !important;
}

.nav-logout:hover {
  color: var(--color-error) !important;
  background: var(--color-error-bg) !important;
}

/* --- Main --- */
.main {
  padding: 40px 24px;
  animation: fadeIn 0.4s ease-out;
}

.container {
  max-width: 740px;
  margin: 0 auto;
}

/* --- Page title --- */
.page-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 28px;
  color: var(--color-text);
  letter-spacing: -0.02em;
  animation: fadeInUp 0.5s ease-out;
}

/* --- Card --- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
  animation: fadeInUp 0.5s ease-out;
  animation-fill-mode: both;
}

.card:hover {
  border-color: #333;
}

.card-muted {
  background: var(--color-surface-elevated);
  border-color: var(--color-border-subtle);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.card-hint {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

/* --- Forms --- */
.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

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

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  letter-spacing: 0.01em;
}

.form-input {
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-input:hover {
  border-color: #444;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-muted), 0 0 12px rgba(255, 49, 49, 0.08);
}

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

select.form-input option {
  background: var(--color-surface);
  color: var(--color-text);
}

.form-input-inline {
  flex: 1;
  max-width: 320px;
}

.form-hint {
  font-size: 13px;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.form-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

/* --- Form sections --- */
.form-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: -4px;
}

.form-divider {
  height: 1px;
  background: var(--color-border-subtle);
  margin: 4px 0;
}

/* --- Access type cards (50/50) --- */
.access-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.access-card {
  cursor: pointer;
  position: relative;
}

.access-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.access-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 22px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: all var(--transition-smooth);
  background: var(--color-bg);
  height: 100%;
}

.access-card:hover .access-card-inner {
  border-color: #444;
  background: var(--color-surface-hover);
}

.access-card input:checked ~ .access-card-inner {
  border-color: var(--color-primary);
  background: var(--color-primary-muted);
  box-shadow: 0 0 0 1px var(--color-primary), 0 0 16px rgba(255, 49, 49, 0.08);
}

.access-card-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-surface-elevated);
  color: var(--color-text-muted);
  transition: all var(--transition-smooth);
  flex-shrink: 0;
}

.access-card input:checked ~ .access-card-inner .access-card-icon {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 49, 49, 0.3);
}

.access-card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.access-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.access-card-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* --- Confirmation checkbox --- */
.confirm-check {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg);
  transition: all var(--transition-fast);
  user-select: none;
}

.confirm-check:hover {
  border-color: #444;
}

.confirm-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.confirm-check-box {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  color: transparent;
}

.confirm-check input:checked ~ .confirm-check-box {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 8px rgba(255, 49, 49, 0.25);
}

.confirm-check-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.confirm-check input:checked ~ .confirm-check-text {
  color: var(--color-text);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 550;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after {
  opacity: 1;
}

.btn:active {
  transform: scale(0.97);
  transition-duration: 0.08s;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 12px rgba(255, 49, 49, 0.15);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 49, 49, 0.25);
}

.btn-secondary {
  background: var(--color-surface-elevated);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface-hover);
  border-color: #444;
}

.btn-outline {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.btn-outline:hover {
  background: var(--color-surface-elevated);
  color: var(--color-text);
  border-color: #444;
}

.btn-full {
  width: 100%;
}

.btn-small {
  padding: 7px 14px;
  font-size: 13px;
}

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

.btn:disabled::after {
  display: none;
}

/* --- Alerts --- */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid transparent;
  animation: scaleIn 0.3s ease-out;
}

.alert strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.alert p {
  margin-top: 4px;
}

.alert small {
  opacity: 0.85;
}

.alert-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: var(--color-success-border);
}

.alert-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border-color: var(--color-error-border);
}

.alert-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: var(--color-warning-border);
}

/* --- Copy area --- */
.copy-area {
  margin-top: 14px;
}

.copy-textarea {
  width: 100%;
  resize: vertical;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  background: var(--color-bg);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

.copy-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  animation: fadeInUp 0.5s ease-out;
}

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

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border-subtle);
}

.table th {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--color-surface);
  position: sticky;
  top: 0;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--color-surface-hover);
}

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

.td-date {
  white-space: nowrap;
  font-size: 12px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.td-detail {
  font-size: 12px;
  color: var(--color-text-muted);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.detail-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--color-border-subtle);
}

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

.detail-table td:first-child {
  font-weight: 500;
  color: var(--color-text-muted);
  width: 200px;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-green { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.badge-red { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-yellow { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.pagination-info {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* --- Login --- */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 49, 49, 0.08) 0%, transparent 60%),
    var(--color-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.6s ease-out;
  position: relative;
}

.login-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  border-radius: 2px;
}

.login-logo {
  display: block;
  margin: 0 auto 20px;
  height: 64px;
  width: auto;
  animation: fadeIn 0.8s ease-out;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.login-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: 28px;
}

/* --- Utils --- */
.text-muted {
  color: var(--color-text-muted);
  font-size: 13px;
}

.text-error {
  color: var(--color-error);
}

/* --- Error page --- */
.error-page {
  text-align: center;
  padding: 80px 0;
  animation: fadeInUp 0.5s ease-out;
}

.error-page h1 {
  color: var(--color-primary);
}

.error-page p {
  color: var(--color-text-muted);
  margin-bottom: 28px;
  font-size: 15px;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border-subtle);
  font-size: 12px;
}

/* --- Loading indicator --- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s ease-out;
  transition: opacity 0.3s ease-out;
}

.toast-success {
  background: var(--color-success);
}

.toast-error {
  background: var(--color-error);
}

/* --- Staggered animations for form groups --- */
.card .form-group:nth-child(1) { animation: fadeInUp 0.4s ease-out 0.05s both; }
.card .form-group:nth-child(2) { animation: fadeInUp 0.4s ease-out 0.1s both; }
.card .form-group:nth-child(3) { animation: fadeInUp 0.4s ease-out 0.15s both; }
.card .form-group:nth-child(4) { animation: fadeInUp 0.4s ease-out 0.2s both; }
.card .form-group:nth-child(5) { animation: fadeInUp 0.4s ease-out 0.25s both; }
.card .form-row:nth-child(1) { animation: fadeInUp 0.4s ease-out 0.05s both; }
.card .form-row:nth-child(2) { animation: fadeInUp 0.4s ease-out 0.1s both; }

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .form-row,
  .access-cards {
    grid-template-columns: 1fr;
  }

  .header-inner {
    flex-direction: column;
    gap: 8px;
    padding: 12px 0;
  }

  .header {
    height: auto;
    padding: 8px 16px;
  }

  .header-nav {
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
  }

  .container {
    max-width: 100%;
  }

  .main {
    padding: 24px 16px;
  }

  .card {
    padding: 20px;
  }

  .login-card {
    padding: 28px 24px;
  }

  .copy-actions {
    flex-direction: column;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }
}
