/**
 * Service Management - Customer Form Styles
 * Designed to work as a shortcode in any theme (including FSE themes)
 */

/* Container */
.sm-form-wrapper {
	max-width: 800px;
	margin: 0 auto;
	padding: 20px 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 16px;
	line-height: 1.6;
	color: #1e1e1e;
}

/* Messages */
.sm-form-message {
	max-width: 600px;
	margin: 40px auto;
	padding: 40px;
	text-align: center;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sm-form-message h2 {
	margin: 0 0 15px;
	font-size: 1.5rem;
}

.sm-form-message p {
	margin: 0 0 15px;
	color: #666;
}

.sm-icon {
	margin-bottom: 20px;
}

.sm-icon-error {
	color: #dc3545;
}

.sm-icon-success {
	color: #28a745;
}

.sm-status-box {
	display: inline-block;
	padding: 12px 20px;
	margin: 15px 0;
	background: #f0f0f0;
	border-radius: 6px;
}

.sm-status-badge {
	display: inline-block;
	padding: 4px 12px;
	margin-left: 8px;
	background: #0073aa;
	color: #fff;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
}

/* Header */
.sm-form-header {
	text-align: center;
	margin-bottom: 30px;
}

.sm-form-header h2 {
	margin: 0 0 10px;
	font-size: 1.75rem;
	font-weight: 600;
}

.sm-form-intro {
	color: #666;
	font-size: 1.1rem;
	margin: 0;
}

/* Order Info */
.sm-order-info {
	background: #f8f9fa;
	border: 1px solid #e2e4e7;
	border-radius: 8px;
	padding: 20px 24px;
	margin-bottom: 30px;
}

.sm-order-info h3 {
	margin: 0 0 15px;
	font-size: 0.875rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #666;
	font-weight: 600;
}

.sm-order-details {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 15px;
}

.sm-order-detail {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.sm-label {
	font-size: 0.875rem;
	color: #666;
}

.sm-value {
	font-weight: 600;
	color: #1e1e1e;
}

/* Items Container */
.sm-items-container {
	margin-bottom: 30px;
}

.sm-items-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	flex-wrap: wrap;
	gap: 10px;
}

.sm-items-header h3 {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
}

/* Buttons */
.sm-button {
	display: inline-block;
	padding: 10px 20px;
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 0.2s, transform 0.1s;
	font-family: inherit;
}

.sm-button:hover {
	transform: translateY(-1px);
}

.sm-button-primary {
	background: #0073aa;
	color: #fff;
}

.sm-button-primary:hover {
	background: #005a87;
	color: #fff;
}

.sm-button-secondary {
	background: #f0f0f0;
	color: #1e1e1e;
	border: 1px solid #ddd;
}

.sm-button-secondary:hover {
	background: #e0e0e0;
}

.sm-button-link {
	background: none;
	border: none;
	color: #dc3545;
	padding: 5px 10px;
	font-size: 14px;
	cursor: pointer;
}

.sm-button-link:hover {
	text-decoration: underline;
}

/* Item Card */
.sm-item {
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 8px;
	margin-bottom: 20px;
	overflow: hidden;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.sm-item-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 20px;
	background: #f8f9fa;
	border-bottom: 1px solid #e2e4e7;
}

.sm-item-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
}

.sm-item-fields {
	padding: 24px;
}

/* Fields */
.sm-field {
	margin-bottom: 20px;
}

.sm-field:last-child {
	margin-bottom: 0;
}

.sm-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
	font-size: 14px;
	color: #1e1e1e;
}

.sm-required {
	color: #dc3545;
}

.sm-field input[type="text"],
.sm-field input[type="date"],
.sm-field textarea {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid #ddd;
	border-radius: 6px;
	font-size: 15px;
	font-family: inherit;
	background: #fff;
	transition: border-color 0.2s, box-shadow 0.2s;
	box-sizing: border-box;
}

