/**
 * Comment Image Uploader - Frontend Styles
 */

/* Upload Container */
.ciu-upload-container {
	margin: 20px 0;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ciu-upload-wrapper {
	display: flex;
	flex-direction: column;
	gap: 15px;
}

/* Drag Drop Zone */
.ciu-upload-drop-zone {
	border: 2px dashed #0073aa;
	border-radius: 8px;
	padding: 40px 20px;
	text-align: center;
	background: #f5f9fc;
	cursor: pointer;
	transition: all 0.3s ease;
	position: relative;
}

.ciu-upload-drop-zone:hover {
	border-color: #005a87;
	background: #e8f3f9;
}

.ciu-upload-drop-zone.ciu-drag-over {
	border-color: #0073aa;
	background: #e8f3f9;
	box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.ciu-upload-icon {
	width: 48px;
	height: 48px;
	color: #0073aa;
	margin: 0 auto 10px;
	display: block;
	opacity: 0.7;
	transition: opacity 0.3s;
}

.ciu-upload-drop-zone:hover .ciu-upload-icon {
	opacity: 1;
}

.ciu-drop-text {
	margin: 0;
	color: #666;
	font-size: 14px;
	font-weight: 500;
}

/* Button Group */
.ciu-button-group {
	display: flex;
	gap: 10px;
	justify-content: center;
	align-items: center;
}

.ciu-select-button {
	background: #0073aa;
	color: white;
	border: none;
	border-radius: 6px;
	padding: 10px 20px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	transition: all 0.2s ease;
}

.ciu-select-button:hover {
	background: #005a87;
	box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.ciu-select-button:active {
	transform: scale(0.98);
}

.ciu-button-icon {
	width: 18px;
	height: 18px;
	stroke: currentColor;
	stroke-width: 2;
	fill: none;
}

/* Preview Container */
.ciu-preview-container {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	gap: 12px;
	margin: 15px 0;
}

.ciu-preview-item {
	position: relative;
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
	border: 1px solid #ddd;
	transition: all 0.3s ease;
}

.ciu-preview-image {
	position: relative;
	width: 100%;
	padding-bottom: 100%;
	overflow: hidden;
	background: #f0f0f0;
}

.ciu-preview-image img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: opacity 0.3s;
}

.ciu-preview-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s;
}

.ciu-preview-item.ciu-uploading .ciu-preview-overlay {
	opacity: 1;
}

.ciu-preview-item.ciu-success .ciu-preview-overlay {
	opacity: 1;
}

.ciu-preview-item.ciu-error .ciu-preview-overlay {
	opacity: 1;
	background: rgba(220, 0, 0, 0.7);
}

/* Spinner */
.ciu-spinner {
	width: 30px;
	height: 30px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-top-color: white;
	border-radius: 50%;
	animation: ciu-spin 0.8s linear infinite;
}

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

/* Check mark */
.ciu-check-mark {
	font-size: 32px;
	color: #4caf50;
	font-weight: bold;
	animation: ciu-check-pop 0.3s ease;
}

@keyframes ciu-check-pop {
	0% { transform: scale(0); }
	100% { transform: scale(1); }
}

/* Error message */
.ciu-error-msg {
	color: white;
	font-size: 12px;
	text-align: center;
	padding: 5px;
	white-space: normal;
	line-height: 1.4;
}

/* Remove button */
.ciu-preview-remove {
	position: absolute;
	top: 2px;
	right: 2px;
	background: rgba(0, 0, 0, 0.5);
	border: none;
	color: white;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 20px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.2s, background 0.2s;
	line-height: 1;
}

.ciu-preview-item:hover .ciu-preview-remove {
	opacity: 1;
}

.ciu-preview-remove:hover {
	background: rgba(220, 0, 0, 0.8);
}

/* Info text */
.ciu-info {
	margin: 10px 0 0;
	font-size: 12px;
	color: #666;
	text-align: center;
}

/* Error message box */
.ciu-error-message {
	background: #f8d7da;
	border: 1px solid #f5c6cb;
	color: #721c24;
	padding: 12px;
	border-radius: 4px;
	margin-bottom: 15px;
	display: none;
	font-size: 14px;
}

/* Gallery Styles */
.ciu-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 15px;
	margin: 15px 0;
	padding: 10px 0;
}

