/* ==========================================================================
   SKBTP System — shared styles
   Clean white / navy / gold "registry ledger" theme.
   Tailwind (CDN) handles utility classes; this file covers the pieces
   Tailwind's CDN build can't express: responsive table -> card collapse,
   toast/modal animation, and a few signature ledger details.
   ========================================================================== */

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  font-variant-numeric: tabular-nums;
}

/* ---- Ledger section header (signature element) -------------------------
   Each data table sits in a "ledger" card: a navy tab with a gold corner
   fold, echoing a physical staff registry / service-record book. */
.ledger-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15,61,104,0.06), 0 1px 12px rgba(15,61,104,0.05);
  overflow: hidden;
}

.ledger-tab {
  position: relative;
  background: #0F3D68;
  color: #fff;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ledger-tab::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 16px 16px 0;
  border-color: transparent #B8860B transparent transparent;
}

.ledger-tab h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.ledger-count {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  letter-spacing: 0.03em;
}

/* ---- Score inputs -------------------------------------------------------- */
.score-input {
  width: 100%;
  min-width: 64px;
  max-width: 90px;
  padding: 0.4rem 0.35rem;
  text-align: center;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-weight: 600;
  color: #0F3D68;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.score-input:focus {
  outline: none;
  border-color: #0F3D68;
  box-shadow: 0 0 0 3px rgba(15,61,104,0.15);
}
.score-input.just-saved {
  border-color: #15803D;
  box-shadow: 0 0 0 3px rgba(21,128,61,0.15);
}

/* ---- Responsive tables ---------------------------------------------------
   Desktop/tablet: normal table.
   Mobile (<768px): collapse each row into a labelled record card so
   nothing overlaps or requires horizontal scrolling. */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th {
  white-space: nowrap;
  padding: 0.65rem 0.6rem;
  border: 1px solid #E2E8F0;
}

.data-table td {
  padding: 0.55rem 0.6rem;
  border: 1px solid #E2E8F0;
  vertical-align: middle;
}

.name-col {
  min-width: 220px;
  white-space: normal;
  word-break: break-word;
  text-align: left;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.chip-btn {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  color: #fff;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.chip-btn:active { transform: scale(0.96); }

@media (max-width: 767px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tr {
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: #fff;
  }
  .data-table tr:nth-child(2n) { background: #F8FAFC; }
  .data-table td {
    border: none;
    border-bottom: 1px dashed #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0.1rem;
  }
  .data-table td:last-child { border-bottom: none; }
  .data-table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748B;
    flex-shrink: 0;
  }
  .data-table td.name-col {
    display: block;
  }
  .data-table td.name-col::before { display: none; }
  .score-input { max-width: 110px; margin-left: auto; }
}

/* ---- Toasts ---------------------------------------------------------- */
.toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 320px;
  background: #1E293B;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toast-in 0.2s ease-out;
}
.toast.success { background: #15803D; }
.toast.error { background: #B91C1C; }
.toast.fade-out { animation: toast-out 0.2s ease-in forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-6px); }
}

/* ---- Confirm modal ----------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 60;
  animation: fade-in 0.15s ease-out;
}
.modal-box {
  background: #fff;
  border-radius: 14px;
  max-width: 380px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: pop-in 0.15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* Empty state */
.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  color: #94A3B8;
  font-style: italic;
  font-size: 0.85rem;
}
