/* ── DevTracker custom styles ─────────────────────────────────────────────── */

:root {
  --sidebar-width:  240px;
  --navbar-height:  56px;
  --sidebar-bg:     #1a2332;
  --sidebar-text:   #9ba8b4;
  --sidebar-hover:  rgba(255,255,255,0.07);
  --sidebar-active: #0d6efd;
  --primary:        #0d6efd;
  --surface:        #ffffff;
  --surface-alt:    #f8f9fa;
  --border:         #dee2e6;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface-alt);
  overflow-x: hidden;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
#wrapper {
  display: flex;
  padding-top: var(--navbar-height);
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - var(--navbar-height));
  background: var(--sidebar-bg);
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  z-index: 100;
  overflow-y: auto;
  box-shadow: 2px 0 12px rgba(0,0,0,0.18);
  transition: transform 0.25s ease;
}

.sidebar-sticky { padding: 0.75rem 0; }

#sidebar .nav-link {
  color: var(--sidebar-text);
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#sidebar .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
#sidebar .nav-link.active {
  background: rgba(13,110,253,0.15);
  color: #fff;
  border-left-color: var(--primary);
  font-weight: 500;
}

.sidebar-section-header {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: #4e6070;
  padding: 0.75rem 1.25rem 0.35rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 0.5rem;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* ── Main content ────────────────────────────────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

#view {
  padding: 1.75rem 2rem;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

/* ── Project cards ───────────────────────────────────────────────────────── */
.project-card {
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.11);
  border-color: var(--primary);
}
.project-card-body {
  padding: 0.75rem 0.9rem;
}
.project-card-footer {
  background: transparent;
  border-top: 1px solid var(--border);
  padding: 0.35rem 0.7rem;
}

.card-template {
  border: 1px dashed var(--border);
  background: #fafbfc;
}

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.stat-label {
  font-size: 0.72rem;
  color: #6c757d;
  margin-top: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Effort chart ────────────────────────────────────────────────────────── */
.effort-chart-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  max-height: 260px;
}
.effort-chart-wrapper canvas { max-height: 230px; }

/* ── Checklist / Gantt table ─────────────────────────────────────────────── */
.checklist-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  background: var(--surface);
}

