/*
 * schedulingUi.css - responsive layout and rounded look of the Scheduling pages (showSample, campaignTestCenter,
 * assignmentCenter, viewTestOptimized, review, approve, mfgApprove, notes, labSupportLogList,
 * unavailableEventListForSupervisor, overtime, group, rotatingGroup, sampleView, actionItems and their
 * child / pop-up pages).
 *
 * Linked only by those pages, after css/style.css and the page's own <style>, so no other page is affected.
 * Style only: no element, id or class that the page's JavaScript reads is changed, and header.html,
 * js/header.js and the shared tab-bar scripts are left as they are.
 *
 * Breakpoints (the same ones js/schedulingResponsive.js puts on <body> as sched-xs / sched-sm / sched-md / sched-lg):
 *   xs < 480   sm < 768   md < 1100   lg >= 1100
 */

:root {
	--sch-radius-sm: 8px;
	--sch-radius-md: 12px;
	--sch-radius-lg: 16px;
	--sch-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.10);
	--sch-shadow-md: 0 2px 6px rgba(0, 0, 0, 0.14), 0 1px 2px rgba(0, 0, 0, 0.10);
	--sch-focus: #0a84ff;
	--sch-tab-bg: #dfeaf2;
	--sch-gutter: 8px;
}

/* ------------------------------------------------------------------ page */

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	overflow-x: hidden;
}

/* the page's own blocks never grow wider than the window */
#headerDiv,
#navTool {
	box-sizing: border-box;
	max-width: 100%;
}

/* ---------------------------------------------------------------- header */

/*
 * header.html is loaded into #headerDiv by js/header.js. The bar becomes a floating, rounded toolbar.
 * The pages and style.css give it width:100%, which with a margin would push the page sideways, so the
 * width is released and the flex row fills the block on its own. Font size follows the width but stays readable.
 */
#headerDiv .header {
	box-sizing: border-box;
	width: auto !important;
	margin: 6px var(--sch-gutter) 0;
	border-radius: var(--sch-radius-lg);
	box-shadow: var(--sch-shadow-md);
	font-size: clamp(10px, 0.77vw, 14px) !important;
}

/*
 * The menu (hamburger) button: the page gives it a fixed 47px height, which left the icon at the top of
 * the box whenever the bar is taller. The box now takes the height of the bar, less the margins, and the
 * icon is centred in it both ways. Only the icon's own link is made a flex box: the drop-down list
 * (ul.yes-js) is positioned from where its parent starts, so its parents are left as they are.
 */
#headerDiv .header .menu_select {
	display: flex;
	align-items: center;
	justify-content: center;
	align-self: stretch;
	box-sizing: border-box;
	height: auto !important;
	margin: 6px 0 6px 10px;
	padding: 0 12px;
	border-radius: var(--sch-radius-md);
}

#headerDiv .header .menu_select .click-nav .no-js {
	margin: 0;
	padding: 0;
}

#headerDiv .header .menu_select .click-nav .clicker {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
}

#headerDiv .header .logo {
	min-width: 0;
}

/* the combo box in the bar: its square white table must let the blue bar through */
#headerDiv .header .x-field,
#headerDiv .header .x-form-item-body {
	background: transparent !important;
}

/* the drop-down list of the menu button: separated, rounded entries */
.click-nav .yes-js li a {
	border-radius: var(--sch-radius-sm);
	margin: 2px 0;
}

.click-nav .yes-js li a:hover {
	text-decoration: none;
	background: #1b8ee0;
}

/* keyboard focus keeps a visible, rounded ring */
#headerDiv a:focus-visible,
#navTool a:focus-visible {
	outline: 2px solid var(--sch-focus);
	outline-offset: 2px;
	border-radius: var(--sch-radius-sm);
}

/* ------------------------------------------------------------- tab strip */

/*
 * The coloured strip, the tab bar and the toolbar under it. The strip is a rounded
 * band; the tabs are rounded buttons. The tab bar is a box layout whose buttons are placed by Ext, so on a
 * window narrower than the tabs it scrolls sideways instead of being cut off.
 */
