/* ===================================================
   K64 Admin Component Styles — HTMX-enhanced
   Loaded after k64.css in header.html
   =================================================== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(79, 156, 255, 0.08);
}
.stat-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-change { font-size: 0.75rem; margin-top: 0.25rem; }
.stat-change.up { color: #10b981; }
.stat-change.down { color: #ef4444; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th {
  text-align: left;
  padding: 0.75rem 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }

.role-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.role-admin     { background: var(--accent); color: #000; }
.role-moderator { background: #8b5cf6; color: #fff; }
.role-curator   { background: #10b981; color: #fff; }
.role-user      { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 0.25rem;
}
.status-dot.active    { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,0.4); }
.status-dot.suspended { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.status-dot.banned    { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.4); }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease-out;
}
.modal-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  max-width: 560px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease-out;
}
.modal-content h2 { margin-top: 0; }
.modal-close {
  float: right;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem;
}
.modal-close:hover { color: var(--text); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.pagination {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.pagination button,
.pagination a {
  padding: 0.4rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}
.pagination button:hover,
.pagination a:hover { border-color: var(--accent); }
.pagination button.active,
.pagination a.active { background: var(--accent); color: #000; border-color: var(--accent); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

.actions-cell { white-space: nowrap; }
.actions-cell .btn + .btn { margin-left: 0.25rem; }

.flash {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.flash-ok { background: rgba(16,185,129,0.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.flash-err { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.flash-dismiss {
  background: none; border: none;
  color: inherit; opacity: 0.6; cursor: pointer;
  font-size: 1rem; padding: 0 0.25rem;
}
.flash-dismiss:hover { opacity: 1; }

.scan-progress { margin: 1rem 0; }
.scan-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}
.scan-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 1s ease;
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.search-bar input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 0.9rem;
}
.search-bar input:focus { outline: none; border-color: var(--accent); }
.search-bar select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  color: var(--text);
  font-size: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state-text { font-size: 0.9rem; }

.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.detail-panel h3 { margin-top: 0; }
.detail-grid {
  display: grid;
  grid-template-columns: minmax(100px, auto) 1fr;
  gap: 0.5rem 1rem;
}
.detail-grid dt { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.detail-grid dd { margin: 0; }

.htmx-indicator { opacity: 0; transition: opacity 0.2s; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.25rem;
  display: inline-block;
  height: 1em;
  width: 100%;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.chart-container h3 { margin-top: 0; font-size: 1rem; }
.chart-canvas-wrapper { position: relative; height: 200px; }

.filters-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}
.filters-bar label { font-size: 0.8rem; color: var(--muted); }
.filters-bar select,
.filters-bar input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.35rem 0.5rem;
  color: var(--text);
  font-size: 0.85rem;
}

/* Mobile-responsive table wrapper */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-responsive .admin-table { min-width: 600px; }

/* Badge styles */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-ok    { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-warn  { background: rgba(245,158,11,0.15); color: #fcd34d; }
.badge-err   { background: rgba(239,68,68,0.15); color: #fca5a5; }
.badge-info  { background: rgba(79,156,255,0.15); color: #93c5fd; }

/* Toast notifications (floating flash) */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  animation: slideIn 0.25s ease-out;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.toast-ok   { background: rgba(16,185,129,0.9); color: #000; }
.toast-err  { background: rgba(239,68,68,0.9); color: #fff; }
.toast-close { background: none; border: none; color: inherit; cursor: pointer; opacity: 0.7; font-size: 1rem; padding: 0; }
.toast-close:hover { opacity: 1; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Confirmation dialog */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease-out;
}
.confirm-dialog {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  animation: slideUp 0.2s ease-out;
  text-align: center;
}
.confirm-dialog h3 { margin-top: 0; }
.confirm-dialog p { margin-bottom: 1.5rem; color: var(--muted); }
.confirm-dialog .row { justify-content: center; gap: 0.75rem; }
.confirm-dialog .btn-danger { background: #ef4444; color: #fff; }
.confirm-dialog .btn-danger:hover { background: #dc2626; }

/* Card grid layout */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Tag / chip styles */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

/* Sub navigation tabs */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab-bar a,
.tab-bar button {
  padding: 0.6rem 1.2rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.tab-bar a:hover,
.tab-bar button:hover { color: var(--text); }
.tab-bar a.active,
.tab-bar button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Responsive breakpoints */
@media (max-width: 768px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .stat-value { font-size: 1.5rem; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filters-bar select,
  .filters-bar input,
  .filters-bar .btn { width: 100%; }
  .search-bar { flex-direction: column; }
  .modal-content { padding: 1.25rem; width: 95%; }
  .detail-grid { grid-template-columns: 1fr; }
  .tab-bar { overflow-x: auto; }
  .tab-bar a,
  .tab-bar button { white-space: nowrap; padding: 0.5rem 0.8rem; }
  .admin-table { font-size: 0.8rem; }
  .admin-table th,
  .admin-table td { padding: 0.4rem 0.3rem; }
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}
