/* ═══════════════════════════════════════════════════════════════════
   Hub Pages — World-class shared styles for PrepNus Admin
   Transforms all 24 pages with premium UI/UX
   ═══════════════════════════════════════════════════════════════════ */

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(16px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes countUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.header-hub-link {
  font-size: 12px; font-weight: 600; color: var(--primary);
  text-decoration: none; margin-right: 12px;
  padding: 4px 10px; border-radius: 6px;
  transition: all 200ms ease;
}
.header-hub-link:hover { background: var(--primary-light); text-decoration: none; }

/* ── Badges (premium) ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  letter-spacing: 0.02em;
  transition: all 200ms ease;
}
.badge-success { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #065f46; border: 1px solid rgba(5,150,105,0.15); }
.badge-error { background: linear-gradient(135deg, #fef2f2, #fee2e2); color: #991b1b; border: 1px solid rgba(220,38,38,0.15); }
.badge-warning { background: linear-gradient(135deg, #fffbeb, #fef3c7); color: #92400e; border: 1px solid rgba(217,119,6,0.15); }
.badge-info { background: linear-gradient(135deg, #ecfeff, #cffafe); color: #155e75; border: 1px solid rgba(8,145,178,0.15); }
.badge-muted { background: linear-gradient(135deg, #f8fafc, #f1f5f9); color: #64748b; border: 1px solid rgba(148,163,184,0.2); }
.badge-primary { background: linear-gradient(135deg, #eff6ff, #dbeafe); color: #1e40af; border: 1px solid rgba(37,99,235,0.15); }

/* ── Buttons (polished) ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; border-radius: 8px; border: none; cursor: pointer;
  font-weight: 600; font-size: 13px; font-family: var(--font);
  transition: all 200ms ease;
  position: relative; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn:active { transform: scale(0.97); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 7px; }
.btn-xs { padding: 3px 10px; font-size: 11px; border-radius: 6px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), #1d4ed8); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,0.3); }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(37,99,235,0.4); transform: translateY(-1px); }
.btn-success { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; box-shadow: 0 2px 8px rgba(22,163,74,0.3); }
.btn-success:hover { box-shadow: 0 4px 14px rgba(22,163,74,0.4); transform: translateY(-1px); }
.btn-error { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; box-shadow: 0 2px 8px rgba(220,38,38,0.3); }
.btn-error:hover { box-shadow: 0 4px 14px rgba(220,38,38,0.4); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-secondary); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary); box-shadow: none; }
.btn-outline:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.btn-warning-outline { background: transparent; color: var(--warning); border: 1.5px solid var(--warning); box-shadow: none; }
.btn-warning-outline:hover { background: var(--warning-light); }
.btn-error-outline { background: transparent; color: var(--error); border: 1.5px solid var(--error); box-shadow: none; }
.btn-error-outline:hover { background: var(--error-light); }

/* ── Toolbar (refined) ────────────────────────────────────────── */
.toolbar {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); animation: fadeIn 300ms ease;
}
.toolbar-search { flex: 1; min-width: 200px; position: relative; }
.toolbar-search input { width: 100%; padding-left: 36px; }
.toolbar-search::before {
  content: '🔍'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 14px; opacity: 0.4; pointer-events: none;
}
.toolbar-right { display: flex; gap: 8px; margin-left: auto; }

/* ── Cards (depth + animation) ────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  transition: all 250ms ease;
  animation: fadeIn 400ms ease;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card-title {
  font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 14px;
  text-transform: uppercase; letter-spacing: 0.8px;
  display: flex; align-items: center; gap: 8px;
}
.card-title::before {
  content: ''; width: 3px; height: 14px; border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), #6366f1);
  flex-shrink: 0;
}

/* ── Stats Row (premium) ──────────────────────────────────────── */
.stats-row { display: flex; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-box {
  flex: 1; min-width: 110px; text-align: center; padding: 18px 12px;
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); position: relative; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 250ms ease;
  animation: slideUp 400ms ease both;
}
.stat-box:nth-child(1) { animation-delay: 0ms; }
.stat-box:nth-child(2) { animation-delay: 60ms; }
.stat-box:nth-child(3) { animation-delay: 120ms; }
.stat-box:nth-child(4) { animation-delay: 180ms; }
.stat-box:nth-child(5) { animation-delay: 240ms; }
.stat-box:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
.stat-box::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), #6366f1);
  border-radius: 2px 2px 0 0; opacity: 0;
  transition: opacity 200ms ease;
}
.stat-box:hover::after { opacity: 1; }
.stat-val {
  display: block; font-size: 26px; font-weight: 800; color: var(--text);
  line-height: 1.1; animation: countUp 600ms ease both;
  font-variant-numeric: tabular-nums;
}
.stat-lbl {
  display: block; font-size: 10px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px; margin-top: 6px;
}

