/* ===== Admin panels — SaaS style ===== */
.admin-panel {
  --ap-bg: #f1f5f9;
  --ap-surface: #ffffff;
  --ap-border: #e2e8f0;
  --ap-border-light: #f1f5f9;
  --ap-text: #0f172a;
  --ap-text-muted: #64748b;
  --ap-primary: #1d4ed8;
  --ap-primary-dark: #1e3a8a;
  --ap-primary-soft: #eff6ff;
  --ap-radius: 12px;
  --ap-radius-lg: 16px;
  --ap-shadow: 0 1px 3px rgb(15 23 42 / 0.06), 0 4px 16px rgb(15 23 42 / 0.04);
  --ap-shadow-hover: 0 4px 20px rgb(15 23 42 / 0.08);

  background: var(--ap-bg);
  min-height: calc(100vh - 120px);
  padding: 1.5rem 1rem 2.5rem;
}

@media (min-width: 768px) {
  .admin-panel {
    padding: 2rem 1.5rem 3rem;
  }
}

/* Header */
.admin-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.admin-panel-header-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-panel-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    var(--ap-primary) 0%,
    var(--ap-primary-dark) 100%
  );
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgb(29 78 216 / 0.25);
}

.admin-panel-icon.icon-green {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 12px rgb(5 150 105 / 0.25);
}

.admin-panel-icon.icon-purple {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  box-shadow: 0 4px 12px rgb(124 58 237 / 0.25);
}

.admin-panel-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--ap-primary-dark);
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.admin-panel-subtitle {
  font-size: 0.875rem;
  color: var(--ap-text-muted);
  margin: 0.15rem 0 0;
}

.admin-panel-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.admin-panel-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ap-text-muted);
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.admin-panel-link-btn:hover {
  color: var(--ap-primary);
  border-color: var(--ap-primary);
  background: var(--ap-primary-soft);
}

/* Tabs */
.admin-panel-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--ap-border);
  margin-bottom: 1.25rem;
}

.admin-panel-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ap-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s ease;
}

.admin-panel-tab:hover {
  color: var(--ap-primary);
}

.admin-panel-tab.active {
  color: var(--ap-primary-dark);
  border-bottom-color: var(--ap-primary);
  font-weight: 600;
}

.admin-panel-tab i {
  font-size: 0.9rem;
}

/* Cards */
.admin-panel-card {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-lg);
  box-shadow: var(--ap-shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.admin-panel-card-filters {
  padding: 1.25rem 1.5rem;
}

.admin-panel-card-table {
  padding: 0;
}

/* Alerts inside panel */
.admin-panel .alert {
  border-radius: var(--ap-radius);
  border: none;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Filters */
.admin-filters-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 576px) {
  .admin-filters-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .admin-filters-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .admin-filters-grid.cols-5 {
    grid-template-columns: repeat(5, 1fr);
  }

  .admin-filters-grid.cols-6 {
    grid-template-columns: repeat(6, 1fr);
  }
}

.admin-filter-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ap-text);
  margin-bottom: 0.35rem;
  letter-spacing: 0.01em;
}

.admin-input-wrap {
  position: relative;
}

.admin-input-wrap > i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 2;
}

.admin-input-wrap .form-control,
.admin-input-wrap .form-select {
  padding-left: 2.25rem;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--ap-text);
  background: var(--ap-surface);
  min-height: 40px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.admin-filter-field .form-control,
.admin-filter-field .form-select {
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  font-size: 0.875rem;
  min-height: 40px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.admin-filter-field .form-control:focus,
.admin-filter-field .form-select:focus,
.admin-input-wrap .form-control:focus,
.admin-input-wrap .form-select:focus {
  border-color: var(--ap-primary);
  box-shadow: 0 0 0 3px rgb(29 78 216 / 0.12);
}

.admin-filters-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ap-border-light);
}

.admin-btn-clear {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ap-text-muted);
  background: none;
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.admin-btn-clear:hover {
  color: var(--ap-primary);
}

.admin-btn-search {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(
    135deg,
    var(--ap-primary) 0%,
    var(--ap-primary-dark) 100%
  );
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgb(29 78 216 / 0.3);
}

.admin-btn-search:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgb(29 78 216 / 0.35);
  color: #fff;
}

/* Table */
.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table thead th {
  padding: 0.875rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ap-primary-dark);
  text-transform: none;
  letter-spacing: 0.01em;
  background: #f8fafc;
  border-bottom: 1px solid var(--ap-border);
  white-space: nowrap;
}

.admin-table thead th .sort-icon {
  color: #94a3b8;
  font-size: 0.65rem;
  margin-left: 0.25rem;
  vertical-align: middle;
}

.admin-table tbody td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--ap-border-light);
  color: var(--ap-text);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: #fafbfc;
}

.admin-cell-primary {
  font-weight: 600;
  color: var(--ap-text);
  margin: 0;
  font-size: 0.875rem;
}

.admin-cell-id {
  font-size: 0.75rem;
  color: var(--ap-text-muted);
  margin-top: 0.1rem;
}

