/* ============================================================
   AmericanQMS — Admin styles
   Layered on top of styles.css. Used by /admin/* pages only.
   ============================================================ */


.admin-body { background: var(--cream); }

/* Admins typically have larger screens — give the dashboard more horizontal
   room so the certificates table doesn't need sideways scrolling. */
.admin-body .container { max-width: 1320px; }


/* ===== Admin top bar (used on dashboard) ===== */
.admin-bar {
  background: var(--navy);
  color: var(--cream);
  border-bottom: 3px solid var(--brass);
}
.admin-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 24px;
}
.admin-bar__brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--cream);
  text-decoration: none;
}
.admin-bar__wm {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.005em;
  color: var(--cream);
  line-height: 1;
}
.admin-bar__wm-accent { color: var(--brass); }
.admin-bar__pill {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--navy);
  background: var(--brass);
  padding: 4px 10px;
  border-radius: 100px;
}
.admin-bar__right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-bar__user {
  font-size: 14px;
  color: rgba(250, 247, 242, 0.85);
}
.admin-bar__user::before {
  content: "Signed in as ";
  color: rgba(250, 247, 242, 0.55);
}


/* ===== Login card ===== */
.admin-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.admin-auth__card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--brass);
  border-radius: var(--radius);
  padding: 40px 36px;
  box-shadow: var(--shadow);
  text-align: center;
}
.admin-auth__brand { display: inline-block; margin-bottom: 24px; }
.admin-auth__logo { height: 56px; width: auto; }
.admin-auth__title {
  font-size: 32px;
  margin: 0 0 10px;
  color: var(--navy);
}
.admin-auth__sub {
  font-size: 14px;
  color: var(--ink-500);
  margin: 0 0 28px;
}
.admin-auth .form {
  background: transparent;
  border: none;
  border-top: none;
  padding: 0;
  text-align: left;
}
.admin-auth .form-submit { width: 100%; margin-top: 4px; }
.admin-auth__back {
  margin: 24px 0 0;
  font-size: 13px;
  color: var(--ink-500);
}
.admin-auth__back a { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }


/* ===== Page hero (smaller than public site hero) ===== */
.admin-page-hero {
  padding: clamp(40px, 6vw, 72px) 0 clamp(28px, 4vw, 48px);
  background: var(--white);
  border-bottom: 1px solid var(--rule-soft);
}
.admin-page-hero__title {
  font-size: clamp(32px, 4.5vw, 48px);
  margin: 6px 0 12px;
  color: var(--navy);
}
.admin-page-hero__sub {
  font-size: 15px;
  color: var(--ink-500);
  max-width: 600px;
  margin: 0;
  line-height: 1.55;
}


/* ===== Admin "card" (used for the add form) ===== */
.admin-card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--brass);
  border-radius: var(--radius);
  padding: 36px;
}
.admin-card__header { margin-bottom: 24px; }
.admin-card__title {
  font-size: 22px;
  margin: 6px 0 6px;
  color: var(--navy);
}
.admin-card__sub {
  font-size: 14px;
  color: var(--ink-500);
  margin: 0;
}
.admin-card__sub code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--cream);
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 12.5px;
  color: var(--navy);
  border: 1px solid var(--rule);
}
.admin-card .form { background: transparent; border: none; border-top: none; padding: 0; }


/* ===== List header ===== */
.admin-list-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 24px;
}
.admin-list-header__title {
  font-size: 26px;
  margin: 6px 0 0;
  color: var(--navy);
}
.admin-list-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-search {
  width: 280px;
  padding: 10px 14px;
  font-size: 14.5px;
}
@media (max-width: 560px) {
  .admin-search { width: 100%; }
  .admin-list-header__actions { width: 100%; }
}


/* ===== Certificates table ===== */
.admin-table-wrap {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.admin-table thead th {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-700);
  text-align: left;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--cream);
  white-space: nowrap;
}
.admin-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--ink-700);
  vertical-align: top;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(176, 141, 87, 0.03); }
.admin-table__cert-no {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--navy);
  font-weight: 600;
}
.admin-table__company {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--navy);
  font-size: 14.5px;
  line-height: 1.3;
  /* Let long company names wrap to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 280px;
}
.admin-table__standard {
  color: var(--ink-500);
  font-size: 13.5px;
  white-space: nowrap;
}
/* Scope text in the Company cell — wraps to at most 2 lines with ellipsis */
.admin-table__scope {
  color: var(--ink-500);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.admin-table__date {
  color: var(--ink-500);
  font-size: 13.5px;
  white-space: nowrap;
}
.admin-table__date--expired {
  color: #8B2622;
  font-weight: 600;
  background: rgba(176, 50, 46, 0.09);
  border: 1px solid rgba(176, 50, 46, 0.28);
  padding: 3px 9px;
  border-radius: 3px;
  display: inline-block;
}
.detail-list dd .date-expired {
  color: #8B2622;
  font-weight: 600;
  background: rgba(176, 50, 46, 0.08);
  border: 1px solid rgba(176, 50, 46, 0.28);
  padding: 3px 9px;
  border-radius: 3px;
  display: inline-block;
}
.admin-table__empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-500);
  font-size: 14px;
}
.admin-table__muted {
  color: var(--ink-500);
  opacity: 0.55;
  font-size: 13px;
}

/* Clickable rows */
.admin-table--clickable tbody tr { cursor: pointer; }
.admin-table--clickable tbody tr:hover .admin-table__company {
  color: var(--brass-700);
}


