/* ============================================================
   Bonlec Daily Timesheet — Stylesheet
   Palette: Deep Navy #003580, Electric Blue #0047A0,
            Gold #FFB800, Off-white #F5F7FA
   ============================================================ */

:root {
  --bonlec-dark:    #003580;
  --bonlec-blue:    #0047A0;
  --bonlec-mid:     #1565C0;
  --bonlec-light:   #E3EEFF;
  --bonlec-gold:    #FFB800;
  --bonlec-bg:      #F0F4FA;
  --bonlec-surface: #FFFFFF;
  --bonlec-border:  #CBD5E1;
  --bonlec-text:    #1E293B;
  --bonlec-muted:   #64748B;
  --bonlec-danger:  #DC2626;
  --bonlec-success: #16A34A;

  --ts-row-h:       36px;
  --ts-font:        13px;
  --ts-header-bg:   var(--bonlec-dark);
  --ts-header-fg:   #FFFFFF;
  --ts-lunch-bg:    #FFF8DC;
  --ts-stripe:      #F8FAFF;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,53,128,.10);
  --shadow-lg: 0 8px 32px rgba(0,53,128,.14);
}

/* ── Reset / Base ─────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--bonlec-text);
  background: var(--bonlec-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ───────────────────────────────────────────────── */

.bg-bonlec-dark { background: var(--bonlec-dark) !important; }

.navbar {
  border-bottom: 3px solid var(--bonlec-gold);
  padding: 0 1rem;
  min-height: 56px;
}

.navbar-brand { font-family: 'Barlow Condensed', sans-serif; font-size: 1.3rem; letter-spacing: .03em; }

.brand-logo {
  width: 32px; height: 32px;
  background: var(--bonlec-gold);
  color: var(--bonlec-dark);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.2rem; font-weight: 700;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}

.navbar .nav-link { font-size: 13px; font-weight: 500; padding: .75rem .9rem !important; }
.navbar .nav-link.active { color: var(--bonlec-gold) !important; border-bottom: 2px solid var(--bonlec-gold); }

.avatar-circle {
  width: 30px; height: 30px;
  background: var(--bonlec-gold);
  color: var(--bonlec-dark);
  font-weight: 700; font-size: 13px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ── Layout ───────────────────────────────────────────────── */

.main-content { flex: 1; }

.app-footer {
  background: var(--bonlec-dark);
  color: #94A3B8;
  padding: .6rem 1rem;
  font-size: 12px;
  margin-top: auto;
}

/* ── Cards ────────────────────────────────────────────────── */

.card {
  border: 1px solid var(--bonlec-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--bonlec-surface);
}

.card-header-bonlec {
  background: var(--bonlec-dark);
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: .75rem 1.25rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  display: flex; align-items: center; gap: .5rem;
}

.card-header-bonlec .badge {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
}

/* ── Page title ───────────────────────────────────────────── */

.page-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  color: var(--bonlec-dark);
  font-weight: 700;
  letter-spacing: .02em;
  margin-bottom: .15rem;
}

.page-subtitle { color: var(--bonlec-muted); font-size: 13px; }

/* ── Buttons ──────────────────────────────────────────────── */

