/* Campaign Form – single column, clean layout */
.sos-campaign-form {
	padding: 0;
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
	color: inherit;
	direction: rtl;
}

.sos-campaign-form-edit {
	padding: 0;
	background: transparent;
	border-radius: 0;
	border: none;
	box-shadow: none;
}

.sos-campaign-form-wrapper {
	background: transparent;
	border-radius: 0;
	padding: 0;
	box-shadow: none;
	border: none;
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.sos-form-title {
	font-size: 1.75rem;
	font-weight: 600;
	color: inherit;
	margin-bottom: 1.5rem;
	text-align: right;
	letter-spacing: -0.01em;
}

/* Generic sections – card layout */
.sos-form-section {
	background: #ffffff;
	border-radius: 1rem;
	border: 1px solid rgba(15, 23, 42, 0.06);
	padding: 1.25rem 1.5rem;
}

@media (min-width: 768px) {
	.sos-form-section {
		padding: 1.5rem 1.75rem;
	}
}

/* Single column layout */
.sos-form-single-column {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.sos-form-column {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

/* Section: אודות המתרים – one row */
.sos-form-section-fundraiser {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.sos-form-section-title {
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0 0 0.25rem 0;
	text-align: right;
	color: inherit;
}

.sos-form-row-institution {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 1rem;
}

@media (max-width: 768px) {
	.sos-form-row-institution {
		grid-template-columns: 1fr;
	}
}

.sos-form-field {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.sos-form-field label {
	font-weight: 500;
	color: inherit;
	opacity: 0.9;
	font-size: 0.9375rem;
	text-align: right;
	display: flex;
	align-items: center;
	gap: 0.375rem;
}

.sos-form-field .required {
	color: #dc2626;
	font-size: 1em;
	font-weight: 600;
}

.sos-form-input,
.sos-form-textarea {
	width: 100%;
	padding: 0.75rem 1rem;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 6px;
	font-size: inherit;
	font-family: inherit;
	line-height: inherit;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	background: #fff;
	color: inherit;
}

.sos-form-input:hover,
.sos-form-textarea:hover {
	border-color: rgba(0, 0, 0, 0.25);
}

.sos-form-input:focus,
.sos-form-textarea:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sos-form-textarea {
	resize: vertical;
	min-height: 100px;
}

/* Banners – whole dropzone clickable; button is a span for widget styling */
.sos-file-upload-area {
	margin-top: 0.25rem;
}

.sos-file-upload-dropzone {
	border: 1px dashed rgba(0, 0, 0, 0.2);
	border-radius: 8px;
	padding: 2rem;
	text-align: center;
	background: rgba(0, 0, 0, 0.02);
	position: relative;
	transition: border-color 0.15s ease, background-color 0.15s ease;
	cursor: pointer;
	outline: none;
}

.sos-file-upload-dropzone:hover {
	border-color: rgba(0, 0, 0, 0.3);
	background: rgba(0, 0, 0, 0.04);
}

.sos-file-upload-dropzone:focus {
	border-color: #2563eb;
}

.sos-file-upload-dropzone.dragover {
	border-color: #2563eb;
	background: rgba(37, 99, 235, 0.06);
}

.sos-file-upload-text {
	margin: 0 0 0.5rem 0;
	color: inherit;
	opacity: 0.85;
	font-size: 0.9375rem;
}

.sos-file-upload-button {
	display: inline-block;
	padding: 0.35em 0.75em;
	border-radius: 4px;
	font-weight: 500;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.sos-file-upload-info {
	margin: 0.75rem 0 0 0;
	font-size: 0.8125rem;
	opacity: 0.75;
	line-height: 1.6;
}

.sos-file-count {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	padding: 0.25rem 0.75rem;
	border-radius: 4px;
	font-size: 0.75rem;
	font-weight: 600;
}

.sos-file-preview {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 1rem;
	margin-top: 1rem;
}

.sos-file-preview-item {
	position: relative;
	border-radius: 6px;
	overflow: hidden;
	background: #f3f4f6;
	border: 1px solid rgba(0, 0, 0, 0.08);
}

.sos-file-preview-item img {
	width: 100%;
	height: 140px;
	object-fit: cover;
	display: block;
}

.sos-file-preview-item .sos-file-remove {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	background: rgba(220, 38, 38, 0.9);
	color: #fff;
	border: none;
	border-radius: 4px;
	width: 24px;
	height: 24px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.15s ease;
}

.sos-file-preview-item .sos-file-remove svg {
	width: 14px;
	height: 14px;
}

.sos-file-preview-item .sos-file-remove:hover {
	background: rgba(185, 28, 28, 0.95);
}

/* Packages */
.sos-packages-repeater {
	margin-top: 0.25rem;
}

.sos-packages-list {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1.25rem;
	margin-bottom: 1rem;
}

.sos-package-item {
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	padding: 1.25rem;
	background: rgba(0, 0, 0, 0.02);
	position: relative;
}

@media (max-width: 1024px) {
	.sos-packages-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.sos-packages-list {
		grid-template-columns: 1fr;
	}
}

.sos-package-item-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1rem;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sos-package-item-title {
	font-weight: 600;
	color: inherit;
	font-size: 1rem;
}

/* Remove package – X only, text for screen reader */
.sos-package-remove {
	background: transparent;
	color: currentColor;
	opacity: 0.6;
	border: 1px solid currentColor;
	border-radius: 4px;
	width: 32px;
	height: 32px;
	padding: 0;
	cursor: pointer;
	font-size: 1.25rem;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.15s ease, background-color 0.15s ease;
}

.sos-package-remove .sos-package-remove-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.sos-package-remove:hover {
	opacity: 1;
	background: rgba(220, 38, 38, 0.1);
	color: #dc2626;
	border-color: #dc2626;
}

.sos-package-remove svg {
	flex-shrink: 0;
	width: 14px;
	height: 14px;
}

.sos-package-fields {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

/* Package image – DnD zone like banners, preview inside */
.sos-package-image-field {
	position: relative;
}

.sos-package-image-dropzone {
	border: 1px dashed rgba(0, 0, 0, 0.2);
	border-radius: 8px;
	min-height: 160px;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	cursor: pointer;
	background: rgba(0, 0, 0, 0.02);
	transition: border-color 0.15s ease, background-color 0.15s ease;
	overflow: hidden;
}

.sos-package-image-dropzone:hover {
	border-color: rgba(0, 0, 0, 0.3);
	background: rgba(0, 0, 0, 0.04);
}

.sos-package-image-dropzone.dragover {
	border-color: #2563eb;
	background: rgba(37, 99, 235, 0.06);
}

.sos-package-image-dropzone.has-image {
	min-height: 180px;
}

.sos-package-image-dropzone .sos-package-image-placeholder {
	padding: 1rem;
	text-align: center;
	font-size: 0.875rem;
	opacity: 0.8;
}

.sos-package-image-dropzone .sos-package-image-preview {
	width: 100%;
	height: 100%;
	min-height: 180px;
	object-fit: cover;
	display: block;
	position: absolute;
	inset: 0;
}

.sos-package-image-input {
	position: absolute;
	width: 0;
	height: 0;
	opacity: 0;
	pointer-events: none;
}

.sos-campaign-form .sos-add-package-button {
	width: 100%;
	padding: 0.75rem 1.5rem;
	background: #2563eb;
	color: #fff;
	border: none;
	border-radius: 999px;
	font-size: inherit;
	font-weight: 500;
	cursor: pointer;
	transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
	margin-top: 0.25rem;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.sos-campaign-form .sos-add-package-button:hover {
	background: #1d4ed8;
	box-shadow: 0 10px 24px rgba(37, 99, 235, 0.3);
}

.sos-campaign-form .sos-add-package-button:active {
	transform: translateY(1px);
	box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.sos-campaign-form .sos-add-package-button svg {
	flex-shrink: 0;
}

/* Rich text editor – WordPress-style */
.sos-rich-text-editor {
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	font-family: inherit;
}

.sos-rich-text-editor:focus-within {
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sos-editor-toolbar {
	display: flex;
	gap: 0.25rem;
	padding: 0.5rem 0.75rem;
	background: #f8f9fa;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	flex-wrap: wrap;
}

.sos-editor-btn {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 4px;
	padding: 0.5rem 0.75rem;
	cursor: pointer;
	font-size: 0.875rem;
	transition: background-color 0.15s ease, border-color 0.15s ease;
	color: inherit;
	min-width: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sos-editor-btn:hover {
	background: #f1f3f4;
	border-color: rgba(0, 0, 0, 0.2);
}

.sos-editor-btn.active {
	background: #2563eb;
	color: #fff;
	border-color: #2563eb;
}

.sos-editor-btn svg {
	width: 16px;
	height: 16px;
}

.sos-editor-content {
	min-height: 220px;
	padding: 1rem 1.25rem;
	font-size: inherit;
	line-height: 1.6;
	color: inherit;
	outline: none;
	direction: rtl;
	text-align: right;
	font-family: inherit;
}

.sos-editor-content:empty:before {
	content: attr(data-placeholder);
	opacity: 0.5;
	font-style: italic;
}

.sos-editor-content ul,
.sos-editor-content ol {
	margin: 0.5rem 0;
	padding-right: 2rem;
	direction: rtl;
}

.sos-editor-content a {
	color: #2563eb;
	text-decoration: underline;
}

.sos-editor-content a:hover {
	color: #1d4ed8;
}

/* Submit */
.sos-form-submit {
	margin-top: 1.5rem;
	text-align: center;
}

.sos-campaign-form .sos-submit-button {
	background: #2563eb;
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 0.875rem 2.25rem;
	font-size: 1rem;
	font-weight: 500;
	cursor: pointer;
	transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
	min-width: 200px;
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	box-shadow: 0 10px 25px rgba(37, 99, 235, 0.28);
}

.sos-campaign-form .sos-submit-button:hover:not(:disabled) {
	background: #1d4ed8;
	box-shadow: 0 12px 30px rgba(37, 99, 235, 0.32);
}

.sos-campaign-form .sos-submit-button:active:not(:disabled) {
	background: #1e40af;
	transform: translateY(1px);
	box-shadow: 0 8px 20px rgba(30, 64, 175, 0.3);
}

.sos-campaign-form .sos-submit-button:disabled {
	opacity: 0.7;
	cursor: not-allowed;
	box-shadow: none;
}

.sos-submit-button-text {
	display: inline-block;
}

.sos-submit-button-loader {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
}

.sos-spinner {
	animation: sos-spin 0.8s linear infinite;
}

@keyframes sos-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* Messages */
.sos-form-messages {
	margin-top: 1.25rem;
}

.sos-form-message {
	padding: 1rem 1.25rem;
	border-radius: 6px;
	margin-bottom: 0.75rem;
	font-weight: 500;
	font-size: 0.9375rem;
}

.sos-form-message.success {
	background: #d1fae5;
	color: #065f46;
	border: 1px solid #10b981;
}

.sos-form-message.error {
	background: #fee2e2;
	color: #991b1b;
	border: 1px solid #ef4444;
}

/* Standalone messages for the edit page (no campaign_id / no permission, etc.) */
.sos-campaign-edit-message {
	max-width: 640px;
	margin: 2rem auto;
	padding: 1rem 1.25rem;
	border-radius: 6px;
	font-weight: 500;
	font-size: 0.9375rem;
	text-align: center;
}

.sos-campaign-edit-error {
	background: #fee2e2;
	color: #991b1b;
	border: 1px solid #ef4444;
}

.sos-form-loading {
	opacity: 0.6;
	pointer-events: none;
	position: relative;
}

.sos-form-loading:after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 32px;
	height: 32px;
	border: 3px solid rgba(37, 99, 235, 0.2);
	border-top-color: #2563eb;
	border-radius: 50%;
	animation: sos-spin 0.6s linear infinite;
	z-index: 1000;
}

.sos-form-input::placeholder,
.sos-form-textarea::placeholder {
	opacity: 0.6;
}

/* Number inputs – hide arrows for a cleaner look (campaign goal & package amounts) */
.sos-form-input[type="number"]::-webkit-outer-spin-button,
.sos-form-input[type="number"]::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.sos-form-input[type="number"] {
	appearance: textfield;
	-moz-appearance: textfield;
}

/* RTL */
.rtl .sos-form-field label,
.rtl .sos-form-title {
	text-align: right;
}

.rtl .sos-editor-content ul,
.rtl .sos-editor-content ol {
	padding-right: 2rem;
	padding-left: 0;
}

@media (max-width: 768px) {
	.sos-form-title {
		font-size: 1.5rem;
		margin-bottom: 1.25rem;
	}

	.sos-campaign-form-edit {
		padding: 1.5rem 1.25rem 2rem;
		border-radius: 1.25rem;
	}

	.sos-form-single-column {
		gap: 1.25rem;
	}

	.sos-submit-button {
		min-width: 100%;
	}

	.sos-file-preview {
		grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
		gap: 0.75rem;
	}

	.sos-file-upload-dropzone {
		padding: 1.5rem;
	}
}
