/* ===========================================================
   NLS Salary Advance System — Stylesheet
   Brand: deep teal + gold, shield motif (per company logo)
   =========================================================== */

:root {
  --color-primary: #0E6E84;
  --color-primary-dark: #0A5567;
  --color-primary-light: #E1F0F3;
  --color-accent: #C9A227;
  --color-accent-dark: #A8841A;
  --color-bg: #F4F7F8;
  --color-surface: #FFFFFF;
  --color-text: #1F2937;
  --color-text-muted: #6B7280;
  --color-border: #E2E8EA;

  --color-success: #1B8A5A;
  --color-success-bg: #E7F5EE;
  --color-warning: #D97706;
  --color-warning-bg: #FEF3E2;
  --color-danger: #DC2626;
  --color-danger-bg: #FCEAEA;
  --color-info: #0E6E84;
  --color-info-bg: #E1F0F3;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ---------- Layout shells ---------- */

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  background: var(--color-primary);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.site-header img.logo { height: 38px; width: auto; }

.site-header .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.site-header .brand-text strong { font-size: 16px; letter-spacing: 0.3px; }
.site-header .brand-text span { font-size: 11px; font-style: italic; color: var(--color-accent); }

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px 60px;
  width: 100%;
}

.container-wide {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  width: 100%;
}

.site-footer {
  text-align: center;
  padding: 18px;
  font-size: 12px;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* ---------- Card ---------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  margin-bottom: 20px;
}

.card-header {
  margin-bottom: 20px;
}

.card-header h1, .card-header h2 {
  margin: 0 0 4px;
}

.card-header p { margin: 0; color: var(--color-text-muted); font-size: 14px; }

/* ---------- Typography ---------- */

h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-primary);
  margin: 28px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}
.section-title:first-child { margin-top: 0; }

/* ---------- Forms ---------- */

.form-group { margin-bottom: 18px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}

label .required { color: var(--color-danger); }

