/* ================================================================
   LEAVE TRACKER — leave-tracker.css
   All lt-* scoped styles. Loaded only when Leave Tracker tab is used.
================================================================ */

/* ── Leave code colours ──────────────────────────────────────── */
.lt-code-P { background: #f0f9ff; color: #0369a1; }
.lt-code-A { background: #dcfce7; color: #166534; }
.lt-code-S { background: #fee2e2; color: #991b1b; }
.lt-code-U { background: #ccfbf1; color: #115e59; }
.lt-code-B { background: #dbeafe; color: #1e3a8a; }

[data-bs-theme="dark"] .lt-code-P { background: #0c2a45; color: #7dd3fc; }
[data-bs-theme="dark"] .lt-code-A { background: #14532d; color: #86efac; }
[data-bs-theme="dark"] .lt-code-S { background: #7f1d1d; color: #fca5a5; }
[data-bs-theme="dark"] .lt-code-U { background: #134e4a; color: #5eead4; }
[data-bs-theme="dark"] .lt-code-B { background: #1e3a8a; color: #93c5fd; }

/* ── Employment type badges ──────────────────────────────────── */
.lt-badge-fixed    { background: #eff6ff; color: #1d4ed8; font-size: .65rem; }
.lt-badge-variable { background: #fdf4ff; color: #7e22ce; font-size: .65rem; }
[data-bs-theme="dark"] .lt-badge-fixed    { background: #1e3a8a; color: #93c5fd; }
[data-bs-theme="dark"] .lt-badge-variable { background: #4a1d96; color: #d8b4fe; }

/* ── Grid wrapper ────────────────────────────────────────────── */
.lt-grid-wrapper {
  overflow-x: auto;
  border: 1px solid var(--clr-border, #e2e5ea);
  border-radius: var(--radius, 8px);
}

/* ── Grid table ──────────────────────────────────────────────── */
.lt-grid {
  border-collapse: separate;
  border-spacing: 0;
  min-width: max-content;
  width: 100%;
  font-size: .78rem;
}

.lt-grid th,
.lt-grid td {
  padding: 0;
  border-right: 1px solid var(--clr-border, #e2e5ea);
  border-bottom: 1px solid var(--clr-border, #e2e5ea);
  vertical-align: middle;
  text-align: center;
}

.lt-grid th:last-child,
.lt-grid td:last-child { border-right: none; }

/* Sticky header row */
.lt-grid thead th {
  background: var(--clr-th, #e9ebef);
  position: sticky;
  top: 0;
  z-index: 4;
}

/* Sticky name column */
.lt-name-col {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 185px;
  max-width: 220px;
  text-align: left !important;
  background: var(--clr-surface, #fff);
  box-shadow: 2px 0 5px rgba(0,0,0,.06);
}

.lt-grid thead th.lt-name-col {
  background: var(--clr-th, #e9ebef);
  z-index: 6;
}

/* ── Day header cell ─────────────────────────────────────────── */
.lt-day-hdr {
  min-width: 42px;
  width: 42px;
  padding: 5px 2px;
  line-height: 1.25;
}

.lt-day-hdr .lt-dnum {
  display: block;
  font-weight: 700;
  font-size: .76rem;
}

.lt-day-hdr .lt-dwd {
  display: block;
  font-size: .62rem;
  opacity: .6;
}

/* ── Clickable day cell ──────────────────────────────────────── */
.lt-cell {
  min-width: 42px;
  width: 42px;
  height: 36px;
  cursor: pointer;
  transition: filter .12s;
  position: relative;
}

.lt-cell:hover { filter: brightness(.88); }

/* Weekend overlay */
.lt-cell.lt-weekend-col::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.07);
  pointer-events: none;
  z-index: 1;
}

[data-bs-theme="dark"] .lt-cell.lt-weekend-col::before {
  background: rgba(0,0,0,.25);
}

/* Code badge — above the weekend overlay */
.lt-cbadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  font-size: .72rem;
  font-weight: 700;
  position: relative;
  z-index: 2;
}

/* Hours sub-label inside P/B cells */
.lt-cell-hrs {
  display: block;
  font-size: .58rem;
  font-weight: 600;
  opacity: .75;
  line-height: 1;
  position: relative;
  z-index: 2;
}

/* Overtime value colour */
.lt-ot-value { color: #d97706; font-weight: 700; }
[data-bs-theme="dark"] .lt-ot-value { color: #fbbf24; }

/* ── AL balance strip in day modal ──────────────────────────── */
.lt-al-bal {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 500;
}
.lt-al-bal-ok   { color: var(--clr-success, #188451); }
.lt-al-bal-low  { color: var(--clr-warning, #d97706); }
.lt-al-bal-none { color: var(--clr-danger,  #dc2626); font-weight: 700; }

/* ── Disabled code button ────────────────────────────────────── */
.lt-code-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
  filter: grayscale(.6);
}

/* ── Employee name cell ──────────────────────────────────────── */
.lt-name-cell { padding: 6px 10px; }

.lt-emp-name {
  display: block;
  font-weight: 600;
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 175px;
}

.lt-emp-sub {
  display: flex;
  align-items: center;
  gap: .3rem;
  margin-top: 1px;
}

.lt-emp-role {
  font-size: .67rem;
  opacity: .6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* ── Summary columns ─────────────────────────────────────────── */
.lt-sum-hdr {
  min-width: 60px;
  width: 60px;
  padding: 4px 4px;
  font-size: .63rem;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.lt-sum-hdr.divider-left { border-left: 2px solid var(--clr-border, #e2e5ea); }

.lt-sum-cell {
  min-width: 60px;
  width: 60px;
  height: 36px;
  font-weight: 600;
  font-size: .8rem;
  padding: 4px 6px;
}

.lt-sum-cell.divider-left { border-left: 2px solid var(--clr-border, #e2e5ea); }

/* AL-left colour coding */
.lt-al-ok   { color: var(--clr-success, #188451); }
.lt-al-low  { color: var(--clr-warning, #f59e0b); }
.lt-al-gone { color: var(--clr-danger,  #dc2626); }

/* ── Legend ──────────────────────────────────────────────────── */
.lt-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
}

.lt-legend-item {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}

.lt-legend-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: .67rem;
  font-weight: 700;
}

.lt-legend-weekend {
  background: rgba(0,0,0,.08);
  border-radius: 3px;
  width: 20px;
  height: 20px;
  display: inline-block;
}

[data-bs-theme="dark"] .lt-legend-weekend { background: rgba(255,255,255,.12); }

/* ── Month nav ───────────────────────────────────────────────── */
.lt-month-nav {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.lt-month-label {
  min-width: 115px;
  text-align: center;
  font-weight: 700;
  font-size: .88rem;
}

/* ── Leave code buttons in modal ─────────────────────────────── */
.lt-code-btn {
  border: 2px solid transparent;
  font-weight: 600;
  font-size: .8rem;
  padding: .3rem .7rem;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .12s, transform .08s;
}

.lt-code-btn.selected {
  border-color: currentColor;
  transform: scale(1.04);
}

.lt-code-btn-clear {
  border: 2px solid var(--clr-border, #e2e5ea);
  background: transparent;
  color: var(--clr-neutral, #5f6368);
  font-size: .8rem;
  padding: .3rem .7rem;
  border-radius: 6px;
  cursor: pointer;
}

/* ── Empty state ─────────────────────────────────────────────── */
.lt-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--clr-neutral, #5f6368);
}

/* ── Locked month ────────────────────────────────────────────── */
.lt-locked-banner {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .85rem;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: .8rem;
  color: #92400e;
  font-weight: 500;
}

[data-bs-theme="dark"] .lt-locked-banner {
  background: #2c1800;
  border-color: #78350f;
  color: #fdba74;
}

.lt-grid-locked .lt-cell {
  cursor: not-allowed !important;
  opacity: .85;
}

.lt-grid-locked .lt-cell:hover {
  filter: none !important;
}

/* ── Scroll time picker ──────────────────────────────────────── */
.lt-time-input {
  cursor: pointer !important;
  caret-color: transparent;
  user-select: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71V3.5z'/%3E%3Cpath d='M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .55rem center;
  background-size: 14px;
  padding-right: 1.9rem !important;
}

.lt-timepicker-dropdown {
  position: fixed;
  z-index: 1060;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--clr-surface, #fff);
  border: 1px solid var(--clr-border, #e2e5ea);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
}
[data-bs-theme="dark"] .lt-timepicker-dropdown {
  background: #1e2332;
  border-color: #374151;
}
.lt-timepicker-dropdown.lt-tp-open { display: flex; }

.lt-tp-col-wrap {
  position: relative;
  width: 54px;
  height: 120px;
}

.lt-tp-hl {
  position: absolute;
  top: 40px; left: -4px; right: -4px; height: 40px;
  background: rgba(37,99,235,.1);
  border-radius: 8px;
  pointer-events: none;
}
[data-bs-theme="dark"] .lt-tp-hl { background: rgba(96,165,250,.15); }

.lt-tp-col {
  position: absolute;
  inset: 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.lt-tp-col::-webkit-scrollbar { display: none; }

.lt-tp-item {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 500;
  scroll-snap-align: center;
  color: #9ca3af;
  position: relative;
  z-index: 2;
}

.lt-tp-sep {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--clr-text, #111);
  line-height: 1;
  flex-shrink: 0;
  margin-top: -4px;
}
[data-bs-theme="dark"] .lt-tp-sep { color: #f1f5f9; }

.lt-tp-ok { margin-left: 6px; flex-shrink: 0; }