.header_style_scheduling,
.header_style_planning {
	box-sizing: border-box;
	width: auto;
	height: 4px;
	margin: 4px var(--sch-gutter) 0;
	border-radius: 4px;
}

.tabNavigation {
	box-sizing: border-box;
	width: auto !important;
	margin: 6px var(--sch-gutter) 0;
	border-radius: var(--sch-radius-md);
	background-color: var(--sch-tab-bg);
}

#buttonHeaderDiv {
	max-width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: thin;
}

#buttonHeaderDiv .x-box-inner {
	border-radius: var(--sch-radius-md);
}

#buttonHeaderDiv .x-btn {
	border-radius: var(--sch-radius-sm);
}

#buttonHeaderDiv .x-btn-inner {
	white-space: nowrap;
}

/* ---------------------------------------------------------------- body */

/* grids and panels rendered into the page's blocks follow the width of the page */
#headerDiv ~ div[id],
#navTool ~ div[id] {
	box-sizing: border-box;
	max-width: 100%;
}

/* -------------------------------------------------- Ext JS components */

/*
 * Windows and message boxes. The CLEAN / BORDERLESS POP-UPS block at the end of css/style.css makes every
 * window square with !important, so the rounded corners are restored here, for the Scheduling pages only. The
 * rest of that flat look (white, no frame, soft shadow) is kept; the shadow follows the new corners.
 */
.x-window-default,
.x-window-default[class*="x-window-default-outer-border"] {
	border-radius: var(--sch-radius-md) !important;
}

.x-window-header-default,
.x-window-header-default-top {
	border-top-left-radius: var(--sch-radius-md) !important;
	border-top-right-radius: var(--sch-radius-md) !important;
}

.x-window-body-default,
.x-message-box .x-window-body {
	border-bottom-left-radius: var(--sch-radius-md) !important;
	border-bottom-right-radius: var(--sch-radius-md) !important;
}

.x-window .x-toolbar-docked-bottom {
	border-bottom-left-radius: var(--sch-radius-md) !important;
	border-bottom-right-radius: var(--sch-radius-md) !important;
}

/* panels, their headers and toolbars */
.x-panel-default {
	border-radius: var(--sch-radius-sm);
}

.x-panel-header-default-top {
	border-top-left-radius: var(--sch-radius-sm);
	border-top-right-radius: var(--sch-radius-sm);
}

.x-toolbar-default {
	border-radius: var(--sch-radius-sm);
}

/* buttons */
.x-btn-default-small,
.x-btn-default-medium,
.x-btn-default-large,
.x-btn-default-toolbar-small,
.x-btn-default-toolbar-medium,
.x-btn-default-toolbar-large {
	border-radius: var(--sch-radius-sm);
}

/*
 * Start / End buttons: the page colours the inner text element with an inline background (green, red, grey),
 * which is a square block inside the rounded button. The inner element takes the button's corners.
 */
.x-btn-default-small .x-btn-inner,
.x-btn-default-medium .x-btn-inner,
.x-btn-default-large .x-btn-inner,
.x-btn-default-toolbar-small .x-btn-inner,
.x-btn-default-toolbar-medium .x-btn-inner,
.x-btn-default-toolbar-large .x-btn-inner {
	border-radius: var(--sch-radius-sm);
}

/* text fields and text areas that stand alone */
.x-form-text,
.x-form-textarea {
	border-radius: var(--sch-radius-sm);
}

/*
 * Combo boxes, date, number and search fields are a table (input cell + trigger cell) whose border
 * carries the shape. The table is clipped to the rounded corners and painted white, so nothing of the
 * toolbar or page behind it shows at the corners, and its cell spacing is 0 so the input keeps the width
 * Ext measured (a "separate" table gets the browser's default 2px spacing, which cut the text off). The
 * input and the trigger inside it stay square: the table's corners are the field's corners.
 */
.x-form-trigger-wrap {
	border-collapse: separate;
	border-spacing: 0;
	border-radius: var(--sch-radius-sm);
	overflow: hidden;
	background-color: #ffffff;
}