label .hint {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 12px;
  display: block;
  margin-top: 2px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

input:disabled, select:disabled { background: var(--color-bg); color: var(--color-text-muted); }

textarea { resize: vertical; min-height: 80px; }

.field-error {
  color: var(--color-danger);
  font-size: 12px;
  margin-top: 4px;
}

.is-invalid { border-color: var(--color-danger) !important; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.checkbox-row input { width: auto; margin-top: 3px; }
.checkbox-row label { margin: 0; font-weight: 400; font-size: 13.5px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-accent { background: var(--color-accent); color: #1F2937; }
.btn-accent:hover { background: var(--color-accent-dark); }

.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #156e48; }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-outline { background: transparent; color: var(--color-text); border-color: var(--color-border); }
.btn-outline:hover { background: var(--color-bg); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Alerts ---------- */

.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-success { background: var(--color-success-bg); color: #0f5c3c; border-color: #b7e2cc; }
.alert-danger  { background: var(--color-danger-bg); color: #8c1f1f; border-color: #f3bcbc; }
.alert-warning { background: var(--color-warning-bg); color: #8a5108; border-color: #f5d9a8; }
.alert-info    { background: var(--color-info-bg); color: var(--color-primary-dark); border-color: #bfe0e7; }

/* ---------- Shield-shaped status badge (brand signature element) ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px 5px 10px;
  border-radius: 4px 4px 10px 10px / 4px 4px 16px 16px;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 1px 1px 4px 4px;
  display: inline-block;
}

.badge-approved { background: var(--color-success-bg); color: #0f5c3c; }
.badge-approved::before { background: var(--color-success); }

.badge-rejected { background: var(--color-danger-bg); color: #8c1f1f; }
.badge-rejected::before { background: var(--color-danger); }

.badge-pending { background: var(--color-warning-bg); color: #8a5108; }
.badge-pending::before { background: var(--color-warning); }

.badge-withdrawn { background: #EEF0F1; color: #4B5563; }
.badge-withdrawn::before { background: #9CA3AF; }

/* ---------- Approval stepper ---------- */

.stepper {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin: 24px 0;
  position: relative;
}

.stepper::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 5%;
  right: 5%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
  z-index: 1;
}

.step .dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.step.is-approved .dot { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.step.is-rejected .dot { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.step.is-current .dot { background: var(--color-warning); border-color: var(--color-warning); color: #fff; }

.step .label { font-size: 12px; font-weight: 600; color: var(--color-text); }
.step .sublabel { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: var(--color-surface);
}

table.data-table th {
  background: var(--color-bg);
  text-align: left;
  padding: 11px 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

table.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

table.data-table tbody tr:hover { background: var(--color-bg); }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* ---------- Dashboard stat cards ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.stat-card .stat-label { font-size: 12px; color: var(--color-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; color: var(--color-primary); }
.stat-card.is-accent .stat-value { color: var(--color-accent-dark); }
.stat-card.is-danger .stat-value { color: var(--color-danger); }
.stat-card.is-success .stat-value { color: var(--color-success); }

/* ---------- Admin shell ---------- */

.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 240px;
  background: var(--color-primary-dark);
  color: #fff;
  flex-shrink: 0;
  padding: 20px 0;
}

.admin-sidebar .brand { padding: 0 20px 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.15); margin-bottom: 16px; }
.admin-sidebar .brand img { height: 32px; }
.admin-sidebar .brand strong { font-size: 14px; }
.admin-sidebar .brand span { font-size: 10px; color: var(--color-accent); display: block; font-style: italic; }

.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.85);
  font-size: 13.5px;
  font-weight: 500;
}
.admin-sidebar nav a:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.admin-sidebar nav a.active { background: rgba(255,255,255,0.15); color: #fff; border-right: 3px solid var(--color-accent); }

.admin-main { flex: 1; background: var(--color-bg); min-width: 0; }

.admin-topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-topbar .user-chip { font-size: 13px; display: flex; align-items: center; gap: 10px; }
.admin-topbar .user-chip .role-tag {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
}

@media (max-width: 860px) {
  .admin-sidebar { display: none; }
}

/* ---------- Filter bar ---------- */

.filter-bar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filter-bar .form-group { margin-bottom: 0; min-width: 160px; flex: 1; }

/* ---------- Misc ---------- */

.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gap-8 { gap: 8px; }

.autofill-banner {
  display: none;
  background: var(--color-info-bg);
  border: 1px solid #bfe0e7;
  color: var(--color-primary-dark);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 8px;
  align-items: center;
  gap: 8px;
}
.autofill-banner.is-visible { display: flex; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pagination { display: flex; gap: 6px; margin-top: 16px; justify-content: center; }
.pagination a, .pagination span {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.pagination a:hover { background: var(--color-bg); text-decoration: none; }
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ---------- Repeatable site-attendance blocks ---------- */

.site-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  padding: 16px;
  margin-bottom: 14px;
  position: relative;
}

.site-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.site-block-header .site-block-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.site-block-remove {
  background: transparent;
  border: 1px solid #f3bcbc;
  color: var(--color-danger);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  cursor: pointer;
}
.site-block-remove:hover { background: var(--color-danger-bg); }

.site-add-more-row {
  display: flex;
  justify-content: flex-start;
  margin: 4px 0 22px;
}

/* Searchable site dropdown (combobox pattern: text input + filtered list) */
.site-search-wrap { position: relative; }

.site-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 230px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 20;
  display: none;
}
.site-search-results.is-open { display: block; }

.site-search-results .option {
  padding: 9px 12px;
  font-size: 13.5px;
  cursor: pointer;
}
.site-search-results .option:hover,
.site-search-results .option.is-highlighted { background: var(--color-primary-light); }

.site-search-results .no-results {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.site-selected-chip {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--color-primary-light);
  border: 1px solid #bfe0e7;
  color: var(--color-primary-dark);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 6px;
}
.site-selected-chip.is-visible { display: flex; }
.site-selected-chip button {
  background: transparent;
  border: none;
  color: var(--color-primary-dark);
  cursor: pointer;
  font-size: 13px;
  text-decoration: underline;
  padding: 0;
}
