/**
 * Visual Builder Styles
 */


$purple: #a46497;
$green: #61ce70;
$red: #d20000;

/* Overlay Container */
.giveasap-builder-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: #f0f0f1;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}
body.giveasap-builder-open {
	overflow: hidden;
}
body.giveasap-builder-open .media-modal-backdrop {
	z-index: 1000000 !important;
}

body.giveasap-builder-open .media-modal {
	z-index: 1000001 !important;
}

body.giveasap-builder-media-open .giveasap-builder-overlay {
	z-index: 900000;
}

/* Header */
.giveasap-builder-header {
	background: #fff;
	color: #1e1e1e;
	padding: 15px 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1px solid #2c2c2c;
	flex-shrink: 0;
	height: 60px;
	box-sizing: border-box;
}

.giveasap-builder-header-notice {
	padding: 5px 10px;
	font-size: .875em;
	font-weight: 600;
	align-self: center;
}

.giveasap-builder-header h2 {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	color: #fff;
}

.giveasap-builder-actions {
	display: flex;
	gap: 10px;
}

.giveasap-builder-actions .button {
	font-size: 14px;
	padding: 8px 16px;
	height: auto;
	line-height: 1.4;
}

/* Content Area */
.giveasap-builder-content {
	display: flex;
	flex: 1;
	overflow: hidden;
}

/* Sidebar */
.giveasap-builder-sidebar {
	width: 240px;
	background: #fff;
	border-right: 1px solid #c3c4c7;
	overflow-y: auto;
	padding: 20px;
	flex-shrink: 0;

	.sidebar-sections {
		margin: 0;

		.sg-metabox {

			margin-bottom: 30px;

			&.active {
				a {
					font-weight: 600;
					color: #000;
				}
			}

			a {
				display: block;
				text-decoration: none;
				color: #666;
				font-size: 1.25em;
			}

			.sg-metabox-icon {
				color: $purple;
				margin-right: 10px;
			}
		}
	}
}

.giveasap-builder-sidebar h3 {
	font-size: 14px;
	font-weight: 600;
	margin: 25px 0 15px;
	padding-bottom: 10px;
	border-bottom: 1px solid #c3c4c7;
	color: #1d2327;
}

.giveasap-builder-sidebar h3:first-child {
	margin-top: 0;
}

.giveasap-builder-sidebar-options {
	max-width: 500px;
	width: 30%;
	padding: 20px;
	overflow: auto;
}

/* Field Groups */
.giveasap-field-group {
	margin-bottom: 20px;
}

.giveasap-field-group label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
	font-size: 13px;
	color: #1d2327;
}

.giveasap-field-group input[type="text"],
.giveasap-field-group input[type="url"],
.giveasap-field-group input[type="number"],
.giveasap-field-group select {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	font-size: 13px;
	line-height: 1.4;
	box-sizing: border-box;
}

.giveasap-field-group input[type="text"]:focus,
.giveasap-field-group input[type="url"]:focus,
.giveasap-field-group input[type="number"]:focus,
.giveasap-field-group select:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: none;
}

/* Color Picker */
.giveasap-field-group .wp-picker-container {
	width: 100%;
}

.giveasap-field-group .wp-picker-container .wp-color-result {
	width: 100%;
	margin: 0;
}

/* Media Uploader */
.giveasap-media-uploader {
	margin-top: 5px;
}

.giveasap-media-preview {
	min-height: 80px;
	background: #f0f0f1;
	border: 1px dashed #c3c4c7;
	border-radius: 4px;
	margin-bottom: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.giveasap-media-preview img {
	max-width: 100%;
	max-height: 150px;
	display: block;
}

.giveasap-media-uploader .button {
	margin-right: 8px;
}

.giveasap-media-uploader .button.hidden {
	display: none;
}

/* Preview Area */
.giveasap-builder-preview {
	flex: 1;
	display: flex;
	flex-direction: column;
	background: #f0f0f1;
	padding: 20px;
}

.giveasap-builder-preview-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 15px;
	flex-shrink: 0;
}

.giveasap-builder-preview-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #1d2327;
}

.giveasap-preview-tabs {
	display: inline-flex;
	margin-left: 15px;
	gap: 0;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	overflow: hidden;
}

.giveasap-preview-tab {
	padding: 4px 12px;
	border: none;
	background: #f0f0f1;
	cursor: pointer;
	font-size: 13px;
	line-height: 1.5;
	color: #50575e;
	border-right: 1px solid #c3c4c7;

	&:last-child {
		border-right: none;
	}

	&.active {
		background: #2271b1;
		color: #fff;
	}

	&:hover:not(.active) {
		background: #e0e0e0;
	}
}

.giveasap-preview-loading {
	color: #646970;
	font-size: 13px;
	display: inline;
	align-items: center;
	gap: 8px;
}

.giveasap-preview-loading .spinner {
	margin: 0;
	float: none;
}

/* Iframe Wrapper */
.giveasap-builder-preview-frame-wrapper {
	flex: 1;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	overflow: hidden;
	position: relative;
}

.giveasap-builder-preview-frame-wrapper iframe {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
}

/* Metabox Button Styles */
#giveasap_visual_builder_button .inside {
	padding: 12px;
}

#giveasap-open-visual-builder {
	width: 100%;
	text-align: center;
	margin-bottom: 10px;
}

#giveasap-open-visual-builder .dashicons {
	margin-right: 8px;
	vertical-align: middle;
	line-height: 1;
}

#giveasap_visual_builder_button .description {
	margin: 0;
	font-size: 12px;
	color: #646970;
}

/* Responsive Adjustments */
@media screen and (max-width: 782px) {
	.giveasap-builder-sidebar {
		width: 280px;
	}
}

@media screen and (max-width: 600px) {
	.giveasap-builder-content {
		flex-direction: column;
	}

	.giveasap-builder-sidebar {
		width: 100%;
		height: 40%;
		border-right: none;
		border-bottom: 1px solid #c3c4c7;
	}

	.giveasap-builder-header {
		flex-direction: column;
		gap: 10px;
		text-align: center;
	}
}

/* Animations */
@keyframes giveasap-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.giveasap-builder-overlay {
	animation: giveasap-fade-in 0.2s ease-out;
}
