/**
 * HRMS supplemental stylesheet, loaded AFTER the Metronic Tailwind build
 * (output.css). Carries: brand overrides, the app shell layout, and a few
 * semantic helpers Metronic/KTUI does not provide. Everything else in
 * templates is KTUI components (kt-btn, kt-card, kt-input, kt-table, ...)
 * plus Tailwind utilities from output.css.
 */

:root {
  /* Brand: TKM dark green + gold on warm ivory neutrals */
  --primary: #004C31;
  --primary-darker: #00331F;
  --accent-gold: #B4A057;
  --accent-cyan: #B4A057; /* legacy alias kept pointing at gold */

  --hrms-sidebar-bg: #00331F;
  --hrms-sidebar-fg: #D7E3DD;
  --hrms-surface-alt: #FAF8F2;
  --hrms-border: #E7E2D6;
  --hrms-muted: #6F6A5F;
  --hrms-text: #1C1A14;
}

[x-cloak] { display: none !important; }

html { background: var(--hrms-surface-alt); }
body { color: var(--hrms-text); font-size: 0.9375rem; }

/* ─── App shell: fixed sidebar on md+, slide-over drawer below ─── */
.app-shell { display: flex; min-height: 100dvh; }

.app-sidebar {
  position: fixed; inset-block: 0; left: 0; z-index: 40;
  width: 16rem; display: flex; flex-direction: column;
  background: var(--hrms-sidebar-bg); color: var(--hrms-sidebar-fg);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}
.app-sidebar.is-open { transform: translateX(0); }
@media (min-width: 768px) { .app-sidebar { transform: none; } }

.sidebar-brand {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 1rem 1.25rem; color: #fff; font-weight: 700; font-size: 1.05rem;
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
  text-decoration: none;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem 0.625rem; }