.admin-badge-cuit {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #be185d;
  background: #fdf2f8;
  border-radius: 6px;
}

.admin-badge-dni {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #0369a1;
  background: #e0f2fe;
  border-radius: 6px;
}

.admin-badge-type {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #0369a1;
  background: #e0f2fe;
  border-radius: 999px;
}

.admin-cell-location {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ap-text-muted);
  font-size: 0.875rem;
}

.admin-cell-location i {
  color: #94a3b8;
  font-size: 0.8rem;
}

.admin-cell-date {
  font-size: 0.8125rem;
  color: var(--ap-text-muted);
  white-space: nowrap;
}

/* Status pills */
.admin-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}

.admin-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.admin-status-pendiente {
  color: #c2410c;
  background: #fff7ed;
}

.admin-status-pendiente .admin-status-dot {
  background: #f97316;
}

.admin-status-aprobada,
.admin-status-activo,
.admin-status-activa {
  color: #15803d;
  background: #f0fdf4;
}

.admin-status-aprobada .admin-status-dot,
.admin-status-activo .admin-status-dot,
.admin-status-activa .admin-status-dot {
  background: #22c55e;
}

.admin-status-rechazada,
.admin-status-rechazado,
.admin-status-eliminado {
  color: #b91c1c;
  background: #fef2f2;
}

.admin-status-rechazada .admin-status-dot,
.admin-status-rechazado .admin-status-dot,
.admin-status-eliminado .admin-status-dot {
  background: #ef4444;
}

.admin-status-inactivo,
.admin-status-inactiva {
  color: #475569;
  background: #f1f5f9;
}

.admin-status-inactivo .admin-status-dot,
.admin-status-inactiva .admin-status-dot {
  background: #94a3b8;
}

.admin-status-suspendido {
  color: #a16207;
  background: #fefce8;
}

.admin-status-suspendido .admin-status-dot {
  background: #eab308;
}

.admin-status-info {
  color: #0369a1;
  background: #e0f2fe;
}

.admin-status-info .admin-status-dot {
  background: #0ea5e9;
}

/* Action buttons */
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.admin-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--ap-border);
  background: var(--ap-surface);
  color: var(--ap-text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.admin-action-btn:hover {
  transform: translateY(-1px);
}

.admin-action-btn.view {
  color: var(--ap-primary);
  border-color: #bfdbfe;
  background: var(--ap-primary-soft);
}

.admin-action-btn.view:hover {
  background: #dbeafe;
  color: var(--ap-primary-dark);
}

.admin-action-btn.approve {
  color: #16a34a;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.admin-action-btn.approve:hover {
  background: #dcfce7;
  color: #15803d;
}

.admin-action-btn.reject {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

.admin-action-btn.reject:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.admin-action-btn.edit {
  color: #d97706;
  border-color: #fde68a;
  background: #fffbeb;
}

.admin-action-btn.edit:hover {
  background: #fef3c7;
  color: #b45309;
}

/* Empty state */
.admin-empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
}

.admin-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: #f1f5f9;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.admin-empty h5 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ap-text);
  margin-bottom: 0.35rem;
}

.admin-empty p {
  font-size: 0.875rem;
  color: var(--ap-text-muted);
  margin: 0;
}

/* Footer / pagination */
.admin-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--ap-border-light);
  background: #fafbfc;
}

.admin-table-footer-info {
  font-size: 0.8125rem;
  color: var(--ap-text-muted);
}

.admin-pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-pagination .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ap-text-muted);
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.admin-pagination .page-link:hover {
  border-color: var(--ap-primary);
  color: var(--ap-primary);
  background: var(--ap-primary-soft);
}

.admin-pagination .page-item.active .page-link {
  background: var(--ap-primary);
  border-color: var(--ap-primary);
  color: #fff;
}

.admin-pagination .page-item.disabled .page-link {
  opacity: 0.45;
  pointer-events: none;
}

.admin-page-size {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-page-size-label {
  font-size: 0.8125rem;
  color: var(--ap-text-muted);
}

.admin-page-size-btns {
  display: flex;
  gap: 0.25rem;
}

.admin-page-size-btn {
  min-width: 36px;
  height: 32px;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ap-text-muted);
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-page-size-btn:hover,
.admin-page-size-btn.active {
  color: var(--ap-primary);
  border-color: var(--ap-primary);
  background: var(--ap-primary-soft);
}

/* Detail page */
.admin-detail-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ap-primary-dark);
  border-bottom: 1px solid var(--ap-border-light);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.admin-detail-list {
  display: grid;
  grid-template-columns: minmax(120px, 35%) 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}

.admin-detail-list dt {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ap-text-muted);
  margin: 0;
}

.admin-detail-list dd {
  font-size: 0.875rem;
  color: var(--ap-text);
  margin: 0;
}

.admin-detail-list-inline {
  grid-template-columns: minmax(80px, auto) 1fr minmax(60px, auto) 1fr;
}

.admin-detail-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ap-border-light);
}

@media (max-width: 767px) {
  .admin-detail-list,
  .admin-detail-list-inline {
    grid-template-columns: 1fr;
  }
}
