/**
 * BBA Form Builder - Frontend Stylesheet
 * Premium, clean, modern form layout styles designed to look stunning on any theme.
 */

.bbaform-frontend-wrap {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	max-width: 650px;
	margin: 20px auto;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
	padding: 30px;
	box-sizing: border-box;
}

.bbaform-title {
	margin-top: 0;
	margin-bottom: 25px;
	font-size: 22px;
	font-weight: 700;
	color: #1e293b;
	border-bottom: 2px solid #f1f5f9;
	padding-bottom: 12px;
}

.bbaform-fields-grid {
	display: grid;
	grid-template-columns: repeat(12, 1fr);
	gap: 20px;
}

/* Field Containers */
.bbaform-field-container {
	grid-column: span 12; /* Default full width */
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
}

/* Custom grid layouts via classes */
.bbaform-field-container.form-col-1 { grid-column: span 1; }
.bbaform-field-container.form-col-2 { grid-column: span 2; }
.bbaform-field-container.form-col-3 { grid-column: span 3; }
.bbaform-field-container.form-col-4 { grid-column: span 4; }
.bbaform-field-container.form-col-5 { grid-column: span 5; }
.bbaform-field-container.form-col-6 { grid-column: span 6; }
.bbaform-field-container.form-col-7 { grid-column: span 7; }
.bbaform-field-container.form-col-8 { grid-column: span 8; }
.bbaform-field-container.form-col-9 { grid-column: span 9; }
.bbaform-field-container.form-col-10 { grid-column: span 10; }
.bbaform-field-container.form-col-11 { grid-column: span 11; }
.bbaform-field-container.form-col-12 { grid-column: span 12; }

@media (max-width: 600px) {
	/* Responsive fallbacks for grid classes */
	.bbaform-field-container.form-col-1,
	.bbaform-field-container.form-col-2,
	.bbaform-field-container.form-col-3,
	.bbaform-field-container.form-col-4,
	.bbaform-field-container.form-col-5,
	.bbaform-field-container.form-col-6,
	.bbaform-field-container.form-col-7,
	.bbaform-field-container.form-col-8,
	.bbaform-field-container.form-col-9,
	.bbaform-field-container.form-col-10,
	.bbaform-field-container.form-col-11 {
		grid-column: span 12;
	}
}

/* Labels */
.bbaform-label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #334155;
	margin-bottom: 6px;
	line-height: 1.4;
}

.required-asterisk {
	color: #ef4444;
	margin-left: 2px;
}

/* Input Fields */
.bbaform-input-control input[type="text"],
.bbaform-input-control input[type="number"],
.bbaform-input-control input[type="email"],
.bbaform-input-control input[type="tel"],
.bbaform-input-control input[type="date"],
.bbaform-input-control textarea,
.bbaform-input-control select {
	width: 100%;
	padding: 10px 14px;
	font-size: 14px;
	line-height: 1.5;
	color: #0f172a;
	background-color: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	box-sizing: border-box;
}

.bbaform-input-control input:focus,
.bbaform-input-control textarea:focus,
.bbaform-input-control select:focus {
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
	outline: none;
}

.bbaform-input-control textarea {
	resize: vertical;
	min-height: 100px;
}

/* Choice styling (Radio & Checkboxes) */
.bbaform-options-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 4px 0;
}

.option-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: #475569;
	cursor: pointer;
	user-select: none;
	line-height: 1.4;
	font-weight: 500;
}

.option-label input[type="radio"],
.option-label input[type="checkbox"] {
	width: 16px;
	height: 16px;
	border: 1px solid #cbd5e1;
	cursor: pointer;
	margin: 0;
}

.option-label input[type="radio"] {
	border-radius: 50%;
}

/* File Upload Field */
.bbaform-file-upload-wrap {
	display: flex;
	align-items: center;
	width: 100%;
}

.bbaform-file-upload-wrap input[type="file"] {
	width: 100%;
	font-size: 14px;
	color: #475569;
}

.bbaform-file-upload-wrap input[type="file"]::file-selector-button {
	background-color: #f1f5f9;
	border: 1px solid #cbd5e1;
	color: #334155;
	padding: 8px 16px;
	border-radius: 6px;
	cursor: pointer;
	font-weight: 500;
	margin-right: 12px;
	transition: background-color 0.2s ease;
}

.bbaform-file-upload-wrap input[type="file"]::file-selector-button:hover {
	background-color: #e2e8f0;
}

/* Field Description */
.bbaform-field-description {
	font-size: 12px;
	color: #64748b;
	margin-top: 5px;
	margin-bottom: 0;
	line-height: 1.4;
}

/* Submit Section */
.bbaform-submit-container {
	grid-column: span 12;
	margin-top: 25px;
}

