/* style.css — Minimal custom CSS over TailwindCDN for TOPA web */

/* Vietnamese-friendly system font stack */
:root {
  --font-sans: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont,
    'Helvetica Neue', Arial, sans-serif;
  --color-brand: #1d4ed8;
  --color-brand-light: #dbeafe;
  --color-accent: #0284c7;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Nav active state */
nav a.active {
  color: var(--color-brand);
  border-bottom: 2px solid var(--color-brand);
}

/* Accordion */
.accordion-item {
  border-bottom: 1px solid #e5e7eb;
}

.accordion-trigger {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 1rem 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: #111827;
  line-height: 1.5;
}

.accordion-trigger:hover {
  color: var(--color-brand);
}

.accordion-trigger .chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  margin-top: 2px;
}

.accordion-trigger[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding-bottom: 1rem;
  color: #374151;
  font-size: 0.9rem;
  line-height: 1.7;
}

.accordion-content.open {
  display: block;
}

/* Service modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: white;
  border-radius: 0.75rem;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
}

/* Table highlight for upcoming deadlines */
.deadline-upcoming {
  background-color: #fef3c7 !important;
}

.deadline-urgent {
  background-color: #fee2e2 !important;
}

/* Search highlight */
mark {
  background-color: #fde68a;
  border-radius: 2px;
  padding: 0 2px;
}

/* Sortable table header */
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th.sortable:hover {
  background-color: #e0e7ef;
}

th.sort-asc::after { content: ' ↑'; }
th.sort-desc::after { content: ' ↓'; }

/* Mobile responsive — 768px breakpoint */
@media (max-width: 768px) {
  .modal-box {
    max-height: 92vh;
    padding: 1rem;
  }

  /* Stack table on small screens */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Card grid single column on mobile */
  .card-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Spinner animation (used in showLoading) */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 0.8s linear infinite;
}

/* Pre-formatted content_md as readable block */
pre.content-block {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.7;
  color: #374151;
  margin: 0;
}