.checklist-table {
  min-width: max-content;
  font-size: 0.8rem;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.cl-fixed-header {
  background: var(--sidebar-bg) !important;
  color: #cdd5df !important;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding: 0.5rem 0.6rem;
  position: sticky;
  top: 0;
  z-index: 2;
}

.cl-actions-header {
  background: var(--sidebar-bg) !important;
  color: #cdd5df !important;
  position: sticky;
  top: 0;
  z-index: 2;
}

.task-cell {
  min-width: 200px;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-cell {
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Phase group headers ─────────────────────────────────────────────────── */
.phase-group-header td {
  background: #f0f4fb !important;
  border-top: 2px solid #cdd8f0 !important;
  padding: 0.35rem 0.75rem;
}
.phase-toggle-icon { font-size: 0.7rem; }

/* ── Gantt collapse ────────────────────────────────────────────────────── */
.gantt-hidden .gantt-col-header,
.gantt-hidden .gantt-cell-td { display: none !important; }

/* ── Gantt date column headers ───────────────────────────────────────────── */
.gantt-col-header {
  background: var(--sidebar-bg) !important;
  color: #8899aa;
  text-align: center;
  min-width: 36px;
  max-width: 36px;
  padding: 0.25rem 1px !important;
  position: sticky;
  top: 0;
  z-index: 2;
}

.gantt-date-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}
.gantt-day-name { font-size: 0.62rem; font-weight: 600; color: #aab8c8; }
.gantt-day-num  { font-size: 0.58rem; color: #6a7d8e; }

.weekend-col { background-color: #212d3e !important; opacity: 0.75; }

/* ── Gantt date cells ────────────────────────────────────────────────────── */
.gantt-cell-td {
  padding: 3px 2px !important;
  text-align: center;
  min-width: 36px;
}

.gantt-cell {
  width: 26px;
  height: 20px;
  border-radius: 4px;
  margin: 0 auto;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
  border: 1px solid transparent;
}
.gantt-cell:hover { transform: scale(1.25); }
.gantt-cell.empty   { background: #e9ecef; border-color: #d0d5dd; }
.gantt-cell.working { background: #0d6efd; border-color: #0a58ca; }
.gantt-cell.done    { background: #198754; border-color: #0d6632; }
.gantt-cell.blocked { background: #dc3545; border-color: #b02a37; }

/* ── Gantt legend ────────────────────────────────────────────────────────── */
.gantt-legend { display: flex; align-items: center; flex-wrap: wrap; }
.gantt-legend-item { display: inline-flex; align-items: center; font-size: 0.78rem; color: #6c757d; }
.gantt-dot {
  width: 13px; height: 13px; border-radius: 3px;
  display: inline-block; margin-right: 5px;
}
.gantt-dot.working { background: #0d6efd; }
.gantt-dot.done    { background: #198754; }
.gantt-dot.blocked { background: #dc3545; }

/* ── Environment date pills ──────────────────────────────────────────────── */
.env-cell {
  text-align: center;
  min-width: 75px;
  padding: 2px 4px !important;
}
.env-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 12px;
  font-size: 0.68rem;
  white-space: nowrap;
  font-weight: 500;
}
.env-empty  { background: #f1f3f5; color: #adb5bd; }
.env-filled { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }

/* ── Issue repository cards ──────────────────────────────────────────────── */
.issue-card {
  border: 1px solid var(--border);
  transition: box-shadow 0.15s ease;
}
.issue-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.1); }
.issue-card .card-footer { background: transparent; border-top: 1px solid #f0f0f0; }

.solution-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}
.solution-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
.solution-text { color: #451a03; line-height: 1.55; }

/* ── Empty states ────────────────────────────────────────────────────────── */
.empty-state { color: #6c757d; }

/* ── Extra-small buttons ─────────────────────────────────────────────────── */
.btn-xs {
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  line-height: 1.4;
  border-radius: 4px;
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */
#main-navbar {
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
#main-navbar .navbar-brand { font-size: 1rem; letter-spacing: -0.2px; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f3f5; }
::-webkit-scrollbar-thumb { background: #bcc4ce; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9aa4ae; }

/* ── Responsive: collapse sidebar on small screens ───────────────────────── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-240px); }
  #main-content { margin-left: 0; }
  #view { padding: 1rem; }
}

/* ── Gantt holiday / leave highlighting ──────────────────────────────────── */
.gantt-col-header.holiday-col {
  background: #7a4f00 !important;
  color: #ffd770 !important;
}
.gantt-col-header.holiday-col .gantt-day-name,
.gantt-col-header.holiday-col .gantt-day-num { color: #ffd770 !important; }

.holiday-pip { font-size: 0.6rem; display: block; line-height: 1; }

.gantt-cell-td.holiday-col-body { background: #fff8e6; }
.gantt-cell-td.leave-col-body   { background: rgba(255,193,7,0.18); border-left: 2px solid rgba(255,193,7,0.5); }

/* Gantt cells with holiday or leave overlays */
.gantt-cell.holiday-overlay {
  outline: 2px solid #fd7e14;
  outline-offset: -2px;
}
.gantt-cell.leave-overlay {
  position: relative;
}
.gantt-cell.leave-overlay::after {
  content: '';
  position: absolute;
  top: 1px; right: 1px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ffc107;
  box-shadow: 0 0 0 1px #212529;
  pointer-events: none;
}
.gantt-cell.leave-overlay.empty { background: #fff3cd; border-color: #ffc107; }

/* Leave badge in resource cards */
.badge-leave { align-items: center; }

/* ── Dashboard panels ────────────────────────────────────────────────────── */
.db-panel { border: 1px solid rgba(255,255,255,0.08); }
.db-panel-header { background: rgba(255,255,255,0.04); padding: 0.6rem 1rem; font-size: 0.85rem; }
.db-panel-header:hover { background: rgba(255,255,255,0.08); }
.db-chevron { font-size: 0.75rem; transition: transform 0.2s; }
.db-health-card:hover { border-color: rgba(13,110,253,0.5) !important; box-shadow: 0 0 0 1px rgba(13,110,253,0.25); }

/* ── Checkpoint & Unit Test rows ─────────────────────────────────────────── */
.checkpoint-row > td { background: #f8f0ff !important; }
.checkpoint-row .task-cell { color: #6f42c1; }
.unittest-row   > td { background: #f0faff !important; }
.unittest-row   .task-cell { color: #0984af; }

.cp-cell { padding: 2px !important; text-align: center; min-width: 36px; }
.checkpoint-marker {
  width: 22px; height: 22px; border-radius: 4px; margin: 0 auto; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 900; transition: transform 0.15s;
}
.checkpoint-marker:hover { transform: scale(1.3); }
.checkpoint-marker.cp-pending { color: #adb5bd; background: #f1f3f5; border: 2px solid #adb5bd; }
.checkpoint-marker.cp-passed  { color: #fff;    background: #198754; border: 2px solid #0d6832; }
.checkpoint-marker.cp-failed  { color: #fff;    background: #dc3545; border: 2px solid #b02a37; }
.cp-icon { color: #6f42c1; }
.ut-icon { color: #0984af; }

/* ── Status click-to-cycle ──────────────────────────────────────────── */
.status-clickable { cursor: pointer; transition: opacity 0.15s; }
.status-clickable:hover { opacity: 0.75; }

/* ── Project Closure tab ─────────────────────────────────────── */
.closure-question { transition: background 0.2s; }
.closure-question.answered { background: #f0fdf4; }
.closure-q-num {
  width: 24px; height: 24px; flex-shrink: 0;
  background: var(--primary); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; margin-top: 2px;
}
.closure-q-text { font-size: 0.9rem; color: #212529; }
.closure-answer {
  font-size: 0.85rem;
  border-color: #dee2e6;
  resize: vertical;
}
.closure-answer:focus { border-color: var(--primary); box-shadow: 0 0 0 0.15rem rgba(13,110,253,0.15); }

.project-group-header {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  margin-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
  font-size: 0.9rem;
}

/* ── Resource cards ──────────────────────────────────────────────────────── */
.resource-card {
  border: 1px solid var(--border);
}
.resource-card .card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.resource-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.resource-avatar-sm {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  flex-shrink: 0;
}

/* ── Resource dot in matrix ──────────────────────────────────────────────── */
.resource-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

/* ── Colour swatches ─────────────────────────────────────────────────────── */
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: #fff; box-shadow: 0 0 0 3px #0d6efd; }

/* ── Print additions ─────────────────────────────────────────────────────── */
@media print {
  .resource-card .card-header { break-inside: avoid; }
}
@media print {
  #main-navbar, #sidebar { display: none !important; }
  #main-content { margin-left: 0 !important; }
  #view { padding: 0 !important; }
  .btn, button, .card-footer { display: none !important; }
  .checklist-table-wrapper { overflow: visible !important; border: none !important; }
  .checklist-table { font-size: 7pt; min-width: auto; }
  .gantt-col-header { min-width: 14pt; max-width: 14pt; }
  .gantt-cell { width: 11pt; height: 9pt; }
  .page-header { border-bottom: 1px solid #999; }
  @page { margin: 1.2cm; }
}