.sidebar-section {
  padding: 0.875rem 0.625rem 0.25rem; font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: rgb(255 255 255 / 0.4);
}
.sidebar-link {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem 0.625rem; margin-bottom: 1px; border-radius: 0.5rem;
  font-size: 0.875rem; color: var(--hrms-sidebar-fg); text-decoration: none;
}
.sidebar-link .ph { font-size: 1.125rem; }
.sidebar-link:hover { background: rgb(255 255 255 / 0.06); color: #fff; }
.sidebar-link.is-active { background: var(--primary); color: #fff; }
.sidebar-footer { padding: 0.875rem 1.25rem; border-top: 1px solid rgb(255 255 255 / 0.08); font-size: 0.8125rem; }

.sidebar-backdrop { position: fixed; inset: 0; z-index: 30; background: rgb(0 18 11 / 0.5); }
@media (min-width: 768px) { .sidebar-backdrop { display: none; } }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
@media (min-width: 768px) { .app-main { margin-left: 16rem; } }

.app-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 1rem; background: #fff;
  border-bottom: 1px solid var(--hrms-border);
}
.app-content { flex: 1; padding: 1rem; }
@media (min-width: 768px) { .app-content { padding: 1.5rem; } }

/* ─── Page furniture ─── */
.page-header-title { font-size: 1.25rem; font-weight: 700; }
.page-header-sub { font-size: 0.8125rem; color: var(--hrms-muted); margin-bottom: 1rem; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.page-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.breadcrumb { font-size: 0.8125rem; color: var(--hrms-muted); margin-bottom: 0.375rem; }
.breadcrumb a { color: var(--hrms-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 0.625rem; align-items: end; }

.form-sticky-footer {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; justify-content: flex-end; gap: 0.5rem;
  padding: 0.75rem 1rem; margin-top: 1rem;
  background: #fff; border-top: 1px solid var(--hrms-border);
}

.panel-section { padding: 0.75rem 0; border-bottom: 1px solid var(--hrms-border); }
.panel-section:last-of-type { border-bottom: 0; }
.panel-section h2, .panel-section-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.625rem; color: var(--primary-darker); }

.stat-card { display: flex; flex-direction: column; gap: 0.25rem; }
.stat-label { font-size: 0.75rem; color: var(--hrms-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.375rem; font-weight: 700; }

.empty-state { text-align: center; padding: 2rem 1rem; color: var(--hrms-muted); }

.desc-list { display: grid; grid-template-columns: 1fr; gap: 0.375rem 1.5rem; font-size: 0.875rem; }
@media (min-width: 640px) { .desc-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.desc-item .k { font-size: 0.75rem; color: var(--hrms-muted); }
.desc-item .v { font-weight: 500; }

/* ─── Mobile card list: the dual-render partner of desktop tables (§15.4) ─── */
.row-cards { list-style: none; margin: 0; padding: 0; }
.row-cards > li { padding: 0.75rem 0.25rem; border-bottom: 1px solid var(--hrms-border); }
.row-cards > li:last-child { border-bottom: 0; }
.row-card-line { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.8125rem; padding: 0.125rem 0; }
.row-card-line .k { color: var(--hrms-muted); }

.num { text-align: right; font-variant-numeric: tabular-nums; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding-top: 0.75rem; font-size: 0.8125rem; color: var(--hrms-muted); }

/* ─── Alpine-driven modal (no KTUI JS dependency) ─── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgb(0 18 11 / 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 640px) { .modal-backdrop { align-items: center; padding: 1.5rem; } }
.modal-panel {
  width: 100%; max-width: 34rem; max-height: 92dvh; overflow-y: auto;
  background: #fff; border-radius: 1rem 1rem 0 0; padding: 1.25rem;
}
@media (min-width: 640px) { .modal-panel { border-radius: 1rem; } }
.modal-panel.modal-lg { max-width: 50rem; }
.modal-title { font-size: 1.0625rem; font-weight: 600; margin-bottom: 0.875rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }

/* ─── Alpine tabs ─── */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--hrms-border); margin-bottom: 1rem; overflow-x: auto; }
.tab {
  padding: 0.5rem 0.875rem; font-size: 0.875rem; font-weight: 500;
  color: var(--hrms-muted); border: 0; border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap; background: none;
}
.tab:hover { color: var(--hrms-text); }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── Super-admin tab bar (module: superadmin) ─── */
.sa-tabs-card { padding: 0.375rem; }
.sa-tabs {
  display: flex; gap: 0.25rem; align-items: stretch;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.sa-tabs::-webkit-scrollbar { display: none; }
.sa-tab {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 1rem; border-radius: 0.625rem;
  font-family: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.2;
  color: var(--hrms-muted); white-space: nowrap; text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.sa-tab i { font-size: 1.0625rem; color: var(--hrms-muted); transition: color .15s ease; }
.sa-tab:hover { color: var(--primary); background: rgba(0, 76, 49, 0.06); }
.sa-tab:hover i { color: var(--accent-gold); }
.sa-tab.is-active {
  color: var(--primary); font-weight: 600;
  background: rgba(0, 76, 49, 0.08);
  border-bottom-color: var(--primary);
}
.sa-tab.is-active i { color: var(--accent-gold); }

/* ─── Toasts (Swal shim in footer.php) ─── */
.toast-stack { position: fixed; top: 1rem; right: 1rem; z-index: 70; display: flex; flex-direction: column; gap: 0.5rem; max-width: calc(100vw - 2rem); }
.hrms-toast {
  display: flex; align-items: flex-start; gap: 0.625rem;
  background: var(--primary-darker); color: #fff;
  border-radius: 0.625rem; padding: 0.75rem 1rem;
  font-size: 0.875rem; box-shadow: 0 8px 24px rgb(0 0 0 / 0.2);
}
.hrms-toast.toast-success { background: #16A34A; }
.hrms-toast.toast-error { background: #DC2626; }
.hrms-toast.toast-warning { background: #B45309; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 9999px;
  background: var(--primary); color: #fff; font-size: 0.8125rem; font-weight: 600;
  flex-shrink: 0;
}

.spinner {
  width: 1.125rem; height: 1.125rem; border-radius: 9999px;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: hrms-spin 0.7s linear infinite;
}
@keyframes hrms-spin { to { transform: rotate(360deg); } }

/* ── vanilla-calendar-pro: green accent to match the app primary (no cyan/blue).
   The vendored CSS hardcodes cyan (rgb 6 182 212) for the selected date and
   today; override to var(--primary). !important beats the library specificity. */
.vc-date[data-vc-date-selected] .vc-date__btn {
  background-color: var(--primary) !important;
  color: #fff !important;
}
.vc-date[data-vc-date-today] .vc-date__btn { color: var(--primary) !important; }
[data-vc=calendar] [data-vc-arrow]:hover,
[data-vc=calendar] .vc-date__btn:hover { color: var(--primary); }
