/**
 * qr-contract.css
 *
 * Phase 1 Quick Reply structural/layout contract.
 * Loaded after theme CSS so geometry is identical across all themes.
 * Colors, typography flair, and textures remain in style.css / themes (Phase 2+).
 */

/* ========================= QR ROOT (geometry) ========================= */
#qr{
	position: fixed;
	z-index: 6;
	width: 320px;
	min-width: 320px;
	max-width: 100%;
	box-sizing: border-box;
	overflow: hidden;
	padding: 1px;
	border-radius: 3px;
}

/* ========================= MOVE BAR (geometry) ========================= */
#qrmove{
	display: flex;
	align-items: stretch;
	justify-content: flex-end;
	width: 100%;
	height: 22px !important;
	min-height: 22px !important;
	max-height: 22px !important;
	padding: 0;
	gap: 0;
	cursor: move;
	white-space: nowrap;
	box-sizing: border-box !important;
	flex-shrink: 0;
}

#qrmove button.qrmove-control{
	appearance: none !important;
	-webkit-appearance: none !important;
	box-sizing: border-box !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex: 0 0 auto !important;
	position: static !important;
	top: auto !important;
	right: auto !important;
	bottom: auto !important;
	left: auto !important;
	transform: none !important;
	margin: 0 !important;
	padding: 0 5px !important;
	border: none !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	text-shadow: none !important;
	text-decoration: none !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	word-spacing: normal !important;
	font-family: Arial, Helvetica, sans-serif !important;
	font-size: 15px !important;
	font-weight: 700 !important;
	font-style: normal !important;
	line-height: 1 !important;
	height: 22px !important;
	min-height: 22px !important;
	max-height: 22px !important;
	width: 25px !important;
	min-width: 25px !important;
	max-width: 25px !important;
	cursor: pointer !important;
	vertical-align: baseline !important;
}

#qrmove .qrmove-right button.qrmove-control{
	width: 20px !important;
	min-width: 20px !important;
	max-width: 20px !important;
	padding: 0 3px !important;
}

#qrmove .qrmove-left,
#qrmove .qrmove-right{
	display: flex;
	height: 100%;
	align-items: stretch;
	gap: 1px;
}

#qrmove .qrmove-spacer{
	flex: 1;
}

/* ========================= GRID / LAYOUT ========================= */
#qrgrid{
	display: flex;
	flex-direction: column;
	row-gap: 2px;
	column-gap: 4px;
	width: 100%;
	box-sizing: border-box;
}

#qr form.qr-compact #qrgrid > #qrpersona,
#qr form.qr-compact #qrgrid > textarea#body,
#qr form.qr-compact #qrgrid > .qr-row-captcha,
#qr form.qr-compact #qrgrid > .qr-row{
	margin: 0;
}

.qr-row{
	display: flex;
	flex-direction: row;
	gap: 4px;
	width: 100%;
	box-sizing: border-box;
	align-items: stretch;
}

.qr-col{
	display: flex;
	flex-direction: column;
	flex: 1 1 0;
	min-width: 0;
	gap: 2px;
}

.qr-left-col{
	flex: 0 0 auto;
}

.qr-right-col{
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 4px;
	flex: 1 1 auto;
	min-width: 130px;
	align-items: center;
}

/* ========================= FORM (geometry) ========================= */
#qr form[name="post"],
#qr form.qr-compact{
	margin: 0;
	padding: 0;
	border: 0;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	box-sizing: border-box;
}

form.qr-compact > table{
	display: none;
}

#qr form.qr-compact #qrgrid{
	display: flex;
	flex-direction: column;
	row-gap: 2px;
	column-gap: 4px;
	padding-top: 1px;
	width: 100%;
	box-sizing: border-box;
}

.qr-row-captcha{
	width: 100%;
	box-sizing: border-box;
}

.qr-row-captcha[hidden]{
	display: none !important;
}

