/* PBL Project Tracker - dark theme matching Reporting App 2 (GitHub-dark palette). */

:root {
    --pbl-bg: #0d1117;
    --pbl-panel: #161b22;
    --pbl-panel-2: #1c2128;
    --pbl-hover: #21262d;
    --pbl-border: #30363d;
    --pbl-text: #c9d1d9;
    --pbl-muted: #8b949e;
    --pbl-blue: #58a6ff;
    --pbl-green: #238636;
    --pbl-green-hover: #2ea043;
    --pbl-red: #f85149;
    --pbl-yellow: #e3b341;   /* same yellow as the Gantt "today" line */
}

body {
    background-color: var(--pbl-bg);
    color: var(--pbl-text);
}

a { color: var(--pbl-blue); }
a:hover { color: #79b8ff; }

.navbar { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.navbar .nav-link.active { color: #fff; border-bottom: 2px solid var(--pbl-blue); }

.card {
    background-color: var(--pbl-panel);
    border-color: var(--pbl-border);
}
.card-header {
    background-color: var(--pbl-panel-2);
    border-color: var(--pbl-border);
    font-weight: 600;
}
a .card:hover, .stat-card:hover {
    border-color: var(--pbl-blue);
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.15);
    transition: all 0.2s ease;
}

.table {
    --bs-table-bg: var(--pbl-panel);
    --bs-table-striped-bg: var(--pbl-panel-2);
    --bs-table-hover-bg: var(--pbl-hover);
    --bs-table-border-color: var(--pbl-border);
}
.table thead th {
    background-color: var(--pbl-panel-2);
    color: var(--pbl-blue);
    border-color: var(--pbl-border);
    white-space: nowrap;
    font-weight: 600;
}
.row-link { cursor: pointer; }

.form-control, .form-select {
    background-color: var(--pbl-hover);
    border-color: var(--pbl-border);
    color: var(--pbl-text);
}
.form-control:focus, .form-select:focus {
    background-color: var(--pbl-hover);
    border-color: var(--pbl-blue);
    color: var(--pbl-text);
    box-shadow: 0 0 0 0.25rem rgba(88, 166, 255, 0.25);
}
.form-control::placeholder { color: #6e7681; }

.btn-primary {
    background-color: var(--pbl-green);
    border-color: var(--pbl-green);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--pbl-green-hover);
    border-color: var(--pbl-green-hover);
}

/* ---- Login ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--pbl-bg);
    padding: 1rem;
}
.login-card { width: 100%; max-width: 420px; }
.login-icon { font-size: 2.5rem; }

/* ---- Shared bits ---- */
.results-count { color: var(--pbl-muted); font-size: 0.875rem; }
.filter-panel {
    background-color: var(--pbl-panel);
    border: 1px solid var(--pbl-border);
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.section-heading {
    color: var(--pbl-muted);
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 700;
    border-bottom: 1px solid var(--pbl-border);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}
.sub-panel {
    background: var(--pbl-panel-2);
    border: 1px solid var(--pbl-border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-left: 0;
    margin-right: 0;
}
.min-w-0 { min-width: 0; }

/* Phase colours come from the phases table via a --phase custom property. */
.phase-badge {
    background-color: color-mix(in srgb, var(--phase) 22%, transparent);
    color: var(--phase);
    border: 1px solid color-mix(in srgb, var(--phase) 55%, transparent);
    font-weight: 600;
}
/* Dashboard "Projects by phase" tiles: stretch to fill the row, filled with a faded phase colour. */
.phase-counts { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.phase-count {
    flex: 1 1 0;
    min-width: 9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    background: color-mix(in srgb, var(--phase) 28%, var(--pbl-panel));
    border: 1px solid color-mix(in srgb, var(--phase) 55%, var(--pbl-panel));
    border-radius: 0.5rem;
    padding: 0.45rem 0.75rem;
    color: var(--pbl-text);
    font-size: 0.85rem;
}
.phase-count strong { color: #fff; font-size: 1rem; }
a.phase-count:hover {
    background: color-mix(in srgb, var(--phase) 42%, var(--pbl-panel));
    border-color: var(--phase);
    color: #fff;
}
.phase-count.is-empty { opacity: 0.4; cursor: default; }

/* ---- Dashboard ---- */
.stat-value { font-size: 2rem; font-weight: 700; color: #fff; line-height: 1.1; }
.stat-icon { font-size: 1.8rem; color: var(--pbl-blue); }
.stat-danger { border-color: rgba(248, 81, 73, 0.6); }
.stat-danger .stat-icon, .stat-danger .stat-value { color: var(--pbl-red); }

/* ---- Queue ---- */
.drag-handle { cursor: grab; color: var(--pbl-muted); font-size: 1.1rem; }
.drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: 0.4; }
/* Queue search: non-matching rows shrink to a muted part-number-only line and can't be dragged. */
.board-tools #qs-q { width: 220px; }
#queue-body tr.is-collapsed > td {
    padding-top: 0.1rem;
    padding-bottom: 0.1rem;
    font-size: 0.75rem;
    color: transparent;
}
#queue-body tr.is-collapsed > td:not(.q-part) > * { display: none !important; }
#queue-body tr.is-collapsed > td.drag-handle { cursor: default; }
#queue-body tr.is-collapsed > td.q-part { font-weight: 400 !important; }
#queue-body tr.is-collapsed > td.q-part a {
    color: var(--pbl-muted);
    pointer-events: none;
    text-decoration: none;
}

/* ---- Pipeline board ---- */
.board {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    align-items: flex-start;
}
.board-col {
    flex: 0 0 320px;
    background: color-mix(in srgb, var(--phase) 20%, var(--pbl-panel));
    border: 1px solid color-mix(in srgb, var(--phase) 35%, var(--pbl-border));
    border-radius: 0.5rem;
    padding: 0.6rem;
    max-height: var(--board-h, calc(100vh - 300px));   /* set by board.js to fit the window */
    overflow-y: auto;
}
.board-col-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
    color: #fff;
}
.board-card {
    background: var(--pbl-panel-2);
    border: 1px solid var(--pbl-border);
    border-radius: 0.4rem;
    padding: 0.55rem 0.65rem;
    margin-bottom: 0.5rem;
    color: var(--pbl-text);
}
.board-card:hover { border-color: var(--pbl-blue); }
.board-card a { color: inherit; }
.board-card strong { color: #fff; }
.board-card.is-overdue { border-left: 3px solid var(--pbl-red); }
/* Pipeline search: non-matching cards shrink to a plain bar, a reminder a filter is on. */
.board-tools #bs-q { width: 220px; }
.board-tools #bs-vendor { width: auto; max-width: 200px; }
.board-card.is-collapsed {
    height: 4px;
    padding: 0;
    margin-bottom: 4px;
    border: 0;
    border-radius: 2px;
    background: var(--pbl-border);
    overflow: hidden;
    pointer-events: none;
}
.board-card.is-collapsed > * { display: none !important; }
@media (max-width: 576px) {
    .board-tools, .board-tools #bs-q, .board-tools #qs-q { width: 100%; }
}
/* ---- Project page ---- */
.description { white-space: normal; }
.facts > div > div:first-child { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.02em; }
/* Next step card: yellow highlight so the main action stands out. */
.next-step {
    border: 2px solid var(--pbl-yellow);
    box-shadow: 0 0 14px rgba(227, 179, 65, 0.18);
}
.next-step > .card-header {
    background-color: rgba(227, 179, 65, 0.14);
    border-bottom-color: rgba(227, 179, 65, 0.5);
    color: #f0c75e;
}
.next-step > .card-header .bi { color: var(--pbl-yellow) !important; } /* overrides text-info on the icon */
.row-current td { background-color: rgba(88, 166, 255, 0.06); }
.row-future td { color: var(--pbl-muted); }
.est-form .form-control { width: 5rem; }
.est-src { font-size: 0.7rem; }
.vendor-select { max-width: 22rem; }
.project-tabs .nav-link { color: var(--pbl-muted); }
.project-tabs .nav-link:hover { color: var(--pbl-text); }
.project-tabs .nav-link.active { color: var(--pbl-text); background: var(--pbl-panel); border-color: var(--pbl-border) var(--pbl-border) var(--pbl-panel); }
.project-tabs { border-color: var(--pbl-border); }
.comment { border-top: 1px solid var(--pbl-border); padding: 0.65rem 0; }
.comment-body { white-space: normal; word-break: break-word; font-size: 0.9rem; }
.mention { color: var(--pbl-blue); font-weight: 600; }
.file-row { border-top: 1px solid var(--pbl-border); padding: 0.5rem 0; }
.activity .list-group-item { background: transparent; border-color: var(--pbl-border); color: var(--pbl-text); }

.sql-view { white-space: pre-wrap; color: var(--pbl-text); background: var(--pbl-bg); max-height: 60vh; overflow: auto; }

/* ---- Gantt ---- */
.gantt {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    background: var(--pbl-panel);
    border: 1px solid var(--pbl-border);
    border-radius: 0.5rem;
    overflow: hidden;
}
.gantt-labels { border-right: 1px solid var(--pbl-border); min-width: 0; }
.gantt-scroll { overflow-x: auto; overflow-y: hidden; user-select: none; }
.g-head {
    height: 46px;
    border-bottom: 1px solid var(--pbl-border);
    display: flex;
    align-items: flex-end;
    padding: 0 0.6rem 0.35rem;
    font-size: 0.75rem;
    color: var(--pbl-muted);
    background: var(--pbl-panel-2);
}
.g-label {
    height: 34px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.5rem;
    border-bottom: 1px solid rgba(48, 54, 61, 0.6);
    white-space: nowrap;
    overflow: hidden;
    font-size: 0.85rem;
}
.g-label.sub { height: 26px; padding-left: 2rem; font-size: 0.78rem; color: var(--pbl-muted); }
.g-desc { color: var(--pbl-muted); overflow: hidden; text-overflow: ellipsis; font-size: 0.78rem; min-width: 0; }
.g-toggle {
    background: none;
    border: 0;
    color: var(--pbl-muted);
    padding: 0 0.1rem;
    line-height: 1;
}
.g-toggle:hover { color: #fff; }
.g-dot, .g-swatch {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 2px;
    margin-right: 0.35rem;
    vertical-align: -1px;
    background: var(--pbl-muted);
}
.g-swatch-proj {
    background: repeating-linear-gradient(45deg, var(--pbl-muted) 0 2px, transparent 2px 5px);
    border: 1px solid var(--pbl-muted);
}
.g-swatch-today { width: 2px; background: #e3b341; }
.g-svg { display: block; }
.g-svg text { font-family: var(--bs-body-font-family); }
.g-month-label { fill: var(--pbl-text); font-size: 12px; font-weight: 600; }
.g-day-label { fill: var(--pbl-muted); font-size: 10px; }
.g-weekend { fill: rgba(255, 255, 255, 0.025); }
.g-month { stroke: var(--pbl-border); stroke-width: 1; }
.g-week { stroke: rgba(48, 54, 61, 0.55); stroke-width: 1; }
.g-headline { stroke: var(--pbl-border); }
.g-rowline { stroke: rgba(48, 54, 61, 0.6); }
.g-today { stroke: #e3b341; stroke-width: 2; }
.g-today-label { fill: #e3b341; font-size: 10px; font-weight: 600; }
.g-seg { cursor: pointer; }
.g-seg:hover rect:not(.g-handle) { filter: brightness(1.2); }
.g-handle { fill: transparent; cursor: ew-resize; }
.g-handle:hover { fill: rgba(255, 255, 255, 0.35); }
/* One project's row inside the Next step card on project.php */
/* Project page: labels column fits the longest phase name so none are cut off. */
.gantt.gantt-mini { grid-template-columns: minmax(170px, max-content) minmax(0, 1fr); background: var(--pbl-bg); }
.gantt-mini .g-desc { display: none; }
.g-ghost { fill: rgba(88, 166, 255, 0.25); stroke: var(--pbl-blue); stroke-dasharray: 4 2; pointer-events: none; }

@media (max-width: 767.98px) {
    .gantt { grid-template-columns: 140px minmax(0, 1fr); }
    .g-desc { display: none; }
    .board-col { flex-basis: 85vw; }
    .gantt.gantt-mini { grid-template-columns: 110px minmax(0, 1fr); }
}
