/* ============================================
   ADMIN DASHBOARD STYLES - Loopy/Beaver Theme
   ============================================ */

/* Main Layout */
.admin-main {
  padding: calc(var(--nav-h) + var(--space-2xl)) var(--space-xl) var(--space-xl);
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
}

/* Page Header */
.admin-header {
  margin-bottom: var(--space-2xl);
}

.admin-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: var(--space-xs);
}

.admin-header p {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

/* Stats Grid */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
}

.stat-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--beaver);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(200, 122, 80, 0.15);
  border-color: var(--beaver);
}

.stat-card:hover::before {
  opacity: 1;
}

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

.stat-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  opacity: 0.15;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
  stroke: white;
  position: relative;
  z-index: 1;
}

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  font-family: var(--font-display);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

/* Tabs */
.admin-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
  background: var(--bg-alt);
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.admin-tab {
  flex: 1;
  padding: 14px 24px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-tab:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.03);
}

.admin-tab.active {
  color: white;
  background: var(--beaver);
  box-shadow: 0 4px 12px rgba(200, 122, 80, 0.35);
}

/* Sections */
.admin-section {
  display: none;
  animation: fadeIn 0.4s ease;
}

.admin-section.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
}

/* Search Input */
.search-input {
  padding: 12px 18px;
  font-size: 0.9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  color: var(--ink);
  width: 280px;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

.search-input:focus {
  outline: none;
  border-color: var(--beaver);
  box-shadow: 0 0 0 3px rgba(200, 122, 80, 0.15);
}

.search-input::placeholder {
  color: var(--ink-faint);
}

/* Table Container */
.table-container {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

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

.admin-table th {
  background: var(--bg-alt);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink-faint);
}

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

.admin-table tbody tr {
  transition: background 0.15s ease;
}

.admin-table tbody tr:hover {
  background: rgba(200, 122, 80, 0.04);
}

.loading-cell {
  text-align: center;
  color: var(--ink-faint);
  padding: var(--space-2xl);
  font-size: 0.9rem;
}

/* User Cell */
.user-cell {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--beaver), var(--accent));
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(200, 122, 80, 0.3);
}

.user-name {
  font-weight: 600;
  color: var(--ink);
}

.user-email {
  font-size: 0.8rem;
  color: var(--ink-faint);
}

/* Status Chips */
.status-chip {
  display: inline-block;
  padding: 5px 12px;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-chip.active, .status-chip.available {
  background: rgba(46, 204, 113, 0.15);
  color: var(--success);
}

.status-chip.banned, .status-chip.resolved {
  background: rgba(231, 76, 60, 0.15);
  color: var(--error);
}

.status-chip.sold, .status-chip.rented {
  background: rgba(241, 196, 15, 0.15);
  color: var(--warning);
}

.status-chip.archived {
  background: rgba(149, 165, 166, 0.15);
  color: var(--ink-faint);
}

.status-chip.pending, .status-chip.pending {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.role-chip {
  display: inline-block;
  padding: 5px 12px;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
}

.role-chip.admin {
  background: rgba(155, 89, 182, 0.15);
  color: #9b59b6;
}

.role-chip.moderator {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.role-chip.user {
  background: rgba(149, 165, 166, 0.15);
  color: var(--ink-faint);
}

/* Action Buttons */
.action-btns {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.btn-action {
  padding: 8px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.btn-action.view {
  background: rgba(52, 152, 219, 0.12);
  color: #3498db;
}

.btn-action.view:hover {
  background: #3498db;
  color: white;
}

.btn-action.ban {
  background: rgba(231, 76, 60, 0.12);
  color: var(--error);
}

.btn-action.ban:hover {
  background: var(--error);
  color: white;
}

.btn-action.unban {
  background: rgba(46, 204, 113, 0.12);
  color: var(--success);
}

.btn-action.unban:hover {
  background: var(--success);
  color: white;
}

.btn-action.delete {
  background: rgba(231, 76, 60, 0.12);
  color: var(--error);
}

.btn-action.delete:hover {
  background: var(--error);
  color: white;
}

/* Listing Cell */
.listing-cell {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.listing-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--bg-alt);
  overflow: hidden;
  flex-shrink: 0;
}

.listing-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listing-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
}

.listing-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.listing-title {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-price {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 700;
}

/* Reports */
.reports-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.report-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all 0.2s ease;
}

.report-card:hover {
  border-color: var(--beaver);
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
  gap: var(--space-md);
}

.report-type {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(231, 76, 60, 0.12);
  color: var(--error);
}

.report-status {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  text-transform: uppercase;
}

.report-status.pending {
  background: rgba(241, 196, 15, 0.15);
  color: var(--warning);
}

.report-status.under_review {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.report-status.resolved {
  background: rgba(46, 204, 113, 0.15);
  color: var(--success);
}

.report-content {
  color: var(--ink);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.report-content strong {
  color: var(--ink);
  font-weight: 600;
}

.report-meta {
  font-size: 0.8rem;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

.page-btn {
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--beaver);
  color: var(--beaver);
}

.page-btn.active {
  background: var(--beaver);
  border-color: var(--beaver);
  color: white;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 90%;
  max-width: 420px;
  z-index: 1000;
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 2px solid var(--border);
}

.modal-content h3 {
  margin-bottom: var(--space-lg);
  font-size: 1.25rem;
  color: var(--ink);
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  transition: border-color 0.2s ease;
}

.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--beaver);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--ink-faint);
}

.empty-state h3 {
  color: var(--ink-muted);
  margin-bottom: var(--space-sm);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  background: var(--bg-alt);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--ink-faint);
}

/* Responsive */
@media (max-width: 768px) {
  .admin-main {
    padding: calc(var(--nav-h) + var(--space-lg)) var(--space-md) var(--space-lg);
  }
  
  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-input {
    width: 100%;
  }
  
  .admin-table th:nth-child(3),
  .admin-table td:nth-child(3),
  .admin-table th:nth-child(5),
  .admin-table td:nth-child(5) {
    display: none;
  }
  
  .admin-tabs {
    flex-wrap: wrap;
  }
  
  .admin-tab {
    flex: 1 1 auto;
    min-width: 100px;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalPop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

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

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

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

/* Secondary Stats */
.secondary-stats {
  margin-bottom: var(--space-xl);
}

.secondary-stats .stat-card.small {
  padding: var(--space-md);
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
}

.secondary-stats .stat-card.small .stat-value {
  font-size: 1.25rem;
}

.secondary-stats .stat-card.small .stat-label {
  font-size: 0.65rem;
}

/* Charts */
.charts-section {
  margin-top: var(--space-xl);
}

.charts-section h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: var(--space-lg);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.chart-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.chart-card h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-md);
}

.chart-card canvas {
  width: 100% !important;
  height: 200px !important;
}
