/**
 * Qweezly Public Styles
 *
 * Styles for the frontend form display and conditional logic results.
 *
 * @since 1.0.0
 */

.qweezly {
	--qweezly-primary-color: #3b82f6;
	--qweezly-primary-color-dark: #1d4ed8;
	--qweezly-primary-gradient-start: #f8fafc;
	--qweezly-primary-gradient-end: #f1f5f9;
	--qweezly-primary-hover-start: #2563eb;
	--qweezly-primary-hover-end: #1e40af;
	--qweezly-primary-rgb: 59, 130, 246;
	--qweezly-secondary-color: #8b5cf6;
	--qweezly-secondary-gradient-start: #fef7ff;
	--qweezly-secondary-gradient-end: #f3e8ff;
	--qweezly-secondary-rgb: 139, 92, 246;
}

/* Form container */
.qweezly-form {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 0;
}

/* Two-column layout */
.form-container {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 40px;
	align-items: stretch;
}

.form-column {
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.form-questions {
	padding: 40px;
	background: linear-gradient(135deg, var(--qweezly-primary-gradient-start) 0%, var(--qweezly-primary-gradient-end) 100%);
	border-left: 4px solid var(--qweezly-primary-color);
}

.form-answers {
	padding: 40px;
	background: linear-gradient(135deg, var(--qweezly-secondary-gradient-start) 0%, var(--qweezly-secondary-gradient-end) 100%);
	border-left: 4px solid var(--qweezly-secondary-color);
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Form fields */
.form-fields {
	margin-bottom: 30px;
}

.form-field {
	margin-bottom: 12px;
}

.form-field label {
	display: flex;
	align-items: center;
	margin-bottom: 0 !important;
	font-weight: 600;
	color: #1e293b;
	font-size: 16px;
	line-height: 1.4;
	position: relative;
	cursor: pointer;
	padding: 8px 12px;
	border-radius: 8px;
	transition: all 0.2s ease;
}

.form-field > label:first-child::before {
	content: '';
	position: absolute;
	left: -8px;
	top: 50%;
	transform: translateY(-50%);
	width: 3px;
	height: 16px;
	background: linear-gradient(135deg, var(--qweezly-primary-color) 0%, var(--qweezly-primary-color-dark) 100%);
	border-radius: 2px;
}

.form-field label:hover {
	color: var(--qweezly-primary-color);
	background: rgba(var(--qweezly-primary-rgb), 0.05);
}

.form-field input,
.form-field textarea,
.form-field select {
	width: 100%;
	padding: 16px;
	border: 2px solid #e2e8f0;
	border-radius: 12px;
	font-size: 16px;
	transition: all 0.3s ease;
	background: #ffffff;
	color: #1e293b;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus,
.submit-button:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
	border-color: var(--qweezly-primary-color);
	background: #ffffff;
	box-shadow: 0 0 0 4px rgba(var(--qweezly-primary-rgb), 0.15), 0 4px 12px rgba(var(--qweezly-primary-rgb), 0.1);
	transform: translateY(-1px);
}

/* Radio buttons and checkboxes */
.form-field input[type="radio"],
.form-field input[type="checkbox"] {
	width: auto;
	margin-right: 12px;
	transform: scale(1.2);
	accent-color: var(--qweezly-primary-color);
}

.form-field label input[type="radio"],
.form-field label input[type="checkbox"] {
	margin-right: 12px;
	margin-bottom: 0;
}

/* Multiple checkbox and radio options */
.form-field label {
	display: flex;
	align-items: center;
	margin-bottom: 8px;
	padding: 8px 12px;
	border-radius: 8px;
	transition: all 0.2s ease;
	cursor: pointer;
}

.form-field label:hover {
	background: rgba(var(--qweezly-primary-rgb), 0.05);
}

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

/* Checkbox and radio option styling */

.form-field input[type="radio"]:checked + span,
.form-field input[type="checkbox"]:checked + span {
	color: var(--qweezly-primary-color);
	font-weight: 600;
}

/* URL field styling */
.form-field input[placeholder*="example.com"] {
	font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
	font-size: 14px;
}

.form-field input[placeholder*="example.com"]:focus {
	border-color: #10b981;
	box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15), 0 4px 12px rgba(16, 185, 129, 0.1);
}

/* Select field styling */
.form-field select {
	appearance: none !important;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e") !important;
	background-repeat: no-repeat !important;
	background-position: right 16px center !important;
	background-size: 16px !important;
	padding: 16px 50px 16px 16px !important;
	min-height: 54px !important;
	line-height: 1.2 !important;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}

.form-field select option[disabled] {
	color: #9ca3af;
	font-style: italic;
}

.form-field select option[value=""] {
	color: #9ca3af;
	font-style: italic;
}

.form-field select.has-value {
	color: #1e293b;
	font-weight: 500;
}

.form-field select.has-value option:not([value=""]) {
	color: #1e293b;
	font-weight: 500;
}

/* Ensure select text is fully visible */
.form-field select option {
	padding: 8px 12px;
	background: #ffffff;
	color: #1e293b;
}

.form-field select option:hover {
	background: #f3f4f6;
}

/* Focus state for better accessibility */
.form-field select:focus {
	border-color: var(--qweezly-primary-color);
	box-shadow: 0 0 0 4px rgba(var(--qweezly-primary-rgb), 0.15);
}

/* Additional select field improvements */
.form-field select::-ms-expand {
	display: none;
}

.form-field select:focus {
	outline: none;
}

/* Ensure selected text is visible */
.form-field select.has-value {
	color: #1e293b !important;
	font-weight: 500 !important;
}

/* Better spacing for dropdown options */
.form-field select option:first-child {
	font-weight: 500;
	color: #6b7280;
}

/* Submit button */
.form-submit {
	text-align: center;
	margin-top: 30px;
}

.submit-button {
	background: linear-gradient(135deg, var(--qweezly-primary-color) 0%, var(--qweezly-primary-color-dark) 100%);
	color: white;
	border: none;
	padding: 18px 36px;
	border-radius: 12px;
	font-size: 18px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 4px 15px rgba(var(--qweezly-primary-rgb), 0.3);
}

.submit-button:hover {
	background: linear-gradient(135deg, var(--qweezly-primary-hover-start) 0%, var(--qweezly-primary-hover-end) 100%);
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(var(--qweezly-primary-rgb), 0.4);
}

.submit-button:disabled {
	background: #9ca3af;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

/* Messages */
.form-messages {
	margin-top: 15px;
}

.success-message {
	background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
	color: #166534;
	border: 1px solid #86efac;
	border-radius: 12px;
	padding: 16px;
	margin-bottom: 10px;
	box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
}

.error-message {
	background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
	color: #991b1b;
	border: 1px solid #fca5a5;
	border-radius: 12px;
	padding: 16px;
	margin-bottom: 10px;
	box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

/* Answers column styling */
.answers-container {
	width: 100%;
	text-align: center;
}

.default-content h3 {
	color: #581c87;
	font-size: 24px;
	font-weight: 700;
	margin-bottom: 16px;
}

.default-content p {
	color: #7c3aed;
	font-size: 16px;
	line-height: 1.6;
	margin-bottom: 24px;
}

.answer-placeholder {
	color: #a855f7;
	margin-top: 20px;
}

.answer-placeholder svg {
	opacity: 0.7;
}

/* Conditional Results */
.conditional-results {
	width: 100%;
	text-align: left;
	animation: fadeIn 0.5s ease-in;
	background: rgba(255, 255, 255, 0.8);
	padding: 24px;
	border-radius: 12px;
	backdrop-filter: blur(10px);
	border: 1px solid rgba(139, 92, 246, 0.2);
}

.conditional-content {
	font-size: 16px;
	line-height: 1.6;
	color: #333;
}

.conditional-content h1,
.conditional-content h2,
.conditional-content h3,
.conditional-content h4,
.conditional-content h5,
.conditional-content h6 {
	margin-top: 0;
	margin-bottom: 10px;
	color: #0073aa;
}

.conditional-content p {
	margin-bottom: 10px;
}

.conditional-content ul,
.conditional-content ol {
	margin-bottom: 15px;
	padding-left: 20px;
}

.conditional-content a {
	color: #0073aa;
	text-decoration: none;
}

.conditional-content a:hover {
	text-decoration: underline;
}

/* Fallback message styling */
.fallback-message {
	text-align: center;
	padding: 30px 20px;
	color: #666;
}

.fallback-message h3 {
	color: #333;
	margin: 0 0 15px 0;
	font-size: 20px;
	font-weight: 600;
}

.fallback-message p {
	margin: 0 0 10px 0;
	font-size: 16px;
	line-height: 1.5;
}

.fallback-message p:last-child {
	margin-bottom: 0;
	font-size: 14px;
	color: #888;
}

/* Form submission messages */
.form-success,
.form-error {
	text-align: center;
	padding: 30px 20px;
	border-radius: 12px;
}

.form-success {
	background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
	border: 2px solid #10b981;
	color: #065f46;
}

.form-success h3 {
	margin: 0 0 15px 0;
	color: #047857;
	font-size: 24px;
	font-weight: 600;
}

.form-success p {
	margin: 0 0 20px 0;
	font-size: 16px;
	color: #065f46;
}

.form-error {
	background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
	border: 2px solid #ef4444;
	color: #991b1b;
}

.form-error h3 {
	margin: 0 0 15px 0;
	color: #dc2626;
	font-size: 24px;
	font-weight: 600;
}

.form-error p {
	margin: 0 0 20px 0;
	font-size: 16px;
	color: #991b1b;
}

/* Animation */
@keyframes fadeIn {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Responsive design */
@media (max-width: 768px) {
	.form-container {
		grid-template-columns: 1fr;
		gap: 20px;
	}
	
	.form-column {
		padding: 24px;
	}
	
	.form-answers {
		min-height: 200px;
	}
	
	.form-field input,
	.form-field textarea,
	.form-field select {
		font-size: 16px; /* Prevent zoom on iOS */
	}
	
	.submit-button {
		width: 100%;
		padding: 15px;
	}
}

/* Required field indicator */
.form-field label.required::after {
	content: " *";
	color: #dc3232;
}