.bbaform-submit-btn {
	background-color: #3b82f6;
	color: #ffffff;
	border: none;
	padding: 12px 24px;
	font-size: 15px;
	font-weight: 600;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.1s ease;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2), 0 2px 4px -1px rgba(59, 130, 246, 0.1);
}

.bbaform-submit-btn:hover {
	background-color: #2563eb;
}

.bbaform-submit-btn:active {
	transform: scale(0.98);
}

.bbaform-submit-btn:disabled {
	background-color: #94a3b8;
	cursor: not-allowed;
	box-shadow: none;
}

/* Spinner */
.btn-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #ffffff;
	animation: spin-btn 0.8s linear infinite;
}

@keyframes spin-btn {
	to { transform: rotate(360deg); }
}

/* ==========================================================================
   ALERTS AND VALIDATION ERRORS
   ========================================================================== */

/* Error highlights */
.bbaform-field-container.has-error input[type="text"],
.bbaform-field-container.has-error input[type="number"],
.bbaform-field-container.has-error input[type="email"],
.bbaform-field-container.has-error input[type="tel"],
.bbaform-field-container.has-error input[type="date"],
.bbaform-field-container.has-error textarea,
.bbaform-field-container.has-error select {
	border-color: #ef4444;
	background-color: #fef2f2;
}

.bbaform-field-container.has-error input:focus,
.bbaform-field-container.has-error textarea:focus,
.bbaform-field-container.has-error select:focus {
	box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.bbaform-field-error-msg {
	color: #ef4444;
	font-size: 12px;
	font-weight: 500;
	margin-top: 6px;
	display: flex;
	align-items: center;
	gap: 4px;
}

/* Notice box layout */
.bbaform-success-box,
.bbaform-error-box {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 16px;
	border-radius: 8px;
	margin-bottom: 25px;
	font-size: 14px;
	line-height: 1.5;
}

.bbaform-success-box {
	background-color: #ecfdf5;
	border: 1px solid #a7f3d0;
	color: #065f46;
}

.bbaform-success-box .dashicons {
	color: #10b981;
	font-size: 20px;
	width: 20px;
	height: 20px;
}

.bbaform-error-box {
	background-color: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

.bbaform-error-box .dashicons {
	color: #ef4444;
	font-size: 20px;
	width: 20px;
	height: 20px;
}

.message-content {
	flex: 1;
}

/* ==========================================================================
   COLUMNS LAYOUT STYLING (FRONTEND)
   ========================================================================== */

.bbaform-row {
	grid-column: span 12;
	display: flex;
	gap: 20px;
	width: 100%;
	box-sizing: border-box;
	margin-bottom: 5px;
}

.bbaform-column {
	display: flex;
	flex-direction: column;
	gap: 15px;
	box-sizing: border-box;
}

/* Layout widths */
.layout-50-50 .bbaform-column {
	flex: 1;
	min-width: calc(50% - 10px);
}

.layout-33-33-33 .bbaform-column {
	flex: 1;
	min-width: calc(33.333% - 13.33px);
}

.layout-30-70 .bbaform-column:nth-child(1) {
	width: calc(30% - 6px);
	flex-grow: 0;
	flex-shrink: 0;
}
.layout-30-70 .bbaform-column:nth-child(2) {
	width: calc(70% - 14px);
	flex-grow: 0;
	flex-shrink: 0;
}

.layout-70-30 .bbaform-column:nth-child(1) {
	width: calc(70% - 14px);
	flex-grow: 0;
	flex-shrink: 0;
}
.layout-70-30 .bbaform-column:nth-child(2) {
	width: calc(30% - 6px);
	flex-grow: 0;
	flex-shrink: 0;
}

@media (max-width: 600px) {
	.bbaform-row {
		flex-direction: column;
		gap: 20px;
	}
	.layout-50-50 .bbaform-column,
	.layout-33-33-33 .bbaform-column,
	.layout-30-70 .bbaform-column:nth-child(1),
	.layout-30-70 .bbaform-column:nth-child(2),
	.layout-70-30 .bbaform-column:nth-child(1),
	.layout-70-30 .bbaform-column:nth-child(2) {
		width: 100% !important;
		min-width: 100% !important;
	}
}

/* Static Paragraph and Divider frontend styling */
.bbaform-paragraph-wrap {
	grid-column: span 12;
}

.bbaform-static-paragraph {
	font-size: 14px;
	line-height: 1.6;
	color: #475569;
	margin: 0 0 8px 0;
	white-space: pre-wrap;
}

.bbaform-divider-wrap {
	grid-column: span 12;
	width: 100%;
}

.bbaform-divider {
	border: 0;
	border-top: 1px solid #e2e8f0;
	margin: 20px 0;
	width: 100%;
}
