@use '../utils' as *;

/*----------------------------------------*/
/*  forms scss
/*----------------------------------------*/

// single input style
.single-floating-input {
	position: relative;

	.input-icon {
		position: absolute;
		inset-inline-start: 28px;
		top: 50%;
		transform: translateY(-50%);
		z-index: 99;

		svg * {
			@include dark {
				stroke: var(--td-text-secondary);
			}
		}
	}
}

.form-floating {
	>label {
		padding: 1rem 0.75rem 1rem 5rem;
		font-weight: 700;
		z-index: 9;

		@include dark {
			color: var(--td-text-secondary);
		}

		@include rtl {
			left: auto;
			right: 0;
			padding: 10px 80px 0px 30px;
		}

		span {
			color: #FF661F;
		}
	}

	.form-control,
	.form-control-plaintext {
		padding: 1rem .75rem 1rem 5rem;
	}

	.form-control,
	.form-control-plaintext,
	.form-select {
		// height: 62px;
		// min-height: 62px;
		line-height: 4.25;
	}

	&::before {
		position: absolute;
		content: "";
		height: calc(100% - 20px);
		width: 1px;
		background-color: #EEEEEE;
		top: 50%;
		transform: translateY(-50%);
		inset-inline-start: 65px;
		z-index: 99;
	}

	.form-control {
		border-radius: 16px;
		color: #585858;
		font-size: 16px !important;

		&:focus {
			box-shadow: none;
			background-color: transparent;
		}
	}
}

.form-floating {
	>.form-control-plaintext {
		~ {
			label {
				color: #130804;
				transform: scale(.85) translateY(-.5rem) translateX(.15rem);
			}
		}
	}

	>.form-control {
		&:focus {
			~ {
				label {
					transform: scale(.85) translateY(-.5rem) translateX(.15rem);

					@include dark {
						transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
						color: var(--td-text-secondary);
					}

					@include rtl {
						transform: scale(0.85) translateY(-0.5rem) translateX(1.5rem);
					}
				}
			}
		}

		&:not(:placeholder-shown) {
			~ {
				label {
					transform: scale(.85) translateY(-.5rem) translateX(.15rem);
					color: var(--td-text-primary);

					@include dark {
						color: var(--td-text-secondary);
					}
				}
			}
		}
	}

	>.form-select {
		~ {
			label {
				color: #130804;
				transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
				padding: 1rem 0.75rem 1rem 5.6rem;
			}
		}
	}
}

.auth-from-step {
	display: flex;
	align-items: center;
	gap: 20px 135px;
	position: relative;
	width: max-content;
	margin: 0 auto;
	margin-bottom: 30px;

	&::before {
		position: absolute;
		content: "";
		height: 4px;
		width: calc(100% - 90px);
		top: 24px;
		inset-inline-start: 44px;
		background: linear-gradient(90deg, var(--golden-glam) 55.94%, #FFFFFF 100%);
	}

	.single-step {
		.number {
			width: 48px;
			height: 48px;
			border: 2px solid #E8E8E8;
			border-radius: 50%;
			display: flex;
			justify-content: center;
			align-items: center;
			position: relative;
			font-weight: 700;
			font-size: 24px;
			margin-bottom: 10px;
			background-color: var(--td-white);

			&.active {
				color: var(--td-primary);
				background-color: #FFEEE5;
				border: 2px solid transparent;
				background-image: linear-gradient(#FFEEE5, #FFEEE5), linear-gradient(45deg, var(--td-primary), var(--golden-glam));
				background-origin: border-box;
				background-clip: content-box, border-box;
			}
		}

		.title {
			font-size: 16px;
			font-weight: 400;
		}
	}
}

.single-step {
	&.active {
		.number {
			background: linear-gradient(154.73deg, var(--td-primary) -1.83%, var(--golden-glam) 138.32%);
			border: 0;
		}
	}
}

.form-floating {
	.form-control {
		line-height: 4.25;
		padding: 0 30px 10px 80px;

		@include dark {
			color: var(--td-white);
		}

		@include rtl {
			padding: 0 80px 0px 30px;
		}
	}

	.form-control-plaintext {
		line-height: 4.25;
		padding: 0 30px 10px 80px;
	}

	.form-select {
		line-height: 4.25;
		padding: 10px 30px 10px 80px;
		font-size: 16px;

		&:focus {
			border-color: var(--td-primary);
			box-shadow: none;
		}
	}

	.input-group {
		.form-select {
			width: 235px;
			flex: none;
		}

		.form-control {
			padding-inline-start: 20px;
		}
	}
}

// Custom select option
.custom-select-container {
	position: relative;
	display: inline-block;
	width: 100%;
}

.form-floating {
	.form-control {
		cursor: pointer;
		color: var(--td-heading);
	}
}

.form-floating>.form-control-plaintext~label::after,
.form-floating>.form-control:focus~label::after,
.form-floating>.form-control:not(:placeholder-shown)~label::after,
.form-floating>.form-select~label::after {
	content: "";
	background-color: transparent;
}

.custom-select-trigger {
	padding-inline-end: 1.5rem;
}

.custom-options {
	display: none;
	position: absolute;
	z-index: 999;
	width: 100%;
	max-height: 200px;
	overflow-y: auto;
	background-color: var(--td-white);
	border: 1px solid var(--td-border-primary);
	border-radius: 4px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.custom-option {
	padding: 10px;
	display: flex;
	align-items: center;
	cursor: pointer;

	img {
		width: 24px;
		height: 18px;
		margin-inline-end: 10px;
	}

	&:hover {
		background-color: #f1f1f1;
	}
}

.custom-option.selected {
	background-color: #f1f1f1;
}

.custom-select-container.active {
	.custom-options {
		display: block;
	}
}

.floating-group {
	display: flex;
	align-items: center;
	gap: 12px;

	.single-floating-input {
		flex-grow: 1;
	}

	.country-code {
		height: 58px;
		display: inline-flex;
		border-radius: 15px;

		.form-control {
			width: 80px;
			font-size: 16px;
			font-weight: 500;
			color: var(--td-heading);
			border-radius: 16px;
			text-align: center;

			&:focus {
				box-shadow: none;
				background-color: transparent;
			}

			@include dark {
				color: var(--td-white);
			}

			@include td-placeholder {
				font-weight: 500;

				@include dark {
					color: var(--td-text-secondary);
				}
			}
		}

		select {
			border-radius: 16px;

			&:focus {
				box-shadow: none;
				border-color: var(--td-primary);
			}
		}
	}
}

// feedback-invalid 
.feedback-invalid {
	font-size: 12px;
	margin-top: 3px;
	color: #DC1D4B;
	display: none;
}

.input-attention {
	font-size: 12px;
	color: var(--td-danger);

	&.xs {
		font-size: 10px;
	}
}

// OTP verification
.otp-verification {
	@include flexbox();
	gap: 15px 15px;
	flex-wrap: wrap;
	max-width: max-content;
	justify-content: center;
	margin: 0 auto;

	@media #{$xs,$sm,$md} {
		gap: 10px 10px;
	}

	input {
		height: 80px;
		width: 96px;
		text-align: center;
		font-size: 16px;
		font-weight: 500;
		border: 2px solid rgba(197, 197, 197, 0.7);
		border-radius: 12px;

		@include dark {
			color: var(--td-white);
		}

		@media #{$xs,$sm,$md,$lg} {
			height: 60px;
			width: 76px;
		}

		@media #{$xxs} {
			height: 60px;
			width: 50px;
		}

		&:focus {
			background: transparent;
			border-color: var(--td-primary);
		}
	}
}

