/*
 * responsive-fixes.css — phone / tablet layout fixes (11-23-2026).
 * Loaded after theme-custom.css. Nothing in theme.css or Bootstrap is edited;
 * removing the <link> removes every rule here.
 * Finding numbers (F1, S5 ...) refer to InspectCMSVault/notes/responsive-audit/findings.md.
 * Layout rules are limited to screens under 1200 px and / or touch screens, so a
 * desktop with a mouse is unchanged.
 */

/* F1: tables with no scroll box of their own scroll sideways instead of being cut off (wrapper div added in the views) */
@media (max-width: 1199px), (pointer: coarse) {
	.table-scroll {
		width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
}

/* F1: a wrapped table prints in full, never as a scroll box */
@media print {
	.table-scroll {
		overflow: visible;
	}
}

/* F1: the theme's table scroll box stops at 991 px; keep it scrolling on tablet landscape and on wide touch screens */
@media (min-width: 992px) and (max-width: 1199px), (min-width: 992px) and (pointer: coarse) {
	.table-responsive {
		width: 100%;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
	}
}

/* F1.14: invoice tables inside pop-ups scroll sideways */
@media (max-width: 1199px), (pointer: coarse) {
	.mfp-content .table-responsive {
		overflow-x: auto;
	}
}

/* F2: Agent Management keeps a readable minimum width so its scroll box scrolls instead of columns printing over each other */
/* The view locks the table to fixed column shares of the screen (vendor_management/index.php:27), and the
   small-screen rule forbids wrapping (theme.css:1246), so a minimum width alone still let long values
   (an email address) spill into the next column. Below 1200px the columns size to their content instead,
   the way the Clients list does, and the scroll box scrolls. Desktop keeps the fixed shares. */
@media (max-width: 1199px) {
	table#dtClient.table {
		table-layout: auto;
		min-width: 1100px;
	}
}

/* F3: a long page title stays on one line with "..." on tablets and up (the theme only does this on phones); 42px = the h2's own side padding */
@media (min-width: 768px) {
	.page-header h2 {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		max-width: calc(100% - 42px);
	}
}

/* Cosmetic (Orders Year tile): the amount wraps between words, not in the middle of a number */
.widget-summary .summary {
	word-break: normal;
	overflow-wrap: break-word;
}

/* S5: order form tab strip on phones — each tab is as wide as its label needs, labels wrap onto two lines, all tabs the same height */
@media (max-width: 767px) {
	#modalEditOrder .nav-tabs.nav-justify {
		display: -webkit-box;
		display: -ms-flexbox;
		display: flex;
		-ms-flex-wrap: nowrap;
		flex-wrap: nowrap;
	}

	#modalEditOrder .nav-tabs.nav-justify:before,
	#modalEditOrder .nav-tabs.nav-justify:after {
		display: none;
	}

	#modalEditOrder .nav-tabs.nav-justify > li {
		display: -webkit-box;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-flex: 1;
		-ms-flex: 1 1 auto;
		flex: 1 1 auto;
		width: auto;
	}

	#modalEditOrder .nav-tabs.nav-justify > li > a {
		display: -webkit-box;
		display: -ms-flexbox;
		display: flex;
		-webkit-box-align: center;
		-ms-flex-align: center;
		align-items: center;
		-webkit-box-pack: center;
		-ms-flex-pack: center;
		justify-content: center;
		-webkit-box-flex: 1;
		-ms-flex: 1 1 auto;
		flex: 1 1 auto;
		padding: 8px 2px;
		font-size: 11px;
		line-height: 1.2;
		white-space: normal;
		overflow-wrap: break-word;
	}
}

/* F4: zoom is allowed again (Robert, 11-23). iPhones zoom in by themselves when a tapped field's text is
   under 16px, so on touch screens the fields use 16px text. Desktop is unchanged. */
@media (pointer:coarse) {
	.form-control,
	input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="tel"], input[type="search"], input[type="url"], input[type="date"], input[type="time"],
	select, textarea {
		font-size: 16px;
	}
	/* layouts/main.php forces `.form-control { font-size:14px !important }`; this has to answer in kind. */
	html .form-control {
		font-size: 16px !important;
	}

	/* The portal's text boxes are 25px tall (bootstrap.css .form-control), too short for 16px text and for a
	   finger. On touch screens they are 36px, the same as the buttons (buttons-uniform.css). */
	.form-control,
	.input-sm,
	.input-group-sm > .form-control,
	.input-group-sm > .input-group-addon {
		height: 36px;
		padding: 6px 8px;
	}
	textarea.form-control,
	select[multiple].form-control,
	select[size].form-control {
		height: auto;
	}
}

/* Order form, Point of Contacts (Robert, 11-23): on small screens the table keeps a workable width and
   slides sideways in its scroll box, instead of squeezing the Type / Name / Phone / Email boxes to ~50px. */
@media (max-width: 991px) {
	#pocTable,
	#agentPocTable {
		min-width: 640px;
	}
}

/* Inspector report totals (Robert, 11-23): keep "$" and the amount on one line. */
#inspector-report-result .col-md-4 > table td {
	white-space: nowrap;
}