.x-form-trigger-wrap .x-form-text,
.x-form-trigger-wrap .x-trigger-cell,
.x-form-trigger-wrap .x-form-trigger {
	border-radius: 0;
}

/* the field's outer table and body must let the toolbar or window colour through around the pill */
.x-field,
.x-form-item-body {
	background: transparent !important;
}

.x-boundlist {
	border-radius: var(--sch-radius-sm);
	box-shadow: var(--sch-shadow-md);
}

.x-boundlist-item {
	border-radius: 6px;
}

.x-datepicker {
	border-radius: var(--sch-radius-sm);
	box-shadow: var(--sch-shadow-md);
}

/* menus, tips, tabs */
.x-menu {
	border-radius: var(--sch-radius-sm);
	box-shadow: var(--sch-shadow-md);
}

.x-menu-body {
	border-radius: inherit;
}

.x-menu-item-active {
	border-radius: 6px;
}

.x-tip,
.x-tip-default {
	border-radius: var(--sch-radius-sm);
	box-shadow: var(--sch-shadow-md);
}

.x-tab-default-top {
	border-top-left-radius: var(--sch-radius-sm);
	border-top-right-radius: var(--sch-radius-sm);
}

/* fieldsets of the forms */
.x-fieldset {
	border-radius: var(--sch-radius-sm);
}

/*
 * Grids and trees. The view is clipped to the rounded panel, so the first and last rows and the column
 * header follow the corners. A grid that is wider than the window scrolls inside its own body.
 */
.x-grid-panel,
.x-tree-panel {
	border-radius: var(--sch-radius-sm);
	overflow: hidden;
}

.x-grid-view,
.x-tree-view {
	border-bottom-left-radius: var(--sch-radius-sm);
	border-bottom-right-radius: var(--sch-radius-sm);
}

.x-grid-header-ct {
	background-color: #157fcc;
	border-top-left-radius: var(--sch-radius-sm);
	border-top-right-radius: var(--sch-radius-sm);
}

/* paging toolbars and the buttons in them keep their rounded shape in one line, then wrap */
.x-toolbar-default .x-toolbar-item {
	max-width: 100%;
}

/* upload and form fields never push a window wider than the screen */
.x-window-default {
	max-width: calc(100vw - 8px);
}

/* md: below 1100px */
@media only screen and (max-width: 1099px) {
	:root {
		--sch-gutter: 6px;
	}
}

/* sm: below 768px */
@media only screen and (max-width: 767px) {
	:root {
		--sch-gutter: 4px;
	}

	#headerDiv .header {
		border-radius: var(--sch-radius-md);
	}

	#headerDiv .header .menu_select {
		margin-left: 6px;
	}

	.tabNavigation {
		border-radius: var(--sch-radius-sm);
	}
}

/* xs: below 480px */
@media only screen and (max-width: 479px) {
	:root {
		--sch-gutter: 2px;
	}

	#headerDiv .header {
		border-radius: var(--sch-radius-sm);
	}
}

/*
 * Plain HTML search boxes and selects written into panel titles (panel titles with a search box or a filter). They carry an inline beige background and the
 * browser's dark inset border; the inline style needs !important to be replaced. Checkboxes are left alone.
 */
.x-panel-header-text input[type="text"],
.x-panel-header-text select {
	box-sizing: border-box;
	height: 26px;
	padding: 2px 8px;
	border: 1px solid #c5ced6 !important;
	border-radius: var(--sch-radius-sm);
	background: #ffffff !important;
	color: #000000;
	font-family: inherit;
	font-size: 13px;
	font-weight: normal;
	vertical-align: middle;
}

.x-panel-header-text select {
	padding-right: 4px;
}

.x-panel-header-text input[type="text"]:focus,
.x-panel-header-text select:focus {
	outline: none;
	border-color: #3892d3 !important;
	box-shadow: 0 0 0 2px rgba(56, 146, 211, 0.25);
}

