/**
 * Mobile Forms Styling
 * Touch-friendly, responsive form layouts for mobile users
 * Maximizes screen space for better accessibility
 */

/* Overlay and container */
.mobile-form-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

.mobile-form-overlay.show {
	opacity: 1;
	pointer-events: all;
}

.mobile-form-container {
	width: 100%;
	max-width: 100%;
	height: 100dvh;
	background: white;
	border-radius: 16px;
	display: flex;
	flex-direction: column;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
	transform: scale(0.9);
	transition: transform 0.3s ease;
	opacity: 0;
	padding-bottom: env(safe-area-inset-bottom);
}

.mobile-form-overlay.show .mobile-form-container {
	transform: scale(1);
	opacity: 1;
}

/* Form structure */
.mobile-form {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
}

.mobile-form-header {
	padding: 24px;
	border-bottom: 2px solid #f0f0f0;
	flex-shrink: 0;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 16px;
}

.mobile-form-title {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.mobile-form-header h2 {
	margin: 0;
	font-size: 24px;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1.3;
}

.mobile-form-header .position-name {
	margin: 0;
	font-size: 16px;
	color: #555;
	font-weight: 500;
}

.close-btn {
	background: none;
	border: none;
	font-size: 36px;
	cursor: pointer;
	color: #aaa;
	padding: 0;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: color 0.2s;
}

.close-btn:hover,
.close-btn:active {
	color: #333;
}

/* Progress bar for multi-step forms */
.mobile-form-progressbar {
	display: flex;
	gap: 16px;
	padding: 20px 24px;
	background: #f9f9f9;
	border-bottom: 1px solid #e0e0e0;
	justify-content: flex-start;
	flex-shrink: 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.progress-step {
	flex: 0 0 auto;
	min-width: 120px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	opacity: 0.5;
	transition: opacity 0.2s;
}

.progress-step.active {
	opacity: 1;
}

.step-number {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: #e8e8e8;
	color: #999;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 20px;
	transition: all 0.2s;
}

.progress-step.active .step-number {
	background: #4CAF50;
	color: white;
	box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.step-label {
	font-size: 14px;
	text-align: center;
	font-weight: 500;
	color: #666;
	line-height: 1.3;
}

.progress-step.active .step-label {
	color: #333;
	font-weight: 600;
}

/* Inline progress indicator used in edit flows */
.form-progress {
	width: 100%;
	height: 8px;
	background: #f0f0f0;
	border-radius: 999px;
	overflow: hidden;
	margin: 0 0 20px 0;
}

.form-progress .progress-fill {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, #4CAF50, #43a047);
	border-radius: 999px;
	transition: width 0.25s ease;
}

.progress-step.active .step-label {
	color: #333;
	font-weight: 600;
}

/* Form steps */
.form-step {
	display: none;
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 0.3s, transform 0.3s;
}

.form-step.active {
	display: block;
	opacity: 1;
	transform: translateY(0);
}

/* Form body */
.mobile-form-body {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 28px;
}

/* Form steps */
.form-step {
	display: none;
	opacity: 0;
	transition: opacity 0.3s ease-in-out;
}

.form-step.active {
	display: block;
	opacity: 1;
}

.form-step h3 {
	margin: 0 0 24px 0;
	font-size: 22px;
	font-weight: 600;
	color: #1a1a1a;
}

/* Checkbox and radio groups */
.checkbox-group,
.radio-group {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 24px 0;
}

.checkbox-label,
.radio-label {
	display: flex;
	align-items: center;
	padding: 16px 18px;
	border: 2px solid #ddd;
	border-radius: 10px;
	cursor: pointer;
	transition: all 0.2s;
	background: #fafafa;
	user-select: none;
	-webkit-user-select: none;
}

.checkbox-label:hover,
.radio-label:hover {
	background: #f0f7ff;
	border-color: #4CAF50;
}

.checkbox-label.is-required {
	border-color: #d4a017;
	background: #fff9e6;
}

.checkbox-label.is-required input[disabled] {
	cursor: not-allowed;
}

.required-badge {
	display: inline-block;
	margin-left: 8px;
	padding: 2px 8px;
	border-radius: 8px;
	background: #ffd54f;
	color: #8a6d00;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
}

.checkbox-label:has(input:checked),
.radio-label:has(input:checked) {
	background: #e8f5e9;
	border-color: #4CAF50;
	border-width: 3px;
}

.checkbox-label input[type="checkbox"],
.checkbox-label input[type="radio"],
.radio-label input[type="checkbox"],
.radio-label input[type="radio"] {
	margin-right: 15px;
	width: 22px;
	height: 22px;
	cursor: pointer;
	accent-color: #4CAF50;
}

/* Override generic.css checkbox hiding for mobile forms */
.mobile-form .checkbox-label input[type="checkbox"],
.mobile-form .radio-label input[type="checkbox"],
.mobile-form .terms-checkbox-label input[type="checkbox"] {
	opacity: 1;
	position: relative;
	margin: 0 12px 0 0;
	left: 0;
	top: 0;
	flex-shrink: 0;
}

.terms-checkbox-label {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 16px;
	font-size: 16px;
	color: #1a1a1a;
}

.terms-section {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-top: 12px;
}

.terms-preview {
	max-height: 260px;
	overflow-y: auto;
	border: 1px solid #ddd;
	padding: 12px;
	border-radius: 8px;
	background: #fafafa;
	font-size: 15px;
	line-height: 1.5;
}

.checkbox-label span,
.radio-label span {
	flex: 1;
	font-size: 16px;
	color: #1a1a1a;
	font-weight: 500;
}

/* Articles group */
.articles-group {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin: 24px 0;
}

.article-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px;
	border: 2px solid #ddd;
	border-radius: 10px;
	background: #fafafa;
	gap: 16px;
}

.article-item label {
	flex: 1;
	font-size: 16px;
	color: #1a1a1a;
	font-weight: 500;
	margin: 0;
}

.article-item input[type="number"] {
	width: 80px;
	height: 48px;
	font-size: 18px;
	padding: 8px 12px;
	border: 2px solid #ddd;
	border-radius: 8px;
	text-align: center;
	margin: 0;
}

.article-item input[type="number"]:focus {
	border-color: #4CAF50;
	outline: none;
}

/* Form inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
	font-size: 16px;
	padding: 14px 16px;
	border: 2px solid #ddd;
	border-radius: 8px;
	font-family: inherit;
	box-sizing: border-box;
	transition: border-color 0.2s;
	width: 100%;
	margin-bottom: 16px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select {
	height: 52px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: #4CAF50;
	box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

textarea {
	min-height: 140px;
	resize: vertical;
}

select {
	background-image: url('data:image/svg+xml;utf8,<svg fill="black" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 40px;
	appearance: none;
}

/* Summary section */
.summary-section {
	padding: 16px 0;
}

.summary-content {
	background: #f9f9f9;
	border-radius: 10px;
	padding: 20px;
}

.summary-item {
	margin-bottom: 24px;
}

.summary-item:last-child {
	margin-bottom: 0;
}

.summary-item h4 {
	margin: 0 0 12px 0;
	font-size: 18px;
	font-weight: 600;
	color: #1a1a1a;
	border-bottom: 2px solid #ddd;
	padding-bottom: 8px;
}

.summary-item ul {
	margin: 0;
	padding: 0 0 0 20px;
	list-style: disc;
}

.summary-item li {
	margin: 8px 0;
	font-size: 16px;
	color: #333;
	line-height: 1.5;
}

.summary-empty {
	text-align: center;
	color: #999;
	font-size: 16px;
	font-style: italic;
	padding: 20px;
}
.summary-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 8px;
}

.summary-table td {
	font-size: 16px;
	color: #333;
	border-bottom: 1px solid #eee;
}

.summary-table tr:last-child td {
	border-bottom: none;
}

.summary-table .summary-price {
	font-weight: 500;
	white-space: nowrap;
}

.summary-table .summary-vat {
	padding-left: 20px;
	color: #666;
	font-size: 14px;
	font-style: italic;
}

.summary-table .summary-total-row td {
	padding-top: 12px;
	border-top: 2px solid #ddd;
	font-weight: 600;
}

.summary-grand-total {
	margin-top: 24px;
	padding-top: 24px;
	border-top: 3px solid #4CAF50;
}

.summary-table .grand-total-row td {
	font-size: 20px;
	font-weight: 700;
	color: #4CAF50;
	border: none;
}

.summary-text {
	margin: 8px 0 0 0;
	font-size: 16px;
	color: #333;
	line-height: 1.5;
	white-space: pre-wrap;
  word-wrap: break-word;
}
/* Form buttons */
.mobile-form-buttons {
	display: flex;
	gap: 12px;
	padding: 24px;
	border-top: 2px solid #f0f0f0;
	flex-shrink: 0;
	background: white;
	margin-top: auto;
}

.mobile-form-buttons button {
	flex: 1;
	padding: 16px 20px;
	border: none;
	border-radius: 10px;
	cursor: pointer;
	font-size: 16px;
	font-weight: 600;
	transition: all 0.2s ease;
	min-height: 54px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.mobile-form-buttons button[type="submit"] {
	background-color: #4CAF50;
	color: white;
}

.mobile-form-buttons button[type="submit"]:hover {
	background-color: #45a049;
	transform: scale(1.02);
}

.mobile-form-buttons button[type="submit"]:active {
	transform: scale(0.98);
}

.mobile-form-buttons button[type="submit"]:disabled {
	background-color: #ccc;
	cursor: not-allowed;
	transform: none;
	opacity: 0.6;
}

.mobile-form-buttons button[type="button"] {
	background-color: #f5f5f5;
	color: #1a1a1a;
	border: 2px solid #ddd;
}

.mobile-form-buttons button[type="button"]:hover {
	background-color: #e8e8e8;
	border-color: #999;
}

.mobile-form-buttons button[type="button"]:active {
	transform: scale(0.98);
}

/* Navigation buttons for multi-step flows */
.form-nav-buttons {
	display: flex;
	gap: 12px;
	padding: 16px 24px 24px 24px;
	border-top: 1px solid #f0f0f0;
	background: #fff;
	position: sticky;
	bottom: 0;
	left: 0;
	right: 0;
}

.nav-btn {
	flex: 1;
	padding: 14px 16px;
	border-radius: 10px;
	border: 2px solid transparent;
	font-size: 16px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	cursor: pointer;
	transition: all 0.2s ease;
	min-height: 52px;
}

.nav-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none;
}

.nav-btn-primary {
	background: #4CAF50;
	color: #fff;
	border-color: #4CAF50;
}

.nav-btn-primary:hover:not(:disabled) {
	background: #45a049;
	border-color: #45a049;
	transform: translateY(-1px);
}

.nav-btn-primary:active:not(:disabled) {
	transform: scale(0.98);
}

.nav-btn-primary-submit {
	background: linear-gradient(90deg, #4CAF50, #43a047);
	border-color: #43a047;
}

.nav-btn-secondary {
	background: #f7f7f7;
	color: #1a1a1a;
	border-color: #ddd;
}

.nav-btn-secondary:hover:not(:disabled) {
	background: #eee;
	border-color: #b5b5b5;
	transform: translateY(-1px);
}

.nav-btn-secondary:active:not(:disabled) {
	transform: scale(0.98);
}

.nav-btn-cancel {
	background: #fff0f0;
	color: #b71c1c;
	border-color: #f5b5b5;
}

.nav-btn-cancel:hover:not(:disabled) {
	background: #ffe5e5;
	border-color: #eb8f8f;
	transform: translateY(-1px);
}

.nav-btn-cancel:active:not(:disabled) {
	transform: scale(0.98);
}

/* Notifications */
.mobile-form-notification {
	position: fixed;
	top: 30px;
	left: 20px;
	right: 20px;
	padding: 18px 24px;
	border-radius: 10px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
	z-index: 10001;
	animation: slideDown 0.3s ease-in-out;
	font-size: 16px;
	font-weight: 500;
	text-align: center;
}

.mobile-form-notification.success {
	background-color: #4CAF50;
	color: white;
}

.mobile-form-notification.error {
	background-color: #f44336;
	color: white;
}

.mobile-form-notification.info {
	background-color: #2196F3;
	color: white;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* User search styles */
.user-search-results {
	display: none;
	max-height: 200px;
	overflow-y: auto;
	border: 1px solid #ddd;
	border-radius: 8px;
	background: white;
	margin-top: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-search-result {
	padding: 12px 16px;
	cursor: pointer;
	border-bottom: 1px solid #f0f0f0;
	transition: background-color 0.2s;
}

.user-search-result:last-child {
	border-bottom: none;
}

.user-search-result:hover {
	background-color: #f5f5f5;
}

.user-search-result:active {
	background-color: #e0e0e0;
}

.selected-user-display {
	margin-top: 12px;
	padding: 12px;
	background-color: #f0f8ff;
	border: 1px solid #90caf9;
	border-radius: 8px;
	font-size: 14px;
}

.selected-user-display strong {
	color: #1976d2;
	margin-right: 8px;
}

.selected-user-display span {
	color: #333;
}

.ssinfo {
	padding: 12px;
	border-radius: 8px;
	margin-bottom: 16px;
	font-size: 14px;
}

.ssinfo label {
	font-weight: 600;
	color: #555;
	margin-right: 8px;
}

.ssinfo p {
	display: inline;
	margin: 0;
	color: #333;
}

.ssinfo br {
	display: block;
	margin: 6px 0;
}

/* Responsive adjustments for tablet/desktop */
@media (min-width: 769px) {
	.mobile-form-container {
		width: 90%;
		max-width: 700px;
		height: 75dvh;
	}
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
	.mobile-form-overlay,
	.mobile-form-container,
	.checkbox-label,
	.radio-label,
	.mobile-form-buttons button,
	.mobile-form-notification {
		transition: none;
		animation: none;
	}
}
