/* ==========================================================================
   Admin Dashboard Styles
   Uses theme variables from global.css for dark/light mode support
   ========================================================================== */

/* Page header */
.page-header {
  margin-bottom: 2rem;
}
.page-header h1 {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--theme-text);
  margin: 0 0 0.25rem;
}
.page-header p {
  color: var(--theme-text-secondary);
  font-size: 0.9375rem;
  margin: 0;
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}
.stat-card .stat-value {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  color: var(--theme-text);
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 0.8125rem;
  color: var(--theme-text-secondary);
  font-weight: 500;
  margin-top: 0.25rem;
}
.stat-card .stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.25rem;
}
.stat-change.up { color: #059669; }
.stat-change.down { color: #dc2626; }
.stat-change.neutral { color: var(--theme-text-muted); }

/* Data tables */
.admin-table-container {
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 2rem;
}
.admin-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--theme-border);
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-table-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--theme-text);
  margin: 0;
}

.admin-search {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  font-size: 0.8125rem;
  font-family: 'Inter', sans-serif;
  background: var(--theme-bg);
  color: var(--theme-text);
  width: 240px;
  max-width: 100%;
  margin: 1rem 1.5rem;
  display: block;
}
.admin-search::placeholder {
  color: var(--theme-text-muted);
}
.admin-search:focus {
  outline: none;
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.admin-table th {
  text-align: left;
  padding: 0.75rem 1.5rem;
  background: var(--theme-bg-secondary);
  font-weight: 600;
  color: var(--theme-text-secondary);
  border-bottom: 1px solid var(--theme-border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.admin-table th:hover {
  color: #2563EB;
}
.admin-table td {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--theme-border-subtle, var(--theme-border));
  color: var(--theme-text-secondary);
}
.admin-table tr:last-child td {
  border-bottom: none;
}
.admin-table tr:hover td {
  background: var(--theme-bg-secondary);
}

/* Sort icons */
.sort-icon::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 4px;
  vertical-align: middle;
}
.sorted-asc .sort-icon::after {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid currentColor;
}
.sorted-desc .sort-icon::after {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

/* Progress bar in table */
.progress-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.progress-bar-mini {
  flex: 1;
  height: 6px;
  background: var(--theme-bg-tertiary, var(--theme-bg-secondary));
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}
.progress-bar-mini .fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.progress-cell span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--theme-text-secondary);
  white-space: nowrap;
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-header h2 {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--theme-text);
  margin: 0;
}
.section-header a {
  font-size: 0.8125rem;
  color: #2563EB;
  text-decoration: none;
  font-weight: 500;
}
.section-header a:hover {
  text-decoration: underline;
}

/* Q&A / info cards */
.admin-qa-card {
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.admin-qa-content {
  font-size: 0.875rem;
  color: var(--theme-text-secondary);
  line-height: 1.6;
  margin: 0;
}
.admin-qa-content strong {
  color: var(--theme-text);
}
.admin-qa-content a {
  color: #2563EB;
  text-decoration: underline;
}

/* Loading placeholder */
.loading-placeholder {
  text-align: center;
  padding: 3rem;
  color: var(--theme-text-muted);
  font-size: 0.875rem;
}

/* Chart containers */
.chart-container {
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}
.chart-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--theme-text);
  margin: 0 0 1rem;
}

/* Bar chart */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.bar-label {
  width: 180px;
  font-size: 0.75rem;
  color: var(--theme-text-secondary);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.bar-track {
  flex: 1;
  height: 20px;
  background: var(--theme-bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563EB, #3b82f6);
  border-radius: 4px;
  transition: width 0.5s ease;
  min-width: 2px;
}
.bar-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: #2563EB;
  width: 40px;
  flex-shrink: 0;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-badge.open { background: #fef3c7; color: #d97706; }
.status-badge.answered { background: #ecfdf5; color: #059669; }
.status-badge.closed { background: var(--theme-bg-tertiary, #f1f5f9); color: var(--theme-text-muted); }

/* Filter buttons */
.admin-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.admin-filter-btn {
  padding: 0.375rem 1rem;
  border: 1px solid var(--theme-border);
  border-radius: 999px;
  background: var(--theme-card-bg);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--theme-text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.admin-filter-btn:hover { border-color: #2563EB; color: #2563EB; }
.admin-filter-btn.active { background: #2563EB; color: #fff; border-color: #2563EB; }

/* Table scroll wrapper */
.table-scroll {
  overflow-x: auto;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-table { min-width: 600px; }
  .admin-search { width: calc(100% - 3rem); }
  .bar-label { width: 100px; }
}