.ciu-gallery-item {
	position: relative;
	border-radius: 6px;
	overflow: hidden;
	background: #f5f5f5;
	border: 1px solid #ddd;
	transition: transform 0.2s, box-shadow 0.2s;
}

.ciu-gallery-item:hover {
	transform: translateY(-3px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ciu-gallery-link {
	display: block;
	position: relative;
	padding-bottom: 100%;
	overflow: hidden;
	background: #f0f0f0;
}

.ciu-gallery-link img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: opacity 0.3s;
}

.ciu-gallery-item:hover .ciu-gallery-link img {
	opacity: 0.8;
}

/* Modal/Lightbox */
.ciu-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.95);
	z-index: 9999;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.ciu-modal.ciu-modal-active {
	opacity: 1;
}

.ciu-modal-content {
	position: relative;
	width: 90%;
	height: 90%;
	max-width: 90vw;
	max-height: 90vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.8);
	border-radius: 8px;
}

.ciu-modal-body {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-radius: 4px;
	background: #000;
}

.ciu-modal-image {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transition: opacity 0.3s;
}

/* Modal Close Button */
.ciu-modal-close {
	position: absolute;
	top: 15px;
	right: 15px;
	background: rgba(255, 255, 255, 0.3);
	border: none;
	color: white;
	width: 40px;
	height: 40px;
	font-size: 28px;
	cursor: pointer;
	border-radius: 50%;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	z-index: 10000;
	line-height: 1;
}

.ciu-modal-close:hover {
	background: rgba(255, 255, 255, 0.5);
	transform: scale(1.1);
}

/* Modal Navigation Buttons */
.ciu-modal-prev,
.ciu-modal-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.3);
	border: none;
	color: white;
	width: 45px;
	height: 45px;
	font-size: 28px;
	cursor: pointer;
	border-radius: 4px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	z-index: 10000;
	line-height: 1;
}

.ciu-modal-prev {
	left: 15px;
}

.ciu-modal-next {
	right: 15px;
}

.ciu-modal-prev:hover,
.ciu-modal-next:hover {
	background: rgba(255, 255, 255, 0.5);
	transform: translateY(-50%) scale(1.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
	.ciu-upload-drop-zone {
		padding: 30px 15px;
	}

	.ciu-button-group {
		flex-direction: column;
	}

	.ciu-select-button {
		width: 100%;
		justify-content: center;
	}

	.ciu-preview-container {
		grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
	}

	.ciu-gallery {
		grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
		gap: 10px;
	}

	.ciu-modal-prev,
	.ciu-modal-next {
		width: 40px;
		height: 40px;
		font-size: 24px;
	}

	.ciu-modal-close {
		width: 36px;
		height: 36px;
		font-size: 24px;
		top: 10px;
		right: 10px;
	}

	.ciu-modal-content {
		width: 95%;
		height: 95%;
		max-width: 95vw;
		max-height: 95vh;
	}
}

@media (max-width: 480px) {
	.ciu-upload-container {
		padding: 15px;
		margin: 15px 0;
	}

	.ciu-preview-container {
		grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
		gap: 10px;
	}

	.ciu-gallery {
		grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	}

	.ciu-upload-icon {
		width: 36px;
		height: 36px;
	}

	.ciu-drop-text {
		font-size: 13px;
	}

	.ciu-select-button {
		font-size: 13px;
		padding: 8px 16px;
	}

	.ciu-modal-prev,
	.ciu-modal-next {
		display: none;
	}
}