/* ===== Detail modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 37, 69, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.modal__panel {
  position: relative;
  background: var(--white);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--brass);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow);
}
.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 32px 16px;
  border-bottom: 1px solid var(--rule-soft);
}
.modal__eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass-700);
  margin: 0 0 6px;
}
.modal__title {
  font-size: 24px;
  color: var(--navy);
  margin: 0;
  line-height: 1.2;
}
.modal__close {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-500);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.modal__close:hover {
  color: var(--navy);
  border-color: var(--navy);
  background: var(--cream);
}
.modal__body {
  padding: 24px 32px 32px;
}


/* ===== Detail definition list (inside modal) ===== */
.detail-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px 24px;
  margin: 0;
  font-size: 14.5px;
}
.detail-list dt {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-700);
  padding-top: 2px;
}
.detail-list dd {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
  word-break: break-word;
}
.detail-list dd code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--cream);
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 13px;
  color: var(--navy);
  border: 1px solid var(--rule);
  letter-spacing: 0.04em;
}
.detail-list dd a { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.detail-list dd a:hover { color: var(--brass-700); }
.detail-list__section {
  grid-column: 1 / -1;
  border-top: 1px solid var(--rule-soft);
  margin: 14px 0 4px;
  padding-top: 18px;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.04em;
}
.detail-list__muted { color: var(--ink-500); opacity: 0.6; }


/* ===== Modal action row (view-mode and edit-mode buttons) ===== */
.modal__actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--rule-soft);
}
.modal__actions--end { justify-content: flex-end; }
.modal__actions-group { display: flex; gap: 10px; align-items: center; }
@media (max-width: 480px) {
  .modal__actions { flex-direction: column-reverse; align-items: stretch; }
  .modal__actions-group { flex-direction: column-reverse; }
  .modal__actions .btn { width: 100%; }
}


/* ===== Inline delete confirmation (replaces window.confirm) ===== */
.delete-confirm__warning {
  display: flex;
  gap: 16px;
  padding: 18px 20px;
  background: rgba(176, 50, 46, 0.05);
  border: 1px solid rgba(176, 50, 46, 0.25);
  border-left: 3px solid #B0322E;
  border-radius: var(--radius);
  margin-bottom: 22px;
  align-items: flex-start;
}
.delete-confirm__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: #B0322E;
  color: var(--cream);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.delete-confirm__lede {
  font-size: 16px;
  color: var(--ink);
  margin: 0 0 6px;
  line-height: 1.5;
}
.delete-confirm__lede strong { color: #8B2622; }
.delete-confirm__sub {
  font-size: 13.5px;
  color: var(--ink-500);
  margin: 0;
  line-height: 1.55;
}
.delete-confirm__details {
  background: var(--cream);
  border: 1px solid var(--rule);
  padding: 18px 22px;
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 18px;
  margin: 0 0 18px;
  font-size: 14px;
}
.delete-confirm__details dt {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-700);
  padding-top: 1px;
}
.delete-confirm__details dd { margin: 0; color: var(--ink); }
.delete-confirm__details code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--white);
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 13px;
  color: var(--navy);
  border: 1px solid var(--rule);
  letter-spacing: 0.04em;
}
@media (max-width: 480px) {
  .delete-confirm__details { grid-template-columns: 1fr; gap: 2px 0; }
  .delete-confirm__details dt { padding-top: 10px; }
}


/* ===== Danger button (delete / destructive actions) ===== */
.btn--danger {
  background: #B0322E;
  color: var(--cream);
  border-color: #B0322E;
}
.btn--danger:hover {
  background: #8B2622;
  border-color: #8B2622;
  color: var(--cream);
}
.btn--danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}


/* ===== Edit form inside the modal ===== */
.edit-form { display: grid; gap: 16px; margin: 0; }
.edit-form__readonly {
  background: var(--cream);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--brass);
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink-500);
}
.edit-form__readonly strong { color: var(--navy); font-weight: 600; }
.edit-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.edit-form .form-group { margin-bottom: 0; }
.edit-form__result {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
}
@media (max-width: 560px) {
  .edit-form__row { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .modal__header, .modal__body { padding-left: 22px; padding-right: 22px; }
  .modal__title { font-size: 20px; }
  .detail-list { grid-template-columns: 1fr; gap: 4px 0; }
  .detail-list dt { padding-top: 12px; }
  .detail-list dd { padding-bottom: 10px; }
}


/* Status pills */
.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.status-pill--active     { background: rgba(11, 37, 69, 0.92); color: var(--cream); }
.status-pill--suspended  { background: rgba(176, 141, 87, 0.15); color: var(--brass-700); border-color: rgba(176, 141, 87, 0.4); }
.status-pill--withdrawn  { background: rgba(176, 50, 46, 0.08);  color: #8B2622; border-color: rgba(176, 50, 46, 0.3); }
.status-pill--expired    { background: rgba(90, 100, 115, 0.08); color: var(--ink-500); border-color: var(--rule); }


/* ===== List metadata footer ===== */
.admin-list-meta {
  font-size: 13px;
  color: var(--ink-500);
  margin: 14px 0 0;
}


/* ===== Buttons - small variant for admin ===== */
.btn--small {
  padding: 9px 16px;
  font-size: 13px;
}


/* ===== Result message tone variants (extends styles.css .form-result) ===== */
.form-result--success {
  background: rgba(11, 37, 69, 0.04);
  border-color: rgba(11, 37, 69, 0.2);
}
.form-result--error {
  background: rgba(176, 50, 46, 0.06);
  border-color: rgba(176, 50, 46, 0.25);
  color: #8B2622;
}
.form-result--error strong { color: #8B2622; }
