/**
 * @version     CVS: 2.0
 * @package     com_rahrisks
 * @subpackage  mod_rahcomplaintsform
 * @copyright   2025 iSonic Pty Ltd
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @author      iSonic Digital <support@isonic.com.au>
 */

dt {
	margin-top: 1rem;
}

.form-complaint .form-field {
	display: grid;
	grid-template-columns: 1fr;
	grid-template-rows: max-content max-content;
	align-items: start;
	margin-block-end: 1rem;
	gap: .5rem;
}

.file-upload {
	height: 0;
	opacity: 0;
}

.file-upload.state-file-drop-on {
	display: grid;
	grid-template-columns: 1fr;
	grid-template-rows: 200px max-content;
	align-items: start;
	height: max-content;
	opacity: 1;
	interpolate-size: allow-keywords;
	transition: height .5s ease-in-out, opacity .25s .5s ease-in-out;
}

.file-drop {
	display: none;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	border: 2px dashed #ccc;
	text-align: center;
	cursor: pointer;
}

.file-drop.dragging {
	border-color: #008a9c;
	background-color: #dceded;
}

.file-upload.state-file-drop-on input[type=file] {
	display: none;
}

.file-upload.state-file-drop-on .file-drop {
	display: flex;
}

.file-upload .list {
	display: none;
}

.file-upload.state-file-drop-on .list {
	display: block;
}

.list {
	padding: 8px 0;
}

.list-item {
	position: relative;
	display: grid;
	grid-template-columns: 16px 24px 16px 1fr 16px auto 16px;
	grid-template-rows: 8px minmax(40px,auto) 8px;
	place-items: center;
}

.list-item :first-child {
	grid-area: 2 / 2 / 3 / 3;
}

.list-item :nth-child(2) {
	grid-area: 2 / 4 / 3 / 5;
	justify-self: start;
}

.list-item :nth-child(3) {
	grid-area: 2 / 6 / 3 / 7;
	font-size: .75rem;
}

.list-item:hover :nth-child(3) {
	position: relative;
	visibility: hidden;
}

.list-item:hover .list-item-filesize::after {
	content: 'Remove';
	display: block;
	position: absolute;
	top: 0;
	right: 0;
	padding: .35rem;
	border-radius: 5px;
	color: #fff;
	background-color: #c00;
	visibility: visible;
	text-align: right;
	line-height: 1;
	cursor: pointer;
	transition: all .2s ease-in-out;
	z-index: 1;
}

.list-item:hover .list-item-filesize:hover::after {
	background-color: #f31919;
	box-shadow: 5px 6px 13px #00000021;
}

.list-item[data-file-pending-hash]:hover .list-item-filesize::after {
	content: 'Exclude';
}

.list-item.list-item-exclude[data-file-pending-hash]:hover .list-item-filesize::after {
	content: 'Include';
	background-color: #00b40f;
}

.list-item.list-item-exclude[data-file-pending-hash]:hover .list-item-filesize:hover::after {
	background-color: #00c410;
}

.list-item.list-item-exclude[data-file-pending-hash]::before,
.list-item.list-item-exclude[data-file-pending-hash]::after {
	content: '';
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: #fffc;
}

.list-item.list-item-exclude[data-file-pending-hash]::after {
	top: 50%;
	height: 2px;
	background-color: #0003;
}

.list-item.list-item-exclude[data-file-pending-hash]:hover :nth-child(3) {
	visibility: unset;
}

.form-complaint .uk-fieldset {
	margin-top: 1rem;
}

.form-complaint .uk-fieldset:first-of-type,
.form-complaint .uk-fieldset > h3 {
	margin-top: 0;
}

.module-complaint-form.state-complaintsource-anonymous .section-report-for,
.module-complaint-form.state-complaintsource-anonymous .section-complaint-resolution .form-field:nth-of-type(1),
.module-complaint-form.state-complaintsource-anonymous .section-complaint-resolution .form-field:nth-of-type(2) {
	display: none;
}

.complaintsource-description > * {
	display: none;
}

.module-complaint-form.state-complaintsource-open .complaintsource-description-open,
.module-complaint-form.state-complaintsource-anonymous .complaintsource-description-anonymous {
	display: block;
}

.form-complaint .form-field-related-other,
.form-complaint .form-field-category-other,
.form-complaint .form-field-preferred-outcome-details {
	display: none;
}

.module-complaint-form.state-related-other .form-field-related-other,
.module-complaint-form.state-category-other .form-field-category-other,
.module-complaint-form.state-preferred-outcome-yes .form-field-preferred-outcome-details {
	display: revert;
}

.field-helper:empty {
	display: none;
}

.state-send {
	pointer-events: none;
}

.state-send::before {
	content: '';
	display: block;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: #fff;
	opacity: .75;
	z-index: 1;
}

.state-send::after {
	content: '';
	display: block;
	position: fixed;
	top: 50dvh;
	left: 50dvw;
	width: 100px;
	height: 100px;
	border: 10px solid rgba(0, 0, 0, .1);
	border-left-color: var(--primary);
	border-radius: 100px;
	transform: translate(-50%, -50%);
	animation: spin 1s linear reverse infinite;
	z-index: 2;
}

@keyframes spin {
	0% {
		transform: rotate(0deg);
	}

	100% {
		transform: rotate(360deg);
	}
}

.form-complaint-submitted,
.module-complaint-form.state-form-submitted .form-complaint {
	display: none;
}

.module-complaint-form.state-form-submitted .form-complaint-submitted {
	display: block;
}

.field-off {
	opacity: .5;
	pointer-events: none;
}