/* ============================================================
   Caretaker System — Global Stylesheet
   Colour scheme: #2d6a4f primary, #52b788 accent, #ffffff white
   ============================================================ */

:root {
  --brand-primary: #2d6a4f;
  --brand-secondary: #52b788;
  --brand-light: #d8f3dc;
  --brand-dark: #1b4332;
}

/* ── Body & Typography ────────────────────────────────────── */
body {
  background-color: #f5f7f5;
  color: #212529;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

a {
  color: var(--brand-primary);
}

a:hover {
  color: var(--brand-dark);
}

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.navbar .nav-link {
  color: rgba(255,255,255,0.88) !important;
  transition: color 0.15s;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
  color: #fff !important;
}

.navbar .dropdown-menu {
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  border-radius: 0.5rem;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  border-radius: 0.6rem;
  transition: box-shadow 0.15s;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  border-radius: 0.4rem;
  font-weight: 500;
}

.btn-brand {
  background-color: var(--brand-primary);
  color: #fff;
  border: none;
}

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

/* Override Bootstrap blue with theme green */
.btn-primary {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus-visible {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
.btn-primary:focus-visible {
  box-shadow: 0 0 0 0.25rem rgba(45, 106, 79, 0.4);
}
.btn-outline-primary {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn-outline-primary:hover,
.btn-outline-primary:active,
.btn-outline-primary:focus-visible {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}
.btn-check:checked + .btn-outline-primary {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ── Tables ───────────────────────────────────────────────── */
.table th {
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
}

.table-hover tbody tr:hover {
  background-color: #f0faf4;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-control:focus,
.form-select:focus {
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 0.2rem rgba(82, 183, 136, 0.25);
}

/* ── Master job highlight ─────────────────────────────────── */
tr.master-job-row,
.master-job-card {
  background-color: #fff8e1;
  border-left: 4px solid #ffc107 !important;
}

/* ── Sleeping job ─────────────────────────────────────────── */
tr.sleeping-row td {
  opacity: 0.6;
}

/* ── Login page ───────────────────────────────────────────── */
.brand-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background-color: var(--brand-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* ── Status badges colours ────────────────────────────────── */
.status-new       { background-color: #0d6efd; }
.status-inprog    { background-color: #0dcaf0; }
.status-closed    { background-color: #6c757d; }
.status-blocked   { background-color: #ffc107; color: #212529; }

/* ── Rota calendar ────────────────────────────────────────── */
.rota-day-shift {
  background-color: #d4edda;
  color: #155724;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 0.72rem;
}

.rota-night-shift {
  background-color: #cce5ff;
  color: #004085;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 0.72rem;
}

.rota-oncall-shift {
  background-color: #e2e3e5;
  color: #383d41;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 0.72rem;
}

/* ── Priority colours ─────────────────────────────────────── */
.priority-low    { color: #198754; }
.priority-medium { color: #ffc107; }
.priority-high   { color: #dc3545; }
.priority-urgent { color: #212529; background-color: #dc3545; }

/* ── Footer ───────────────────────────────────────────────── */
footer {
  background-color: #fff;
  border-top: 1px solid #dee2e6;
  margin-top: 3rem;
}

/* ── Alert tweaks ─────────────────────────────────────────── */
.alert-success {
  background-color: #d8f3dc;
  border-color: var(--brand-secondary);
  color: var(--brand-dark);
}

/* ── Utility ──────────────────────────────────────────────── */
code {
  color: var(--brand-primary);
  font-size: 0.9em;
}

.text-brand {
  color: var(--brand-primary) !important;
}

.bg-brand {
  background-color: var(--brand-primary) !important;
}

.border-brand {
  border-color: var(--brand-primary) !important;
}

/* Subtle section headers */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6c757d;
}

/* ── Job log entry types ──────────────────────────────────── */
.log-entry {
  border-left: 3px solid #dee2e6 !important;
}
.log-entry-status {
  background-color: #f0faf4 !important;
  border-left: 3px solid var(--brand-primary) !important;
}
.log-entry-private {
  background-color: #fffdf0 !important;
  border-left: 3px solid #ffc107 !important;
}
.log-entry-system {
  background-color: #f8f9fa !important;
  border-left: 3px solid #adb5bd !important;
}
.log-entry-team {
  background-color: #eef6fb !important;
  border-left: 3px solid #0ea5e9 !important;
}

/* ── Job log avatar ────────────────────────────────────────── */
.log-avatar,
.log-avatar-initials,
.log-avatar-system {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #fff;
}
.log-avatar {
  object-fit: cover;
  box-shadow: 0 0 0 2.5px var(--brand-primary), 0 3px 10px rgba(0,0,0,0.15);
}
.log-avatar-initials {
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 0 0 2.5px var(--brand-primary), 0 3px 10px rgba(0,0,0,0.12);
}
.log-avatar-system {
  background: #adb5bd;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 0 0 2.5px #adb5bd, 0 3px 10px rgba(0,0,0,0.1);
}

/* ── Log image thumbnails ─────────────────────────────────── */
.log-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
  transition: transform 0.15s, box-shadow 0.15s;
  display: block;
}
.log-thumb:hover {
  transform: scale(1.08);
  box-shadow: 0 3px 12px rgba(0,0,0,0.35);
}
.log-thumb-lg {
  width: 104px;
  height: 104px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
  transition: transform 0.15s, box-shadow 0.15s;
  display: block;
}
.log-thumb-lg:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(0,0,0,0.35);
}

/* ── Image lightbox ───────────────────────────────────────── */
.img-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-lightbox-inner {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-lightbox-inner img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  display: block;
}
.img-lightbox-close {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  color: #212529;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: background 0.15s;
  z-index: 1;
}
.img-lightbox-close:hover {
  background: var(--brand-light);
}

/* ── Responsive tweaks ────────────────────────────────────── */
@media (max-width: 576px) {
  .table-responsive table {
    font-size: 0.8rem;
  }

  h2 {
    font-size: 1.4rem;
  }
}
