/* Projects screen (projectManagement/projects.html)
 *
 * Kept out of the module's shared style.css so nothing here reaches the other
 * pages that use .projectsTable. Same palette as the reports page: navy for
 * headings, blue for actions, soft grey-blue surfaces. */

:root {
	--pj-navy: #003554;
	--pj-blue: #0d6efd;
	--pj-slate: #64748b;
	--pj-ink: #334155;
	--pj-muted: #8b98a8;
	--pj-line: #e3e8ef;
	--pj-line-soft: #eef2f7;
	--pj-soft: #f7fafd;
}

/* ======================= toolbar ======================= */

.pj_toolbar {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	flex-wrap: wrap;
	gap: 14px;
	margin: 16px 0 6px;
	padding: 14px 16px;
	background: var(--pj-soft);
	border: 1px solid var(--pj-line);
	border-radius: 12px;
}

.pj_filterGroup,
.pj_actionGroup {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

/* one height for everything on the row, so nothing sits half a line off */
.pj_toolbar .btn,
.pj_toolbar .pj_column,
.pj_toolbar .pj_value,
.pj_toolbar .vscomp-toggle-button {
	height: 38px;
}

.pj_toolLabel {
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--pj-slate);
}

/* The two filter pickers are VirtualSelects, which ship with no border of
 * their own - left alone they read as plain text with a chevron, which is what
 * made this row look unstyled. Dressed as form controls here. */
.pj_column,
.pj_value {
	width: 200px;
	display: block !important;
}

.pj_toolbar .vscomp-toggle-button {
	border: 1px solid #d9e2ec;
	border-radius: 9px;
	background: #fff;
	padding: 0 12px;
	font-size: 0.84rem;
	color: var(--pj-ink);
	display: flex;
	align-items: center;
}

.pj_toolbar .vscomp-wrapper:focus .vscomp-toggle-button,
.pj_toolbar .vscomp-wrapper:hover .vscomp-toggle-button {
	border-color: #9ec5fe;
}

.pj_toolbar .vscomp-value.placeholder {
	color: var(--pj-muted);
}

.pj_toolbar .btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border-radius: 9px;
	font-size: 0.82rem;
	font-weight: 500;
	padding: 0 14px;
	white-space: nowrap;
}

/* A disabled action should look quietly unavailable, not like a broken button:
 * the coloured outlines washed out to pastel when dimmed. */
.pj_toolbar .btn:disabled,
.pj_toolbar .btn.disabled {
	opacity: 1;
	color: #a7b4c3 !important;
	border-color: var(--pj-line) !important;
	background: #fff !important;
	box-shadow: none;
	cursor: not-allowed;
}

/* the three status moves belong together, away from Bulk Edit */
.pj_actionGroup {
	gap: 6px;
}

.pj_actionGroup #pj_bulkEdit {
	margin-right: 6px;
}

.pj_selCount {
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--pj-blue);
	background: #e8f1fb;
	border-radius: 20px;
	padding: 4px 12px;
	white-space: nowrap;
}

.pj_selCount:empty {
	display: none;
}

/* ======================= tabs ======================= */

#mainTab {
	border-bottom: 1px solid var(--pj-line);
	padding: 14px 0 0 !important;
	gap: 4px;
}

#mainTab .nav-link {
	display: flex;
	align-items: center;
	border: none;
	border-bottom: 2px solid transparent;
	border-radius: 8px 8px 0 0;
	padding: 9px 16px;
	color: var(--pj-slate);
	font-size: 0.88rem;
	font-weight: 500;
	background: transparent;
}

#mainTab .nav-link:hover {
	color: var(--pj-navy);
	background: var(--pj-soft);
}

#mainTab .nav-link.active {
	color: var(--pj-navy);
	font-weight: 600;
	background: transparent;
	border-bottom-color: var(--pj-blue);
}

.pj_count {
	display: inline-block;
	min-width: 20px;
	padding: 0 6px;
	margin-left: 8px;
	border-radius: 10px;
	background: var(--pj-line-soft);
	color: var(--pj-slate);
	font-size: 0.7rem;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

#mainTab .nav-link.active .pj_count {
	background: var(--pj-blue);
	color: #fff;
}

/* ======================= table ======================= */

/* Header text in black on a light header. Scoped to the tab content and
 * matched by class, not id: with scrollX the header you see is a CLONE of the
 * table that does not carry the id, so an id rule paints the hidden original
 * and leaves the visible header untouched. */
#myTabContent .projectsTable th,
#myTabContent .dataTables_scrollHead th {
	background-color: #eef3f8 !important;
	color: #000 !important;
	font-weight: 600;
	font-size: 0.82rem;
	vertical-align: middle;
	border-bottom: 1px solid #d8e2ec;
	min-width: 110px;
	white-space: nowrap;
}

