/* Reperio PMS - Custom Styles */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
  --rp-primary: #1D4ED8;
  --rp-primary-dark: #1e40af;
  --rp-sidebar-bg: #0f172a;
  --rp-card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

body {
  background-color: #f8fafc;
  font-family: 'Roboto', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
}

/* Navbar */
.bg-primary-custom {
  background-color: var(--rp-primary) !important;
}

.navbar-dark .navbar-nav .nav-item {
  margin: 0 0.25rem;
}

.navbar-dark .navbar-nav .nav-link {
  color: rgba(255,255,255,.85);
  padding: 0.75rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 500;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.active {
  color: #fff;
  background-color: rgba(255,255,255,.1);
  border-radius: 4px;
}

/* Cards */
.card {
  border: 1px solid #e2e8f0;
  box-shadow: none;
  border-radius: 12px;
  overflow: hidden;
}

.card-header {
  background-color: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.65rem 1rem;
}

/* KPI Cards */
.kpi-card {
  border-left: 4px solid var(--rp-primary);
}

.kpi-card .kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}

.kpi-card .kpi-label {
  font-size: 0.78rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.kpi-card .kpi-icon {
  font-size: 2rem;
  opacity: 0.18;
}

/* Tables */
.table th {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  background-color: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.table td {
  vertical-align: middle;
  font-size: 0.85rem;
  color: #334155;
}

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

/* Badges */
.badge {
  font-size: 0.72rem;
  font-weight: 600;
}

/* Page title */
.page-header {
  padding: 1.25rem 0 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

/* Variance colours */
.variance-success { color: #16a34a; font-weight: 600; }
.variance-warning { color: #d97706; font-weight: 600; }
.variance-danger  { color: #dc2626; font-weight: 600; }

/* Search bar */
.search-bar input {
  border-radius: 6px 0 0 6px;
  border-right: 0;
}
.search-bar button {
  border-radius: 0 6px 6px 0;
}

/* Sidebar (if used on wider pages) */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  color: #374151;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  transition: background 0.15s;
}

.sidebar-link:hover,
.sidebar-link.active {
  background-color: #eff6ff;
  color: var(--rp-primary);
}

/* Forms */
.form-label {
  font-weight: 500;
  font-size: 0.82rem;
  color: #374151;
  margin-bottom: 0.25rem;
}

.form-control, .form-select {
  font-size: 0.875rem;
  border-color: #cbd5e1;
}

.form-control:focus, .form-select:focus {
  border-color: var(--rp-primary);
  box-shadow: 0 0 0 0.2rem rgba(29,78,216,.15);
}

/* Login page */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1D4ED8 0%, #1e40af 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  border: none;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

/* Chart containers */
.chart-container {
  position: relative;
  height: 260px;
}

/* Pagination */
.pagination .page-link {
  font-size: 0.82rem;
  color: var(--rp-primary);
}

.pagination .page-item.active .page-link {
  background-color: var(--rp-primary);
  border-color: var(--rp-primary);
}

/* Status pills — Project statuses */
.status-active      { background-color: #dcfce7; color: #15803d; }
.status-on_hold     { background-color: #fef9c3; color: #854d0e; }
.status-completed   { background-color: #dbeafe; color: #1e40af; }
.status-cancelled   { background-color: #fee2e2; color: #991b1b; }
/* Status pills — ProjectDeliverable statuses */
.status-not_started { background-color: #f1f5f9; color: #475569; }
.status-in_progress { background-color: #eff6ff; color: #1d4ed8; }

/* Inline status select — matches badge colours */
.status-inline-select { border-radius: 20px; font-size: 0.78rem; font-weight: 600; padding: 2px 8px; border: 1px solid transparent; cursor: pointer; }
.status-select-active    { background-color: #dcfce7; color: #15803d; border-color: #86efac; }
.status-select-on_hold   { background-color: #fef9c3; color: #854d0e; border-color: #fde047; }
.status-select-completed { background-color: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.status-select-cancelled { background-color: #fee2e2; color: #991b1b; border-color: #fca5a5; }

/* Inline editable name cells */
.inline-name-cell { cursor: text; }
.inline-name-cell:hover { background-color: #f8fafc; border-radius: 4px; }

/* Masters toggle checkboxes */
.toggle-active-cb {
  cursor: pointer;
}

/* Checkbox visibility in light mode */
.form-check-input {
  border-color: #94a3b8 !important;
}
.form-check-input:checked {
  background-color: var(--rp-primary) !important;
  border-color: var(--rp-primary) !important;
}
.form-check-input:focus {
  border-color: var(--rp-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(29,78,216,.2);
}

/* ── Info notice box ─────────────────────────────────────────────────────── */
.info-notice {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
[data-bs-theme="dark"] .info-notice {
  background: #1e2535;
  color: #94a3b8;
  border-color: #2e3650;
}

/* Utility */
.text-muted-sm { font-size: 0.78rem; color: #94a3b8; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.border-left-primary { border-left: 3px solid var(--rp-primary) !important; }

/* ── Tracking table improvements ─────────────────────────────────────────── */

/* Tabbed container */
.tab-content.border {
  border-color: #e2e8f0 !important;
  border-radius: 0 0 8px 8px;
}

.nav-tabs .nav-link {
  font-size: 0.84rem;
  font-weight: 500;
  color: #475569;
  border: 1px solid transparent;
  padding: 0.55rem 1.1rem;
}

.nav-tabs .nav-link.active {
  color: var(--rp-primary);
  font-weight: 600;
  border-color: #dee2e6 #dee2e6 #fff;
  background: #fff;
  margin-bottom: -1px;
}

.nav-tabs .nav-link:not(.active):hover {
  color: #1e293b;
  border-color: #e2e8f0 #e2e8f0 transparent;
  background: #f8fafc;
}

/* Tracking table header */
table.tracking-table > thead > tr > th {
  background: #e9ecef !important;
  color: #374151 !important;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 2px solid #ced4da !important;
  padding: 0.6rem 0.65rem;
  white-space: nowrap;
}

/* Ensure sticky thead doesn't overlap navbar dropdowns */
thead.sticky-top,
.sticky-top thead {
  z-index: 1 !important;
}

/* Tracking table cells */
table.tracking-table > tbody > tr > td {
  padding: 0.45rem 0.65rem;
  vertical-align: middle;
  font-size: 0.84rem;
  border-bottom: 1px solid #e8eef5;
}

/* Zebra striping */
table.tracking-table > tbody > tr:not(.date-group-row):nth-child(even) {
  background-color: #f8fbff;
}

table.tracking-table > tbody > tr:not(.date-group-row):hover > td {
  background-color: #eff6ff !important;
}

/* Date group separator row */
table.tracking-table > tbody > tr.date-group-row > td {
  background: linear-gradient(to right, #eef2ff, #f5f8ff) !important;
  border-top: 2px solid #c7d2fe !important;
  border-bottom: 1px solid #c7d2fe !important;
  padding: 0.35rem 0.75rem !important;
  font-size: 0.79rem;
  font-weight: 700;
  color: #3730a3;
  letter-spacing: 0.03em;
}

/* Hours cell highlight */
table.tracking-table > tbody > tr > td.hours-cell {
  font-weight: 700;
  color: var(--rp-primary);
  font-size: 0.88rem;
}

/* Notes cell */
table.tracking-table > tbody > tr > td.notes-cell {
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Action buttons in tracking table */
.tracking-table .btn-action {
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  border-radius: 4px;
  line-height: 1.5;
}

/* Tab badge counts */
.nav-tabs .badge {
  font-size: 0.68rem;
  vertical-align: middle;
}

/* ── Custom theme toggle switch ─────────────────────────────────────────── */
.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 0;
  background: rgba(255,255,255,.2);
  transition: background 0.25s;
  flex-shrink: 0;
}
.theme-switch[data-theme="dark"] {
  background: #6366f1;
}
.theme-switch:focus,
.theme-switch:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}
.theme-switch-knob {
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s, left 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
/* sun icon (Bootstrap Icons font) when light */
.theme-switch-knob::before {
  font-family: "bootstrap-icons";
  content: "\f5a2";   /* bi-sun */
  font-size: 9px;
  color: #f59e0b;
}
.theme-switch[data-theme="dark"] .theme-switch-knob {
  left: 21px;
}
/* moon icon when dark */
.theme-switch[data-theme="dark"] .theme-switch-knob::before {
  font-family: "bootstrap-icons";
  content: "\f497";   /* bi-moon */
  font-size: 9px;
  color: #6366f1;
}

/* ── Project Status Entry badges (global — used in modal & project list) ── */
.project-status-badge { font-size: 0.82rem; font-weight: 500; padding: 5px 12px; border-radius: 20px; }
.ps-badge-in-progress     { background:#dcfce7; color:#166534; }
.ps-badge-on-hold         { background:#fef9c3; color:#854d0e; }
.ps-badge-delivered       { background:#d1fae5; color:#065f46; }
.ps-badge-potential-delay { background:#993131; color:#fff; font-weight:400; }
.ps-badge-delayed         { background:#993131; color:#fff; font-weight:400; }
.ps-badge-cancelled       { background:#f1f5f9; color:#64748b; }
[data-bs-theme="dark"] .ps-badge-in-progress     { background:#14532d; color:#86efac; }
[data-bs-theme="dark"] .ps-badge-on-hold         { background:#422006; color:#fcd34d; }
[data-bs-theme="dark"] .ps-badge-delivered       { background:#064e3b; color:#6ee7b7; }
[data-bs-theme="dark"] .ps-badge-potential-delay { background:#993131; color:#fff; font-weight:400; }
[data-bs-theme="dark"] .ps-badge-delayed         { background:#993131; color:#fff; font-weight:400; }
[data-bs-theme="dark"] .ps-badge-cancelled       { background:#1e2333; color:#8a95a8; }

/* ── Master list icon action buttons ────────────────────────────────────── */
.btn-icon-action {
  background: none;
  border: none;
  padding: 3px 6px;
  border-radius: 6px;
  line-height: 1;
  font-size: 0.95rem;
  opacity: 0.55;
  transition: opacity 0.15s, background 0.15s;
}
.btn-icon-action:hover {
  opacity: 1;
  background: rgba(0, 0, 0, .07);
}
[data-bs-theme="dark"] .btn-icon-action:hover {
  background: rgba(255, 255, 255, .09);
}