/* the sub-navigation band of the group / overtime / unavailable-event pages (tab bar and pagenavigation) */
.tabNavigationpage {
	box-sizing: border-box;
	width: auto;
	margin: 4px var(--sch-gutter) 0;
	border-radius: var(--sch-radius-md);
}

/*
 * Login pages (login.html, index.html, changePassword.html, resetPassword.html). All four share one layout so the
 * logo and the box sit in the same place and the box has the same size: a centred, wrapping flex row (logo, then
 * the 370px framed box, then the copyright line across the full width). login.html keeps the copyright line and
 * a second box (the admin OTP step) inside .login_right, so .login_right is left out of the box tree
 * (display: contents) and its children take part in the row like on the other pages. The selectors exist on the
 * login pages only. The form is a fixed-size Ext panel, sized by js/schedulingResponsive.js.
 */
.login_main {
	box-sizing: border-box;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	align-content: center;
	justify-content: center;
	gap: 16px 24px;
	min-height: 100vh;
	padding: 16px;
}

/* an empty spacer block of login.html (it carried a 250px top margin) */
.login_main .login_top {
	display: none;
}

.login_left {
	float: none;
	flex: 0 1 420px;
	width: auto;
	height: auto;
	margin: 0;
	text-align: center;
}

.login_left img {
	display: block;
	box-sizing: border-box;
	width: 100%;
	max-width: 358px;
	height: auto;
	margin: 0 auto;
	padding: 0;
}

.login_right {
	display: contents;
}

/* the frame around the form: the same 370px wide box on every page, as tall as the form (240px) plus its frame */
.login_right > .x-panel {
	box-sizing: border-box;
	flex: 0 0 auto;
	width: 370px !important;
	max-width: 100%;
	height: auto !important;
	left: auto !important;
	overflow: hidden;
	border-radius: var(--sch-radius-lg);
	box-shadow: var(--sch-shadow-md);
}

.login_main .copyrightInfo,
.login_main > .login_right > .copyrightInfoLogin {
	float: none;
	flex: 0 0 100%;
	width: auto;
	margin: 0;
	text-align: center;
}

.login_main .copyrightInfoLogin {
	margin: 0;
}

@media only screen and (max-width: 479px) {
	.login_main {
		gap: 12px;
		padding: 8px;
	}
}

/*
 * Round percentage cells of the sample view grid (sampleView.html). The renderers of the columns "%", Open, Test Start,
 * Test End, Review Start, Review End and Approved Started return a .sch-pill and add .sch-pill-cell to the cell: the cell
 * is drawn as a round track that is filled up to the percentage (--sch-pill-fill). The colour is the one the page already
 * chooses for the cell (customred / customgreen / customorange / customlightorange / customgrey-column), red if none.
 */
.x-grid-row td.sch-pill-cell {
	background: transparent;
	color: inherit;
	font-weight: normal;
}

.x-grid-row td.sch-pill-cell .x-grid-cell-inner {
	padding: 3px 4px;
}

.x-grid-row td.sch-pill-cell.sch-pill-red,
.x-grid-row td.sch-pill-cell.customred-column {
	--sch-pill-track: #fdeceb;
	--sch-pill-border: #f3b6b3;
	--sch-pill-fill-color: #f28b86;
	--sch-pill-text: #7a1713;
}

.x-grid-row td.sch-pill-cell.customgreen-column {
	--sch-pill-track: #e6f4e6;
	--sch-pill-border: #a9d8a9;
	--sch-pill-fill-color: #7ec97e;
	--sch-pill-text: #0b4d0b;
}

.x-grid-row td.sch-pill-cell.customorange-column {
	--sch-pill-track: #fff6d6;
	--sch-pill-border: #efd98a;
	--sch-pill-fill-color: #f7d64d;
	--sch-pill-text: #5c4600;
}

.x-grid-row td.sch-pill-cell.customlightorange-column {
	--sch-pill-track: #fff4de;
	--sch-pill-border: #f1dba6;
	--sch-pill-fill-color: #f8dea0;
	--sch-pill-text: #5c4600;
}

