/**
 * Child Story Photo Upload - Frontend Styles
 * RTL & Arabic Optimized Modern Compact Design
 */

.cspu-card {
	direction: rtl;
	text-align: start;
	font-family: "IBM Plex Sans Arabic", "Tajawal", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	background: #ffffff;
	border: 1px solid #e7e5df;
	border-radius: 14px;
	padding: 14px 16px;
	box-shadow: 0 3px 12px rgba(104, 114, 74, 0.06);
	margin-bottom: 20px;
	width: 100%;
	max-width: 540px;
	box-sizing: border-box;
	transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.cspu-card:hover,
.cspu-card:focus-within {
	border-color: #68724a;
	box-shadow: 0 4px 18px rgba(104, 114, 74, 0.12);
}

/* Header */
.cspu-card-header {
	margin-bottom: 12px;
	border-bottom: 1px solid #f1efe9;
	padding-bottom: 8px;
}

.cspu-header-title-wrap {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.cspu-header-icon {
	font-size: 1.15rem;
	line-height: 1;
}

.cspu-header-title {
	margin: 0;
	font-size: 0.98rem;
	font-weight: 700;
	color: #12265a;
	line-height: 1.4;
}

.cspu-badge-required {
	background: #fff0f0;
	color: #d63031;
	font-size: 0.72rem;
	font-weight: 600;
	padding: 2px 7px;
	border-radius: 6px;
	border: 1px solid #ffcccc;
	margin-inline-start: 4px;
}

.cspu-header-subtitle {
	margin: 3px 0 0;
	font-size: 0.8rem;
	color: #70747f;
	line-height: 1.4;
}

/* Body: Horizontal layout */
.cspu-card-body {
	display: flex;
	align-items: flex-start;
	gap: 14px;
}

/* Right Column (RTL): Preview Box */
.cspu-preview-col {
	flex-shrink: 0;
	width: 105px;
	height: 105px;
	cursor: pointer;
	border-radius: 12px;
	outline: none;
	position: relative;
}

.cspu-preview-col:focus-visible .cspu-preview-box {
	outline: 2px solid #68724a;
	outline-offset: 2px;
}

.cspu-preview-box {
	width: 100%;
	height: 100%;
	border-radius: 12px;
	position: relative;
	overflow: hidden;
	background: #f7f6f2;
	border: 1.5px dashed #d5d3cb;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cspu-preview-col:hover .cspu-preview-box {
	background: #f1efe8;
	border-color: #68724a;
}

.cspu-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 6px;
	text-align: center;
}

.cspu-ph-icon {
	font-size: 1.6rem;
	line-height: 1;
	opacity: 0.7;
}

.cspu-ph-text {
	font-size: 0.65rem;
	color: #888b94;
	font-weight: 500;
	line-height: 1.25;
}

.cspu-thumb-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 10px;
}

/* Loading Overlay */
.cspu-loading-overlay {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.88);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	z-index: 5;
}

.cspu-spinner {
	width: 22px;
	height: 22px;
	border: 2.5px solid #e2e0d8;
	border-top-color: #68724a;
	border-radius: 50%;
	animation: cspu-spin 0.8s linear infinite;
}

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

.cspu-loading-text {
	font-size: 0.65rem;
	color: #68724a;
	font-weight: 600;
}

/* Remove button badge */
.cspu-btn-remove-badge {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 22px;
	height: 22px;
	background: #d63031;
	color: #ffffff;
	border: 1.5px solid #ffffff;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
	transition: background 0.2s, transform 0.15s;
	z-index: 6;
}

.cspu-btn-remove-badge:hover {
	background: #b71c1c;
	transform: scale(1.1);
}