#myTabContent .projectsTable th.clientName,
#myTabContent .projectsTable th.assignmentNatureDisplay,
#myTabContent .projectsTable th.projectDescription,
#myTabContent .projectsTable th.remarks,
#myTabContent .dataTables_scrollHead th.clientName,
#myTabContent .dataTables_scrollHead th.assignmentNatureDisplay,
#myTabContent .dataTables_scrollHead th.projectDescription,
#myTabContent .dataTables_scrollHead th.remarks {
	min-width: 190px;
}

#myTabContent .projectsTable td {
	font-size: 0.82rem;
	color: var(--pj-ink);
	vertical-align: middle;
	border-bottom: 1px solid var(--pj-line-soft);
}

#myTabContent .projectsTable tbody tr:nth-child(even) td {
	background: #fafcfe;
}

#myTabContent .projectsTable tbody tr:hover td {
	background: #eef6ff;
	cursor: pointer;
}

/* A column header sits over its column, so it is aligned the way its cells
 * are. DataTables copies the column's className onto the th as well as the td,
 * so one rule covers both. */
#myTabContent .projectsTable th.pj_amountCell,
#myTabContent .projectsTable td.pj_amountCell,
#myTabContent .dataTables_scrollHead th.pj_amountCell {
	text-align: right;
}

#myTabContent .projectsTable td.pj_amountCell {
	font-variant-numeric: tabular-nums;
}

#myTabContent .projectsTable th.pj_statusCell,
#myTabContent .projectsTable td.pj_statusCell,
#myTabContent .dataTables_scrollHead th.pj_statusCell {
	text-align: center;
}

#myTabContent .projectsTable th.pj_check,
#myTabContent .projectsTable td.pj_check,
#myTabContent .dataTables_scrollHead th.pj_check {
	min-width: 44px;
	width: 44px;
	text-align: center;
	padding-left: 8px;
	padding-right: 8px;
}

.projectsTable .pj_row {
	cursor: pointer;
	width: 15px;
	height: 15px;
}

/* status as a tag rather than bare text */
.pj_tag {
	display: inline-block;
	padding: 3px 11px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
}

.pj_tagLive {
	color: #0b5ed7;
	background: #e3f0ff;
}

.pj_tagHold {
	color: #9a5b12;
	background: #fdf0e3;
}

.pj_tagCancelled {
	color: #b42318;
	background: #fee4e2;
}

.pj_tagDone {
	color: #12734a;
	background: #e6f6ee;
}

/* DataTables' own furniture, brought into line with the rest */
#myTabContent .dataTables_filter input,
#myTabContent .dataTables_length select {
	border: 1px solid var(--pj-line);
	border-radius: 8px;
	padding: 4px 10px;
	outline: none;
}

#myTabContent .dataTables_filter input:focus {
	border-color: #9ec5fe;
	box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

#myTabContent .dataTables_filter,
#myTabContent .dataTables_length,
#myTabContent .dataTables_info,
#myTabContent .dataTables_paginate {
	font-size: 0.8rem;
	color: var(--pj-slate);
}

#myTabContent .paginate_button.current {
	border-radius: 7px;
}

/* ======================= bulk edit modal ======================= */

#pj_bulkModal .modal-content {
	border: none;
	border-radius: 14px;
	overflow: hidden;
}

#pj_bulkModal .modal-header {
	background: linear-gradient(180deg, #f8fbff 0%, #f2f7fc 100%);
	border-bottom: 1px solid var(--pj-line);
	padding: 16px 22px;
}

#pj_bulkModal .modal-title {
	font-weight: 700;
	color: var(--pj-navy);
	font-size: 1.05rem;
}

#pj_bulkModal .modal-body {
	padding: 20px 22px 8px;
}

#pj_bulkModal .modal-footer {
	border-top: 1px solid var(--pj-line);
	padding: 14px 22px;
}

#pj_bulkModal .modal-footer .btn {
	border-radius: 9px;
	font-weight: 500;
	padding: 7px 16px;
}

.pj_bulkLead {
	font-size: 0.85rem;
	color: var(--pj-slate);
	background: var(--pj-soft);
	border: 1px solid var(--pj-line-soft);
	border-radius: 9px;
	padding: 9px 12px;
	margin-bottom: 18px;
}

/* Every field reads the same way: caption above, full-width control below.
 * Bootstrap's .form-label is inline-block, which is why the two pickers used
 * to sit BESIDE their captions while the date inputs sat under theirs. */
#pj_bulkFields .form-label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.74rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--pj-slate);
}