.x-grid-row td.sch-pill-cell.customgrey-column {
	--sch-pill-track: #eeeeee;
	--sch-pill-border: #c9caca;
	--sch-pill-fill-color: #c0c1c1;
	--sch-pill-text: #444444;
}

.sch-pill {
	position: relative;
	box-sizing: border-box;
	min-width: 40px;
	height: 22px;
	overflow: hidden;
	border: 1px solid var(--sch-pill-border);
	border-radius: 999px;
	background: var(--sch-pill-track);
	line-height: 20px;
	text-align: center;
}

.sch-pill::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: var(--sch-pill-fill, 0%);
	border-radius: 999px;
	background: var(--sch-pill-fill-color);
}

.sch-pill-text {
	position: relative;
	font-size: 11px;
	font-weight: bold;
	color: var(--sch-pill-text);
}

/* ------------------------------------------------- highlighted sample rows */

/*
 * A sample row of the Sample View grid (sampleView, viewMFGBatches) is highlighted by a colour class on each of its
 * cells (Status to Prt): yellow, orange, red, green, grey or any colour the page's code gives them. The colour
 * and the text style stay exactly as the class sets them. Only the shape changes: the grid line between the cells
 * is hidden, so the cells read as one band, and the first cell (Status) and the last one (Prt, the cell before the
 * percentage column) round the ends of it. Only the cells before the first percentage cell of the row are styled, so the percentage, Open, Test and Review
 * columns are never touched; hidden columns in between do not matter. The page's JavaScript marks the body (sch-hl-box) on these two
 * pages, so other pages that use the same classes or grid id are not affected.
 */
body.sch-hl-box #sampleViewDataGrid .x-grid-row td.x-grid-cell:is(.customred-column, .customgreen-column, .customorange-column, .customlightorange-column, .customgrey-column):not(.sch-pill-cell):not(.sch-pill-cell ~ td) {
	border-right-color: transparent;
	border-bottom-color: transparent;
	/* 3px of white above and below the colour band, so it does not touch the top and bottom border of the cell */
	box-shadow: inset 0 3px 0 0 #fff, inset 0 -3px 0 0 #fff;
	/* the text of the cell is centred, horizontally and vertically */
	text-align: center !important;
	vertical-align: middle;
}

body.sch-hl-box #sampleViewDataGrid .x-grid-row td.x-grid-cell:is(.customred-column, .customgreen-column, .customorange-column, .customlightorange-column, .customgrey-column):not(.sch-pill-cell):not(.sch-pill-cell ~ td) > .x-grid-cell-inner {
	text-align: center !important;
}

body.sch-hl-box #sampleViewDataGrid .x-grid-row td.x-grid-cell:is(.customred-column, .customgreen-column, .customorange-column, .customlightorange-column, .customgrey-column):not(.sch-pill-cell):not(.sch-pill-cell ~ td):first-child {
	border-top-left-radius: var(--sch-radius-lg);
	border-bottom-left-radius: var(--sch-radius-lg);
}

body.sch-hl-box #sampleViewDataGrid .x-grid-row td.x-grid-cell:is(.customred-column, .customgreen-column, .customorange-column, .customlightorange-column, .customgrey-column):not(.sch-pill-cell):not(.sch-pill-cell ~ td):first-child > .x-grid-cell-inner {
	padding-left: 12px;
}

body.sch-hl-box #sampleViewDataGrid .x-grid-row td.x-grid-cell:is(.customred-column, .customgreen-column, .customorange-column, .customlightorange-column, .customgrey-column):not(.sch-pill-cell):not(.sch-pill-cell ~ td):has(+ td.sch-pill-cell) {
	border-top-right-radius: var(--sch-radius-lg);
	border-bottom-right-radius: var(--sch-radius-lg);
}

/* every cell of the Sample View grid (sampleView, viewMFGBatches) has its text centred, horizontally and vertically */
body.sch-hl-box #sampleViewDataGrid .x-grid-row td.x-grid-cell {
	text-align: center !important;
	vertical-align: middle;
}

body.sch-hl-box #sampleViewDataGrid .x-grid-row td.x-grid-cell > .x-grid-cell-inner {
	text-align: center !important;
}
