/* ============================================================
   FORMS - Frontend Styles
   ============================================================ */

.sf-form {
	max-width: 100%;
	margin: 0 auto;
}

/* ============================================================
   FORM GROUPS & LAYOUT
   ============================================================ */

.sf-form-group {
	margin-bottom: 20px;
	display: flex;
	flex-direction: column;
}

.sf-form-group.sf-field-width-half {
	width: calc(50% - 10px);
	float: left;
	margin-right: 20px;
}

.sf-form-group.sf-field-width-half:nth-child(even) {
	margin-right: 0;
	float: right;
}

.sf-form-group.sf-field-width-third {
	width: calc(33.333% - 14px);
	float: left;
	margin-right: 20px;
}

.sf-form-group.sf-field-width-third:nth-child(3n) {
	margin-right: 0;
}

.sf-form::after {
	content: "";
	display: table;
	clear: both;
}

/* ============================================================
   LABELS
   ============================================================ */

.sf-label {
	display: block;
	margin-bottom: 8px;
	font-weight: 500;
	color: #333;
	font-size: 14px;
}

.sf-required {
	color: #d32f2f;
	margin-left: 3px;
}

/* ============================================================
   INPUTS & TEXTAREAS
   ============================================================ */

.sf-input {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	line-height: 1.5;
	color: #333;
	background-color: #fff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
	box-sizing: border-box;
}

.sf-input:focus {
	outline: none;
	border-color: #3366ff;
	box-shadow: 0 0 0 3px rgba(51, 102, 255, 0.1);
}

.sf-input::placeholder {
	color: #999;
}

.sf-textarea {
	resize: vertical;
	min-height: 120px;
}

.sf-input[type="date"],
.sf-input[type="time"],
.sf-input[type="datetime-local"] {
	padding: 10px 12px;
}

.sf-input[type="file"] {
	padding: 8px 0;
	border: 1px solid #ddd;
	border-radius: 4px;
}

/* ============================================================
   SELECTS
   ============================================================ */

.sf-select {
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-color: #fff;
	padding-right: 35px;
}

.sf-select:focus {
	outline: none;
	border-color: #3366ff;
	box-shadow: 0 0 0 3px rgba(51, 102, 255, 0.1);
}

.sf-select option {
	padding: 8px;
	color: #333;
	background-color: #fff;
}

/* ============================================================
   RADIO BUTTONS
   ============================================================ */

.sf-radio-group {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.sf-radio-label {
	display: flex;
	align-items: center;
	cursor: pointer;
	user-select: none;
}

.sf-radio {
	width: 18px;
	height: 18px;
	margin-right: 10px;
	cursor: pointer;
	accent-color: #3366ff;
	flex-shrink: 0;
}

.sf-radio-label span {
	color: #333;
	font-size: 14px;
}

/* ============================================================
   CHECKBOXES
   ============================================================ */

.sf-checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.sf-checkbox-label {
	display: flex;
	align-items: center;
	cursor: pointer;
	user-select: none;
}

.sf-checkbox {
	width: 18px;
	height: 18px;
	margin-right: 10px;
	cursor: pointer;
	accent-color: #3366ff;
	flex-shrink: 0;
}

.sf-checkbox-label span {
	color: #333;
	font-size: 14px;
}

/* ============================================================
   SUBMIT BUTTON
   ============================================================ */

.sf-submit-btn {
	background-color: #3366ff;
	color: #fff;
	border: none;
	padding: 14px 30px;
	font-size: 15px;
	font-weight: 500;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.3s ease;
	margin-top: 10px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.sf-submit-btn:hover {
	background-color: #254fc7;
	box-shadow: 0 4px 12px rgba(51, 102, 255, 0.3);
}

.sf-submit-btn:active {
	transform: translateY(1px);
}

.sf-submit-btn:disabled {
	background-color: #ccc;
	cursor: not-allowed;
	box-shadow: none;
}

/* ============================================================
   SUCCESS/ERROR MESSAGES
   ============================================================ */

.sf-form-message {
	padding: 15px;
	border-radius: 4px;
	margin-bottom: 20px;
	animation: slideDown 0.3s ease;
}

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

.sf-form-message.success {
	background-color: #f1f8e9;
	border-left: 4px solid #4caf50;
	color: #2e7d32;
}

.sf-form-message.error {
	background-color: #ffebee;
	border-left: 4px solid #d32f2f;
	color: #c62828;
}

/* ============================================================
   FORM LOADING STATE
   ============================================================ */

.sf-form.loading .sf-submit-btn {
	pointer-events: none;
	opacity: 0.7;
}

.sf-form.loading .sf-submit-btn::after {
	content: "...";
	animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
	0%,
	20% {
		content: ".";
	}
	40% {
		content: "..";
	}
	60%,
	100% {
		content: "...";
	}
}

/* ============================================================
   FIELD VALIDATION STATES
   ============================================================ */

.sf-form-group.has-error .sf-input,
.sf-form-group.has-error .sf-select,
.sf-form-group.has-error .sf-textarea {
	border-color: #d32f2f;
	box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.sf-form-group.has-error .sf-label {
	color: #d32f2f;
}

.sf-error-message {
	color: #d32f2f;
	font-size: 13px;
	margin-top: 5px;
	display: none;
}

.sf-form-group.has-error .sf-error-message {
	display: block;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 768px) {
	.sf-form-group.sf-field-width-half,
	.sf-form-group.sf-field-width-half:nth-child(even),
	.sf-form-group.sf-field-width-third,
	.sf-form-group.sf-field-width-third:nth-child(3n) {
		width: 100%;
		float: none;
		margin-right: 0;
		margin-bottom: 20px;
	}

	.sf-input,
	.sf-select,
	.sf-textarea {
		font-size: 16px; /* Prevents zoom on iOS */
	}

	.sf-submit-btn {
		width: 100%;
	}
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */

.sf-input:focus,
.sf-select:focus,
.sf-textarea:focus,
.sf-radio:focus,
.sf-checkbox:focus {
	outline: 2px solid #3366ff;
	outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: more) {
	.sf-input,
	.sf-select,
	.sf-textarea {
		border-width: 2px;
	}

	.sf-label {
		font-weight: 700;
	}
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
	.sf-input,
	.sf-select,
	.sf-textarea,
	.sf-submit-btn {
		transition: none;
	}

	.sf-form-message {
		animation: none;
	}
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
	.sf-input,
	.sf-select,
	.sf-textarea,
	.sf-input[type="date"],
	.sf-input[type="time"] {
		background-color: #2a2a2a;
		color: #f5f5f5;
		border-color: #444;
	}

	.sf-input::placeholder {
		color: #888;
	}

	.sf-input:focus,
	.sf-select:focus,
	.sf-textarea:focus {
		border-color: #5588ff;
		box-shadow: 0 0 0 3px rgba(85, 136, 255, 0.2);
	}

	.sf-label {
		color: #f5f5f5;
	}

	.sf-radio-label span,
	.sf-checkbox-label span {
		color: #f5f5f5;
	}

	.sf-select option {
		background-color: #2a2a2a;
		color: #f5f5f5;
	}
}