.sm-field input:focus,
.sm-field textarea:focus {
	border-color: #0073aa;
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.sm-field input::placeholder,
.sm-field textarea::placeholder {
	color: #999;
}

.sm-description {
	font-size: 13px;
	color: #666;
	margin: 6px 0 0;
}

.sm-field-row {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 20px;
	margin-bottom: 20px;
}

@media (max-width: 600px) {
	.sm-field-row {
		grid-template-columns: 1fr;
	}
}

/* File Upload */
.sm-file-upload {
	padding: 20px;
	border: 2px dashed #ddd;
	border-radius: 8px;
	text-align: center;
	background: #fafafa;
	transition: border-color 0.2s;
}

.sm-file-upload:hover {
	border-color: #0073aa;
}

.sm-file-input {
	margin-bottom: 8px;
}

.sm-uploaded-files {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 15px;
	justify-content: center;
}

.sm-uploaded-file {
	position: relative;
	width: 80px;
	height: 80px;
	border: 1px solid #ddd;
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
}

.sm-uploaded-file img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sm-uploaded-file .sm-file-remove {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 22px;
	height: 22px;
	background: rgba(220, 53, 69, 0.9);
	color: #fff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sm-uploaded-file-pdf {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f0f0f0;
	font-size: 12px;
	color: #666;
	font-weight: 600;
}

.sm-uploading {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	font-size: 11px;
	color: #666;
}

/* Template Image Upload Field */
.sm-image-upload-field {
	padding: 20px;
	border: 2px dashed #ddd;
	border-radius: 8px;
	text-align: center;
	background: #fafafa;
	transition: border-color 0.2s;
}

.sm-image-upload-field:hover {
	border-color: #0073aa;
}

.sm-image-upload-field .sm-trigger-image-upload {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	color: #333;
	transition: border-color 0.2s, background 0.2s;
}

.sm-image-upload-field .sm-trigger-image-upload:hover {
	border-color: #0073aa;
	background: #f0f7fc;
}

.sm-image-upload-field .description {
	display: block;
	margin-top: 8px;
	font-size: 12px;
	color: #888;
}

.sm-image-upload-preview {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 15px;
	justify-content: center;
}

.sm-image-upload-preview:empty {
	display: none;
}

.sm-image-upload-field .sm-uploaded-image {
	position: relative;
	width: 80px;
	height: 80px;
	border: 1px solid #ddd;
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
}

.sm-image-upload-field .sm-uploaded-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sm-image-upload-field .sm-remove-image {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 22px;
	height: 22px;
	background: rgba(220, 53, 69, 0.9);
	color: #fff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sm-image-upload-field .sm-uploading {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 80px;
	height: 80px;
	font-size: 11px;
	color: #666;
	border: 1px solid #ddd;
	border-radius: 6px;
	background: #f9f9f9;
}

/* Form Actions */
.sm-form-actions {
	margin-top: 30px;
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 15px;
}

.sm-submit-button {
	padding: 14px 40px;
	font-size: 16px;
}

.sm-submit-button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

/* Spinner */
.sm-spinner {
	display: none;
	width: 20px;
	height: 20px;
	border: 2px solid #f3f3f3;
	border-top: 2px solid #0073aa;
	border-radius: 50%;
	animation: sm-spin 0.8s linear infinite;
}

.sm-spinner.is-active {
	display: inline-block;
}

@keyframes sm-spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Messages */
#sm-form-messages {
	margin-top: 20px;
}

.sm-message {
	padding: 16px 20px;
	border-radius: 6px;
	margin-bottom: 10px;
	text-align: center;
}

.sm-message-success {
	background: #d4edda;
	color: #155724;
	border: 1px solid #c3e6cb;
}

.sm-message-error {
	background: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
}

/* Loading State */
.sm-loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Heading (H3), Subheading (H4), and Divider */
.sm-heading {
	margin: 30px 0 15px;
	padding-bottom: 10px;
	font-size: 1.125rem;
	font-weight: 600;
	color: #1e1e1e;
	border-bottom: 2px solid #0073aa;
}

.sm-heading:first-child {
	margin-top: 0;
}

.sm-subheading {
	margin: 20px 0 12px;
	padding: 0;
	font-size: 0.95rem;
	font-weight: 600;
	color: #50575e;
}

.sm-divider {
	margin: 30px 0;
	border: none;
	border-top: 2px solid #e2e4e7;
}

/* Dark mode support for FSE themes */
@media (prefers-color-scheme: dark) {
	.sm-form-wrapper {
		color: inherit;
	}

	.sm-field input[type="text"],
	.sm-field input[type="date"],
	.sm-field textarea {
		background: inherit;
		color: inherit;
	}
}
