/* ArChat Auto-Normalized File
Created: 12-03-2026 22:38:36
Author: SIVOL® - Aldo Frias - Argentina */

/* Panel de Administración SaaS - Estilos */

.admin-dashboard {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 100px);
}

.admin-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
}

.admin-header h1 {
  font-size: 2rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 8px 0;
}

.admin-subtitle {
  color: #6b7280;
  margin: 0;
  font-size: 1rem;
}

.admin-access-denied {
  text-align: center;
  padding: 60px 20px;
  background: #fef2f2;
  border-radius: 12px;
  border: 2px solid #fecaca;
}

.admin-access-denied h2 {
  color: #dc2626;
  margin-bottom: 12px;
}

.admin-access-denied p {
  color: #991b1b;
}

.admin-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #6a4c93;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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

/* Tenant List */
.tenant-list-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tenant-list-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  font-size: 0.875rem;
  cursor: pointer;
}

.tenant-table-wrapper {
  overflow-x: auto;
}

.tenant-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.tenant-table thead {
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
}

.tenant-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #374151;
}

.tenant-table td {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.tenant-table tbody tr:hover {
  background: #f9fafb;
}

.tenant-name-link {
  background: none;
  border: none;
  color: #6a4c93;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
  padding: 0;
}

.tenant-name-link:hover {
  color: #5a3c83;
}

.plan-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  display: inline-block;
}

.plan-badge.plan-free {
  background: #e5e7eb;
  color: #6b7280;
}

.plan-badge.plan-pro {
  background: #3b82f6;
  color: white;
}

.plan-badge.plan-enterprise {
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  color: white;
}

/* Badge FREE en dark: contraste WCAG AA */
:root[data-theme="dark"] .admin-dashboard .plan-badge.plan-free {
  background: #2a2f36;
  color: #ffffff;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.status-badge.active {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.suspended {
  background: #fee2e2;
  color: #991b1b;
}

.action-buttons {
  display: flex;
  gap: 6px;
}

.btn-action {
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  background: #f3f4f6;
  transition: background 0.2s;
}

.btn-action:hover {
  background: #e5e7eb;
}

.btn-action.btn-view {
  background: #dbeafe;
}

.btn-action.btn-plan {
  background: #fef3c7;
}

.btn-action.btn-suspend {
  background: #fee2e2;
}

.btn-action.btn-activate {
  background: #d1fae5;
}

.no-tenants {
  text-align: center;
  padding: 40px;
  color: #6b7280;
}

/* Tenant Details */
.tenant-details-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tenant-details-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
}

.btn-back {
  padding: 8px 16px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  color: #374151;
  transition: background 0.2s;
}

.btn-back:hover {
  background: #e5e7eb;
}

.tenant-details-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #1f2937;
}

.tenant-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.detail-card {
  background: #f9fafb;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #e5e7eb;
}

.detail-card h3 {
  margin: 0 0 16px 0;
  font-size: 1.125rem;
  color: #1f2937;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 8px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e5e7eb;
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 500;
  color: #6b7280;
}

.detail-value {
  color: #1f2937;
  font-weight: 500;
}

.limits-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.limit-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e5e7eb;
}

.limit-item:last-child {
  border-bottom: none;
}

.limit-item strong {
  color: #6a4c93;
}

.usage-metrics {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.usage-item {
  padding: 12px;
  background: white;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.usage-value {
  font-weight: 600;
  color: #1f2937;
}

.usage-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.usage-progress-bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.usage-percentage {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  min-width: 40px;
  text-align: right;
}

/* Dark mode */
:root[data-theme="dark"] .admin-dashboard .admin-header {
  border-bottom-color: #374151;
}

:root[data-theme="dark"] .admin-dashboard .admin-header h1 {
  color: #f9fafb;
}

:root[data-theme="dark"] .admin-dashboard .admin-subtitle {
  color: #9ca3af;
}

:root[data-theme="dark"] .admin-dashboard .tenant-list-container,
:root[data-theme="dark"] .admin-dashboard .tenant-details-container {
  background: var(--app-surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] .admin-dashboard .tenant-table thead {
  background: var(--app-surface);
}

:root[data-theme="dark"] .admin-dashboard .tenant-table th {
  color: #e5e7eb;
}

:root[data-theme="dark"] .admin-dashboard .tenant-table td {
  border-bottom-color: #374151;
  color: #e5e7eb;
}

:root[data-theme="dark"] .admin-dashboard .tenant-table tbody tr:hover {
  background: var(--app-surface);
}

:root[data-theme="dark"] .admin-dashboard .detail-card {
  background: var(--app-surface);
  border-color: var(--color-border);
}

:root[data-theme="dark"] .admin-dashboard .detail-card h3 {
  color: #f9fafb;
  border-bottom-color: #374151;
}

:root[data-theme="dark"] .admin-dashboard .detail-label {
  color: #9ca3af;
}

:root[data-theme="dark"] .admin-dashboard .detail-value {
  color: #e5e7eb;
}

:root[data-theme="dark"] .admin-dashboard .usage-item {
  background: var(--app-surface);
  border-color: var(--color-border);
}

:root[data-theme="dark"] .admin-dashboard .usage-value {
  color: #e5e7eb;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-dashboard {
    padding: 15px;
  }

  .tenant-table-wrapper {
    overflow-x: scroll;
  }

  .tenant-details-grid {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    flex-direction: column;
  }
}