/* ── Detail Header (elevated) ─────────────────────────────────── */
.detail-back { margin-bottom: 8px; animation: slideIn 300ms ease; }
.detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 24px; flex-wrap: wrap;
  padding: 20px; background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  animation: fadeIn 400ms ease;
}
.detail-header-left { display: flex; gap: 16px; align-items: center; }
.detail-icon {
  width: 54px; height: 54px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.detail-title { font-size: 22px; font-weight: 800; color: var(--text); margin: 0; letter-spacing: -0.3px; }
.detail-sub { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.detail-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Tabs (sleek) ─────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border-light);
  margin-bottom: 24px; overflow-x: auto; background: transparent;
  padding: 0; border-radius: 0;
  animation: fadeIn 400ms ease;
}
.tab {
  padding: 10px 20px; border: none; background: transparent; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-muted); border-radius: 0;
  transition: all 200ms ease; white-space: nowrap; font-family: var(--font);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  position: relative;
}
.tab:hover { color: var(--text); background: var(--surface-hover); }
.tab.active {
  color: var(--primary); background: transparent;
  border-bottom-color: var(--primary);
  box-shadow: none;
}

.tab-content { display: none; animation: fadeIn 300ms ease; }
.tab-content.active { display: block; }

/* ── Field Grid (refined) ─────────────────────────────────────── */
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin-bottom: 24px; }
.field-card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: all 250ms ease;
  animation: fadeIn 400ms ease both;
}
.field-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); border-color: var(--border); }
.field-card h4 {
  font-size: 11px; font-weight: 700; color: var(--primary); margin-bottom: 14px;
  text-transform: uppercase; letter-spacing: 0.8px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border-light);
}
.fields { display: flex; flex-direction: column; gap: 10px; }
.field-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 2px 0;
}
.field-label { font-size: 12px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.field-value { font-size: 12px; color: var(--text); font-weight: 600; text-align: right; word-break: break-all; }

/* ── Section Title (decorative) ───────────────────────────────── */
.section-title {
  font-size: 13px; font-weight: 700; color: var(--text-secondary);
  margin: 28px 0 12px; display: flex; align-items: center; gap: 10px;
}
.section-title::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ── Table (premium) ──────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto; margin-bottom: 20px;
  border-radius: var(--radius-lg); border: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  animation: fadeIn 400ms ease;
}
.table-wrap table { border-collapse: collapse; width: 100%; }
.table-wrap thead th {
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 12px 14px; text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table-wrap tbody td {
  padding: 10px 14px; font-size: 13px; color: var(--text);
  border-bottom: 1px solid var(--border-light);
  transition: background 150ms ease;
}
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:nth-child(even) { background: rgba(248,250,252,0.5); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--primary-light) !important; }
.cell-mono { font-family: var(--mono); font-size: 12px; color: var(--text-secondary); }
.cell-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--primary); }

/* ── Tree (polished) ──────────────────────────────────────────── */
.tree { list-style: none; padding: 0; }
.tree-node {
  border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  margin-bottom: 6px; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: all 200ms ease;
}
.tree-node:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-color: var(--border); }
.tree-node-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer; transition: all 150ms ease;
  border-radius: var(--radius-lg);
}
.tree-node-header:hover { background: var(--surface-hover); }
.tree-toggle {
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-muted); flex-shrink: 0; cursor: pointer;
  border-radius: 6px; transition: all 200ms ease;
}
.tree-toggle:hover { background: var(--primary-light); color: var(--primary); }
.tree-icon { font-size: 18px; }
.tree-label { font-weight: 600; font-size: 13px; flex: 1; }
.tree-code { font-family: var(--mono); font-size: 11px; color: var(--text-muted); background: var(--bg); padding: 2px 8px; border-radius: 4px; }
.tree-badge { margin-left: auto; }
.tree-children { padding-left: 20px; border-left: 2px solid var(--primary-light); margin-left: 20px; margin-top: 4px; }
.tree-children.collapsed { display: none; }