/* Left Column (RTL): Details & Guidelines */
.cspu-details-col {
	flex-grow: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cspu-action-row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

/* Choose Photo Button */
.cspu-btn-choose {
	background-color: #68724a;
	color: #ffffff !important;
	border: none;
	border-radius: 8px;
	padding: 6px 14px;
	font-size: 0.82rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	transition: background-color 0.2s ease, transform 0.15s ease;
	line-height: 1.4;
	box-shadow: 0 2px 6px rgba(104, 114, 74, 0.25);
}

.cspu-btn-choose:hover {
	background-color: #57603c;
	transform: translateY(-1px);
}

.cspu-btn-choose:active {
	transform: translateY(0);
}

.cspu-btn-choose.cspu-state-change {
	background-color: #f1efe8;
	color: #12265a !important;
	border: 1px solid #d5d3cb;
	box-shadow: none;
}

.cspu-btn-choose.cspu-state-change:hover {
	background-color: #e5e2d8;
	border-color: #68724a;
}

.cspu-btn-delete-text {
	background: transparent;
	border: none;
	color: #d63031;
	font-size: 0.78rem;
	font-weight: 600;
	cursor: pointer;
	padding: 4px 6px;
	text-decoration: underline;
	transition: color 0.2s;
	font-family: inherit;
}

.cspu-btn-delete-text:hover {
	color: #b71c1c;
}

.cspu-success-badge {
	color: #27ae60;
	font-size: 0.76rem;
	font-weight: 700;
}

/* File info */
.cspu-file-info {
	font-size: 0.72rem;
	color: #555963;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	direction: ltr;
	text-align: right;
}

/* Guidelines */
.cspu-guidelines {
	background: #fbfbf9;
	border: 1px solid #eeece5;
	border-radius: 8px;
	padding: 6px 9px;
}

.cspu-guide-title {
	font-size: 0.72rem;
	font-weight: 700;
	color: #12265a;
	margin-bottom: 2px;
}

.cspu-guide-items {
	display: flex;
	flex-wrap: wrap;
	gap: 3px 10px;
	font-size: 0.68rem;
	color: #636771;
	line-height: 1.3;
}

.cspu-check {
	color: #68724a;
	font-weight: bold;
}

/* Meta hint */
.cspu-meta-hint {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 0.68rem;
	color: #92959e;
	margin-top: 1px;
}

.cspu-dot {
	font-weight: bold;
}

/* Alert Notification */
.cspu-alert {
	margin-top: 10px;
	padding: 7px 12px;
	border-radius: 7px;
	font-size: 0.78rem;
	font-weight: 500;
	line-height: 1.4;
	animation: cspu-fadeIn 0.25s ease-out;
}

@keyframes cspu-fadeIn {
	from { opacity: 0; transform: translateY(-4px); }
	to { opacity: 1; transform: translateY(0); }
}

.cspu-alert.cspu-alert-error {
	background: #fff2f2;
	border: 1px solid #ffcdd2;
	color: #c62828;
}

.cspu-alert.cspu-alert-warning {
	background: #fffbf0;
	border: 1px solid #ffe082;
	color: #b78103;
}

.cspu-alert.cspu-alert-success {
	background: #f0f9f4;
	border: 1px solid #c8e6c9;
	color: #2e7d32;
}

/* Highlight Pulse on Add to Cart Validation Failure */
.cspu-card.cspu-card-highlight {
	border-color: #d63031 !important;
	box-shadow: 0 0 0 3px rgba(214, 48, 49, 0.2), 0 4px 18px rgba(214, 48, 49, 0.15) !important;
	animation: cspu-shake 0.4s ease-in-out;
}

@keyframes cspu-shake {
	0%, 100% { transform: translateX(0); }
	20%, 60% { transform: translateX(-4px); }
	40%, 80% { transform: translateX(4px); }
}

/* Mobile Responsive */
@media (max-width: 480px) {
	.cspu-card {
		padding: 12px;
	}

	.cspu-card-body {
		gap: 10px;
	}

	.cspu-preview-col {
		width: 90px;
		height: 90px;
	}

	.cspu-btn-choose {
		padding: 5px 10px;
		font-size: 0.78rem;
	}

	.cspu-guide-items {
		flex-direction: column;
		gap: 2px;
	}
}