.btn-bonlec {
  background: var(--bonlec-dark);
  color: #fff;
  border: none;
  font-weight: 600;
  letter-spacing: .01em;
}
.btn-bonlec:hover { background: var(--bonlec-blue); color: #fff; }

.btn-bonlec-gold {
  background: var(--bonlec-gold);
  color: var(--bonlec-dark);
  border: none;
  font-weight: 700;
}
.btn-bonlec-gold:hover { background: #e6a600; color: var(--bonlec-dark); }

/* ── Forms ────────────────────────────────────────────────── */

.form-control:focus, .form-select:focus {
  border-color: var(--bonlec-blue);
  box-shadow: 0 0 0 3px rgba(0, 71, 160, .12);
}

.form-label { font-weight: 500; font-size: 13px; color: var(--bonlec-text); margin-bottom: .25rem; }

/* ── Stat cards (dashboard) ───────────────────────────────── */

.stat-card {
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.stat-card .stat-icon {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
  font-size: 3rem; opacity: .15;
}
.stat-card .stat-value { font-family: 'Barlow Condensed', sans-serif; font-size: 2rem; font-weight: 700; }
.stat-card .stat-label { font-size: 12px; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }

.stat-card.blue   { background: linear-gradient(135deg, var(--bonlec-dark), var(--bonlec-blue)); }
.stat-card.gold   { background: linear-gradient(135deg, #B45309, #D97706); }
.stat-card.green  { background: linear-gradient(135deg, #065F46, #059669); }
.stat-card.purple { background: linear-gradient(135deg, #5B21B6, #7C3AED); }

/* ── Timesheet table ──────────────────────────────────────── */

.ts-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--bonlec-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.ts-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: var(--ts-font);
  background: #fff;
}

.ts-table th {
  background: var(--bonlec-dark);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 6px 6px;
  text-align: center;
  white-space: nowrap;
  border: 1px solid rgba(255,255,255,.15);
  position: sticky;
  top: 0;
  z-index: 10;
}

.ts-table th.col-particulars { text-align: left; }

.ts-table td {
  padding: 0;
  border: 1px solid var(--bonlec-border);
  height: var(--ts-row-h);
  vertical-align: middle;
}

.ts-table tbody tr:nth-child(even) { background: var(--ts-stripe); }
.ts-table tbody tr:hover { background: var(--bonlec-light); }

.ts-table .lunch-header th {
  background: var(--bonlec-blue);
  text-align: left;
  padding-left: 10px;
}

.ts-table .lunch-row td { background: var(--ts-lunch-bg); }
.ts-table .lunch-row td input { background: transparent; }

.ts-table .total-row td {
  background: var(--bonlec-dark);
  color: #fff;
  font-weight: 700;
  text-align: center;
  padding: 6px;
}

/* Inputs inside the grid */
.ts-table td input,
.ts-table td select {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 2px 5px;
  font-size: var(--ts-font);
  font-family: inherit;
  color: var(--bonlec-text);
  text-align: center;
}

.ts-table td input.col-particulars-input,
.ts-table td input.col-job-input { text-align: left; padding-left: 6px; }

.ts-table td input:focus {
  background: rgba(0, 71, 160, .06);
  outline: 2px solid var(--bonlec-blue);
  outline-offset: -2px;
  border-radius: 2px;
}

.ts-table td select { cursor: pointer; }

/* Autocomplete dropdown */
.autocomplete-list {
  position: absolute;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--bonlec-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  min-width: 200px;
}
.autocomplete-list li {
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  list-style: none;
  border-bottom: 1px solid var(--bonlec-border);
}
.autocomplete-list li:hover, .autocomplete-list li.active {
  background: var(--bonlec-light);
  color: var(--bonlec-dark);
}
.autocomplete-list li .job-desc { color: var(--bonlec-muted); font-size: 11px; display: block; }

/* ── Bottom section ───────────────────────────────────────── */

.ts-bottom {
  display: grid;
  grid-template-columns: 140px 1fr 160px 140px 180px 80px;
  gap: 0;
  border: 1px solid var(--bonlec-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow: hidden;
}

.ts-section {
  border-right: 1px solid var(--bonlec-border);
  font-size: 12px;
}
.ts-section:last-child { border-right: none; }

.ts-section-header {
  background: var(--bonlec-dark);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-align: center;
  padding: 4px 6px;
  text-transform: uppercase;
}

.ts-section-body { padding: 6px; }

.ts-check-row {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 0;
  font-size: 12px;
}

.ts-field-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 4px;
}
.ts-field-row label { font-size: 11px; font-weight: 500; white-space: nowrap; flex-shrink: 0; }
.ts-field-row input {
  width: 60px; text-align: right;
  border: 1px solid var(--bonlec-border);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 12px;
}

.ts-signature-box {
  border-top: 1px solid var(--bonlec-border);
  min-height: 40px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--bonlec-muted);
  padding-top: 4px;
}

/* Vertical text for HOURS / ACCRUED */
.ts-vertical-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--bonlec-dark);
  text-align: center;
  padding: 8px 0;
  letter-spacing: .06em;
}

/* ── Notes row ────────────────────────────────────────────── */

.ts-notes-bar {
  background: #f8f9ff;
  border: 1px solid var(--bonlec-border);
  border-top: none;
  padding: 6px 10px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600;
}
.ts-notes-bar input {
  flex: 1;
  border: none; background: transparent;
  font-size: 12px; outline: none;
}

/* ── Submit bar ───────────────────────────────────────────── */

.ts-submit-bar {
  background: #fff;
  border: 1px solid var(--bonlec-border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: .75rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  flex-wrap: wrap;
}

.ts-hours-total {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem;
  color: var(--bonlec-dark);
  font-weight: 700;
}

/* ── Timesheet list table ─────────────────────────────────── */

.list-table th { background: var(--bonlec-dark); color: #fff; }
.list-table tr:hover td { background: var(--bonlec-light); }

/* ── Status badges ────────────────────────────────────────── */

.badge.bg-draft          { background: #64748B !important; }
.badge.bg-submitted      { background: var(--bonlec-success) !important; }
.badge.bg-pre_submitted  { background: #D97706 !important; }
.badge.bg-unlocked       { background: var(--bonlec-blue) !important; }
.badge.bg-resubmitted    { background: #7C3AED !important; }

/* ── Login page ───────────────────────────────────────────── */

.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bonlec-dark) 0%, var(--bonlec-blue) 100%);
  padding: 1rem;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 420px;
  overflow: hidden;
}

.login-header {
  background: var(--bonlec-dark);
  padding: 2rem;
  text-align: center;
}

.login-logo {
  width: 64px; height: 64px;
  background: var(--bonlec-gold);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem; font-weight: 700;
  color: var(--bonlec-dark);
  margin: 0 auto 1rem;
}

.login-header h1 {
  font-family: 'Barlow Condensed', sans-serif;
  color: #fff; font-size: 1.6rem;
  margin: 0; letter-spacing: .04em;
}

.login-header p { color: rgba(255,255,255,.6); font-size: 12px; margin: .25rem 0 0; }

.login-body { padding: 2rem; }

/* ── Week picker ──────────────────────────────────────────── */

.week-nav {
  display: flex; align-items: center; gap: .5rem;
  background: #fff;
  border: 1px solid var(--bonlec-border);
  border-radius: var(--radius-md);
  padding: .4rem .75rem;
  box-shadow: var(--shadow-sm);
}

.week-days {
  display: flex; gap: 4px; flex-wrap: wrap;
}

.week-day-btn {
  border: 1px solid var(--bonlec-border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  background: #fff;
  color: var(--bonlec-muted);
  transition: all .15s;
  text-decoration: none;
}
.week-day-btn:hover { background: var(--bonlec-light); color: var(--bonlec-dark); }
.week-day-btn.has-draft { border-color: #D97706; color: #D97706; }
.week-day-btn.has-submitted { border-color: var(--bonlec-success); color: var(--bonlec-success); background: #f0fdf4; }
.week-day-btn.active { background: var(--bonlec-dark); color: #fff; border-color: var(--bonlec-dark); }

/* ── Alerts ───────────────────────────────────────────────── */

.flash-container { margin-bottom: .75rem; }
.alert { font-size: 13px; }

/* ── Tables (admin/list) ──────────────────────────────────── */

.table thead th {
  background: var(--bonlec-dark);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: .04em;
  border: none;
  font-weight: 600;
}

.table-hover tbody tr:hover td { background: var(--bonlec-light); }

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 768px) {
  .ts-bottom {
    grid-template-columns: 1fr 1fr;
  }
  .ts-section { border-bottom: 1px solid var(--bonlec-border); }

  .page-title { font-size: 1.3rem; }

  .stat-card { margin-bottom: .75rem; }
}

@media (max-width: 576px) {
  .ts-bottom { grid-template-columns: 1fr; }
  .ts-submit-bar { flex-direction: column; }
  .navbar-brand span.d-none { display: inline !important; }
}

/* ── Utilities ────────────────────────────────────────────── */

.text-bonlec { color: var(--bonlec-dark) !important; }
.bg-bonlec-light { background: var(--bonlec-light) !important; }
.border-bonlec { border-color: var(--bonlec-border) !important; }

.cursor-pointer { cursor: pointer; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* spinner overlay */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(0,53,128,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.loading-spinner {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2rem 3rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
