/* Trung tâm Tiến trình Khảo thí (chamnhanh.net) — Mobile 360px Bottom Sheet -> Desktop 420px Drawer */

.tc-topbar-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: var(--card-bg, #ffffff);
  color: var(--brand-navy, #082850);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.tc-topbar-trigger:hover {
  border-color: var(--brand-cyan, #00c5df);
  background: var(--primary-light, #ecfeff);
}

.tc-topbar-trigger.is-active-running {
  border-color: var(--brand-cyan, #00c5df);
  background: var(--primary-light, #ecfeff);
  color: var(--brand-navy, #082850);
}

.tc-trigger-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 197, 223, 0.28);
  border-top-color: var(--brand-cyan, #00c5df);
  border-radius: 50%;
  animation: tc-spin 0.8s linear infinite;
}

.tc-trigger-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success, #10b981);
}
.tc-trigger-dot.is-danger {
  background: var(--danger, #ef4444);
}

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

.tc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10450;
  background: rgba(8, 40, 80, 0.36);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: flex-end;
}

.tc-backdrop[hidden] {
  display: none !important;
}

.tc-drawer {
  width: 420px;
  max-width: 100vw;
  height: 100dvh;
  background: var(--card-bg, #ffffff);
  color: #0f172a;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(8, 40, 80, 0.16);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.tc-drawer.is-open {
  transform: translateX(0);
}

.tc-mobile-handle {
  display: none;
}

.tc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.tc-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-navy, #082850);
}

.tc-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tc-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  overflow-x: auto;
  scrollbar-width: none;
}
.tc-tabs::-webkit-scrollbar { display: none; }

.tc-tab {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.tc-tab.active {
  background: var(--brand-navy, #082850);
  border-color: var(--brand-navy, #082850);
  color: #ffffff;
}

.tc-toolbar {
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tc-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tc-search-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 13px;
  background: #ffffff;
}

.tc-filter-toggle-btn {
  display: none;
}

.tc-filters-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tc-select {
  height: 34px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 12.5px;
  color: #1e293b;
}

.tc-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tc-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tc-card.is-unseen {
  border-color: var(--brand-cyan-border, #67e8f9);
  background: #f0fdff;
}

.tc-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tc-type-tag {
  font-size: 11.5px;
  font-weight: 700;
  color: #0369a1;
}

.tc-status-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.tc-badge-queued { background: #f1f5f9; color: #475569; }
.tc-badge-processing { background: #ecfeff; color: #0284c7; }
.tc-badge-completed { background: #ecfdf5; color: #059669; }
.tc-badge-failed { background: #fef2f2; color: #dc2626; }
.tc-badge-cancelled { background: #f8fafc; color: #64748b; }

.tc-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
}

.tc-card-subtitle {
  font-size: 12.5px;
  color: #64748b;
}

.tc-progress-wrap {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tc-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.tc-progress-fill {
  height: 100%;
  background: var(--primary-gradient, linear-gradient(135deg, #00c5df 0%, #00b4d8 100%));
  transition: width 0.3s ease;
}

.tc-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #475569;
}

.tc-error-note {
  font-size: 12px;
  color: #b91c1c;
  background: #fef2f2;
  padding: 6px 8px;
  border-radius: 8px;
}

.tc-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.tc-time {
  font-size: 11.5px;
  color: #64748b;
}

.tc-card-actions {
  display: flex;
  gap: 6px;
}

.tc-btn {
  min-height: 32px;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
}
.tc-btn-primary {
  background: var(--brand-navy, #082850);
  color: #ffffff;
}
.tc-btn-secondary {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}
.tc-btn-ghost {
  background: transparent;
  color: #64748b;
}
.tc-btn-ghost-danger {
  background: #fff5f5;
  border-color: #fecaca;
  color: #dc2626;
}
.tc-btn-load-more {
  width: 100%;
  min-height: 40px;
}

.tc-empty {
  text-align: center;
  padding: 36px 16px;
  color: #64748b;
}
.tc-empty-title {
  font-size: 15px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}
.tc-empty-desc {
  font-size: 13px;
  margin: 0;
  line-height: 1.5;
}

/* Mobile 360px - 767px: Bottom Sheet 85dvh + Touch Targets >= 44px */
@media (max-width: 767px) {
  .tc-topbar-trigger {
    padding: 0 8px;
    gap: 4px;
  }
  .tc-topbar-trigger .tc-trigger-label {
    display: none;
  }
  .tc-topbar-trigger.is-active-running .tc-trigger-label[data-mobile-count]:not([data-mobile-count=""]),
  .tc-topbar-trigger.has-unseen .tc-trigger-label[data-mobile-count]:not([data-mobile-count=""]) {
    display: inline;
    font-size: 0;
  }
  .tc-topbar-trigger.is-active-running .tc-trigger-label::after,
  .tc-topbar-trigger.has-unseen .tc-trigger-label::after {
    content: attr(data-mobile-count);
    font-size: 12px;
    font-weight: 700;
  }

  .tc-backdrop {
    align-items: flex-end;
    justify-content: stretch;
  }

  .tc-drawer {
    width: 100%;
    height: auto;
    max-height: 85dvh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  }
  .tc-drawer.is-open {
    transform: translateY(0);
  }

  .tc-mobile-handle {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: #cbd5e1;
    margin: 10px auto 2px;
  }

  .tc-filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-size: 12.5px;
    font-weight: 600;
    padding: 0 10px;
  }

  .tc-filters-bar {
    display: none;
  }
  .tc-filters-bar.is-mobile-expanded {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tc-btn,
  .tc-tab {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .tc-card-actions {
    width: 100%;
  }
  .tc-card-actions .tc-btn-primary,
  .tc-card-actions .tc-btn-secondary {
    flex: 1;
  }
}

[data-theme="dark"] .tc-drawer,
body.dark-mode .tc-drawer {
  background: #0f172a;
  color: #f1f5f9;
}
[data-theme="dark"] .tc-card,
body.dark-mode .tc-card {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .tc-card-title,
body.dark-mode .tc-card-title,
[data-theme="dark"] .tc-title,
body.dark-mode .tc-title {
  color: #f8fafc;
}