/* ========================= PERSONA (geometry) ========================= */
#qrpersona{
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	width: 100%;
	min-width: 0;
	box-sizing: border-box;
	overflow: hidden;
}

#qrpersona input,
#qr form.qr-compact input[type="text"],
#qr form.qr-compact input[type="password"],
#qr form.qr-compact select.qr-flag{
	line-height: 16px !important;
	min-height: 22px !important;
	padding: 2px 3px !important;
	min-width: 0 !important;
	box-sizing: border-box;
}

#qrpersona input{
	flex: 1 1 0;
	min-width: 0;
	width: 0;
	margin: 0;
	box-sizing: border-box;
	transition: flex 0.15s ease;
}

#qrpersona input:focus{
	flex: 3 1 0;
	outline: none;
}

/* ========================= TEXTAREA (geometry) ========================= */
#qr form.qr-compact textarea#body{
	width: 100%;
	height: 110px !important;
	min-height: 110px !important;
	max-height: none;
	min-width: 0 !important;
	max-width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 3px !important;
	line-height: 16px !important;
	resize: both;
	outline: none;
}

/* ========================= OPTIONS (geometry) ========================= */
#qr-options{
	display: flex;
	flex-direction: column;
	grid-column: 1 / -1;
	padding: 0;
	gap: 2px;
}

#qr form.qr-compact input[name="embed"]{
	grid-column: 1 / -1;
	width: 100%;
	box-sizing: border-box;
	min-width: 0 !important;
	min-height: 22px !important;
	margin: 0;
	line-height: 16px !important;
	padding: 2px 3px !important;
}

#qr label{
	cursor: pointer;
	line-height: 16px;
}

/* ========================= FILE INPUT (geometry) ========================= */
.qr-hidden-file{
	position: fixed;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

/* ========================= MEDIA SLOT (geometry) ========================= */
.qr-media-slot{
	display: flex;
	flex-direction: column;
	gap: 4px;
	width: 80px;
	height: 80px;
	position: relative;
}

.qr-media-slot button{
	width: 100%;
	height: 100%;
	margin: 0;
}

.qr-media-slot[data-has-file="true"] button{
	display: none;
}

.qr-media-slot[data-has-file="true"] .qr-media-thumbwrap{
	display: flex;
}

.qr-media-thumbwrap{
	display: none;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	flex-direction: column;
	align-items: stretch;
	justify-content: stretch;
}

/* ========================= SUBMIT / FLAG (geometry) ========================= */
#qrsubmit,
#qr form.qr-compact select.qr-flag{
	min-height: 22px !important;
	height: 22px !important;
	padding: 2px 4px !important;
	margin: 0 !important;
	line-height: 16px !important;
	box-sizing: border-box;
}

#qrsubmit{
	grid-column: 1;
	min-width: 16ch;
	justify-self: start;
}

/* ========================= THUMBNAILS (geometry) ========================= */
.qrthumb{
	width: 80px;
	height: 80px;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	position: relative;
}

.qrremovethumb{
	position: absolute;
	top: 2px;
	right: 2px;
	width: 16px;
	height: 16px;
	font-size: 12px;
	text-align: center;
	line-height: 16px;
	cursor: pointer;
}

/* ========================= MISC (geometry) ========================= */
.qr-flag{
	grid-column: 2;
	width: 100%;
	box-sizing: border-box;
	min-width: 0;
}

#qr input[type='checkbox']{
	position: relative;
	top: 2px;
	margin: 0 4px 0 -1px;
}

/* ========================= MOBILE POSITIONING ========================= */
@media screen and (max-width: 480px){
	#qr{
		top: var(--qr-mobile-top, 2px) !important;
		left: 0 !important;
		z-index: 4;
	}
}

@media screen and (max-height: 480px) and (orientation: landscape) and (max-width: 932px) and (hover: none){
	#qr{
		top: var(--qr-mobile-top, 2px) !important;
		left: auto !important;
		right: 2px !important;
		z-index: 4;
		max-width: min(320px, calc(100vw - 4px));
	}
}