/* ── Modal (animated) ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: overlayIn 200ms ease;
}
.modal {
  background: var(--surface); border-radius: 16px; padding: 28px;
  max-width: 520px; width: 100%; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 4px 16px rgba(0,0,0,0.1);
  animation: modalIn 300ms ease;
}
.modal-title {
  font-size: 18px; font-weight: 800; margin-bottom: 20px; color: var(--text);
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border-light);
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border-light); }

/* ── Form (refined) ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.form-row { display: flex; gap: 14px; }
.form-row > * { flex: 1; }

/* Enhanced inputs (applies globally via prep.css override) */
.modal .input, .toolbar .input, .form-group .input {
  border-radius: 8px; padding: 9px 14px; font-size: 13px;
  border: 1.5px solid var(--border);
  transition: all 200ms ease;
  background: var(--surface);
}
.modal .input:focus, .toolbar .input:focus, .form-group .input:focus {
  border-color: var(--primary); outline: none;
  box-shadow: 0 0 0 3px var(--primary-ring);
}

/* ── Type Chips (vibrant) ─────────────────────────────────────── */
.type-chip {
  display: inline-flex; align-items: center; padding: 3px 12px;
  border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}
.type-batch_live { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #78350f; border: 1px solid rgba(251,191,36,0.3); }
.type-batch_archive { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #3730a3; border: 1px solid rgba(99,102,241,0.2); }
.type-exam_package { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #064e3b; border: 1px solid rgba(5,150,105,0.2); }
.type-addon { background: linear-gradient(135deg, #fce7f3, #fbcfe8); color: #831843; border: 1px solid rgba(236,72,153,0.2); }

/* ── Loading skeleton ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, #e8ecf1 50%, var(--border-light) 75%);
  background-size: 800px 100%; animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius); height: 16px;
}
.skeleton-row { display: flex; gap: 12px; margin-bottom: 12px; }
.skeleton-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.skeleton-text { flex: 1; height: 14px; }
.skeleton-text.short { max-width: 120px; }

/* ── Empty State ──────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
  animation: fadeIn 500ms ease;
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; line-height: 1.5; }

/* ── Color dots & chips ───────────────────────────────────────── */
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; box-shadow: inset 0 1px 2px rgba(0,0,0,0.15); }

/* ── Profile avatars ──────────────────────────────────────────── */
.prof-avatar, .avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), #dbeafe);
  color: var(--primary); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── Pagination (premium) ─────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; gap: 12px; flex-wrap: wrap;
}
.pagination-info { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.pagination-controls { display: flex; gap: 4px; }
.page-btn {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-secondary); cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: var(--font);
  transition: all 200ms ease;
}
.page-btn:hover:not(:disabled) { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Responsive (enhanced) ────────────────────────────────────── */
@media (max-width: 768px) {
  .detail-header { flex-direction: column; padding: 16px; }
  .stats-row { gap: 8px; }
  .stat-box { min-width: 80px; padding: 14px 8px; }
  .stat-val { font-size: 20px; }
  .field-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; padding: 10px 12px; }
  .toolbar-search { min-width: 100%; }
  .toolbar-right { margin-left: 0; width: 100%; }
  .tabs { gap: 0; }
  .tab { padding: 8px 14px; font-size: 12px; }
  .modal { padding: 20px; margin: 8px; border-radius: 14px; }
  .table-wrap { border-radius: var(--radius); }
}
@media (max-width: 480px) {
  .stat-box { min-width: 60px; padding: 10px 4px; }
  .stat-val { font-size: 16px; }
  .stat-lbl { font-size: 9px; }
  .detail-title { font-size: 18px; }
}

/* ── Scrollbar styling ────────────────────────────────────────── */
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-track { background: var(--border-light); border-radius: 3px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Content entry animation ──────────────────────────────────── */
.content > *:first-child { animation: fadeIn 300ms ease; }
.content .stats-row { animation: slideUp 400ms ease; }
.content .table-wrap { animation: fadeIn 500ms ease 100ms both; }
.content .field-grid { animation: fadeIn 400ms ease 150ms both; }