// Image Upload Preview 
.td-form-group {
	.input-label {
		font-size: 16px;
		font-weight: 500;
		margin-bottom: 5px;

		span {
			color: #FF661F;
		}
	}
}

.file-upload-wrap {
	.top-content {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 15px;
	}

	.input-label {
		font-size: 14px;
		font-weight: 500;
		margin-bottom: 5px;
		color: $black;
	}

	#uploadItems {
		display: flex;
		flex-direction: column;
		gap: 16px;
	}
}

.upload-custom-file {
	position: relative;
	display: inline-block;
	width: 100%;
	height: 155px;
	text-align: center;

	input[type="file"] {
		position: absolute;
		top: 0;
		inset-inline-start: 0;
		width: 2px;
		height: 2px;
		overflow: hidden;
		opacity: 0;
	}

	label {
		z-index: 1;
		position: absolute;
		inset-inline-start: 0;
		top: 0;
		bottom: 0;
		inset-inline-end: 0;
		width: 100%;
		overflow: hidden;
		cursor: pointer;
		border-radius: 8px;
		transition: transform 0.4s;
		display: flex;
		flex-direction: column;
		justify-content: center;
		text-align: center;
		transition: transform 0.4s;
		background: rgba(255, 255, 255, 0.04);
		border: 1px solid rgba(21, 20, 21, 0.16);
		border-radius: 16px;

		span {
			display: block;
			color: var(--td-text-primary);
			font-size: 14px;
			font-weight: 500;
			-webkit-transition: color 0.4s;
			-moz-transition: color 0.4s;
			-ms-transition: color 0.4s;
			-o-transition: color 0.4s;
			transition: color 0.4s;

			b {
				color: var(--td-text-primary);
				font-weight: 500;
			}
		}

		.type-file-text {
			margin-top: 5px;
			color: $danger;
		}

		.upload-icon {
			width: 40px;
			margin: 0 auto;
			margin-bottom: 4px;
		}

		&.file-ok {
			background-repeat: no-repeat;
			background-position: center center;
			background-size: contain;
			border-color: var(--td-primary);

			span {
				position: absolute;
				bottom: 0;
				inset-inline-start: 0;
				width: 100%;
				padding: 0.3rem;
				color: $white;
				background-color: rgba($primary, $alpha: 0.4);
				font-weight: 500;
				font-size: 14px;
				margin: auto;
				text-decoration: none;
			}

			.upload-icon {
				display: none;
			}
		}
	}

	&.without-image {
		height: 167px;

		label {
			background-color: var(--td-text-primary);
		}
	}
}

.upload-thumb-close {
	position: absolute;
	inset-inline-end: 10px;
	top: 35px;
	z-index: 5;
	color: $danger;
	display: none;
}

.file-upload-close,
.input-file-close {
	position: absolute;
	top: 8px;
	inset-inline-end: 8px;
	color: #F34141;
	font-size: 18px;
	z-index: 55;
}