#pj_bulkFields .form-control {
	border-radius: 9px;
	border-color: #d9e2ec;
	font-size: 0.88rem;
	padding: 8px 12px;
}

#pj_bulkFields .form-control:focus {
	border-color: #9ec5fe;
	box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

/* the VirtualSelect pickers, dressed as form controls so they match the
   date inputs sitting under them */
.pj_bulkPick,
.pj_bulkPick .vscomp-wrapper {
	display: block !important;
	width: 100% !important;
}

.pj_bulkPick .vscomp-toggle-button {
	min-height: 40px;
	border: 1px solid #d9e2ec;
	border-radius: 9px;
	padding: 6px 12px;
	background: #fff;
	font-size: 0.88rem;
	color: var(--pj-ink);
}

/* VirtualSelect turns the div it is given INTO the wrapper, so the class lands
 * on .pj_bulkPick itself; both forms are covered in case that changes. */
.pj_bulkPick.vscomp-wrapper:focus .vscomp-toggle-button,
.pj_bulkPick .vscomp-wrapper:focus .vscomp-toggle-button {
	border-color: #9ec5fe;
	box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.pj_bulkPick .vscomp-value {
	color: var(--pj-ink);
}

.pj_bulkPick .vscomp-value.placeholder {
	color: var(--pj-muted);
}

.pj_bulkNote {
	display: block;
	margin: 4px 0 8px;
	font-size: 0.76rem;
	color: var(--pj-muted);
}

/* ======================= page head ======================= */

.pj_pageHead {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	flex-wrap: wrap;
	gap: 14px;
	margin-bottom: 4px;
}

.pj_pageHead .common_title {
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--pj-navy);
}

.pj_pageSub {
	color: var(--pj-muted);
	font-size: 0.85rem;
}

.pj_pageHead .exportBtn {
	float: none !important;
	border-radius: 9px;
	font-size: 0.82rem;
	font-weight: 500;
	padding: 7px 16px;
}

/* ======================= the workspace card ======================= */

/* Controls, tabs and table sit on one surface. They used to float directly on
 * the page background, which is what made the screen read as unfinished. */
.pj_card {
	display: block;
	margin-top: 18px;
	background: #fff;
	border: 1px solid var(--pj-line);
	border-radius: 14px;
	box-shadow:
		0 1px 2px rgba(15, 35, 55, 0.04),
		0 8px 24px rgba(15, 35, 55, 0.06);
	overflow: hidden;
}

/* the toolbar is the card's header band */
.pj_card .pj_toolbar {
	margin: 0;
	border: none;
	border-bottom: 1px solid var(--pj-line);
	border-radius: 0;
	background: linear-gradient(180deg, #f8fbff 0%, #f2f7fc 100%);
	padding: 16px 20px;
}

.pj_card #mainTab {
	padding: 0 20px !important;
	margin: 0;
	background: #fff;
}

.pj_card .tab-content {
	padding: 16px 20px 20px;
}

/* the client-only contact filter, when it is shown */
.pj_card .pm_filterSection {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 20px;
	border-bottom: 1px solid var(--pj-line-soft);
	font-size: 0.82rem;
	color: var(--pj-slate);
}

.pj_card .pm_filterSection #pm_contract {
	min-width: 260px;
}

.pj_card .pm_filterSection .filterbtn {
	border-radius: 9px;
	padding: 6px 14px;
	background: var(--pj-blue);
	color: #fff;
	font-size: 0.82rem;
}

/* the table frame inside the card */
#myTabContent .dataTables_wrapper {
	border: 1px solid var(--pj-line);
	border-radius: 10px;
	padding: 12px 12px 4px;
}

#myTabContent table.dataTable {
	border-collapse: separate !important;
	border-spacing: 0;
}

#myTabContent .dataTables_scrollHead {
	border-radius: 8px 8px 0 0;
	overflow: hidden;
}

/* the pickers keep their own width instead of stretching and forcing the row
   to wrap - which is why FILTER/Column and Value/Apply landed on two lines */
.pj_toolbar .pj_column,
.pj_toolbar .pj_value {
	flex: 0 0 200px;
}

.pj_toolbar .pj_column .vscomp-wrapper,
.pj_toolbar .pj_value .vscomp-wrapper,
.pj_toolbar .vscomp-wrapper {
	width: 100%;
}

.pj_toolbar .pj_toolLabel {
	flex: 0 0 auto;
	line-height: 38px;
}

/* Apply carries the weight; Clear is a quiet companion */
#pj_clearFilter {
	background: #fff;
	border: 1px solid var(--pj-line);
	color: var(--pj-slate);
}

#pj_clearFilter:hover {
	background: #f1f5f9;
	color: var(--pj-navy);
}
