/* =============================================================================
   Social Comment Extension — Frontend Styles
   All rules scoped under .cspcr-* to avoid conflicts with any theme.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Comment footer wrapper
   ----------------------------------------------------------------------------- */

.cspcr-comment-footer {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid #e5e7eb;
	font-family: inherit;
}

/* -----------------------------------------------------------------------------
   Media gallery (rendered above reaction button)
   ----------------------------------------------------------------------------- */

.cspcr-comment-media {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
}

.cspcr-media-item {
	max-width: 320px;
	border-radius: 8px;
	overflow: hidden;
	background: #f3f4f6;
	border: 1px solid #e5e7eb;
	line-height: 0;
}

.cspcr-media-item img {
	display: block;
	max-width: 100%;
	height: auto;
	cursor: zoom-in;
	border-radius: 8px;
	transition: opacity 0.18s ease;
}

.cspcr-media-item img:hover { opacity: 0.88; }

.cspcr-media-item video {
	display: block;
	max-width: 100%;
	height: auto;
	border-radius: 8px;
}

/* -----------------------------------------------------------------------------
   Single cycling reaction button
   ----------------------------------------------------------------------------- */

.cspcr-reactions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

/* The one button */
.cspcr-react-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 18px;
	border: 1.5px solid #d1d5db;
	border-radius: 999px;
	background: transparent;
	color: #6b7280;
	font-size: 13px;
	font-family: inherit;
	font-weight: 500;
	line-height: 1.5;
	cursor: pointer;
	white-space: nowrap;
	user-select: none;
	transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.1s ease;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}

.cspcr-react-btn:hover {
	background: #f3f4f6;
	border-color: #9ca3af;
	color: #374151;
}

.cspcr-react-btn:focus-visible {
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.cspcr-react-btn:active { transform: scale(0.96); }

.cspcr-react-btn:disabled,
.cspcr-react-btn.cspcr-loading {
	opacity: 0.6;
	cursor: not-allowed;
	pointer-events: none;
}

/* Liked state — blue */
.cspcr-react-btn.cspcr-state-like {
	background: #eff6ff;
	border-color: #3b82f6;
	color: #1d4ed8;
	font-weight: 700;
}

/* Disliked state — rose */
.cspcr-react-btn.cspcr-state-dislike {
	background: #fff1f2;
	border-color: #f43f5e;
	color: #be123c;
	font-weight: 700;
}

.cspcr-btn-icon {
	font-size: 16px;
	line-height: 1;
	display: inline-block;
	transition: transform 0.15s ease;
}

.cspcr-react-btn:hover .cspcr-btn-icon { transform: scale(1.2); }

.cspcr-react-btn.cspcr-loading .cspcr-btn-icon {
	animation: cspcr-spin 0.65s linear infinite;
}

/* Count badges beside the button */
.cspcr-count-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.cspcr-like-badge,
.cspcr-dislike-badge {
	font-size: 13px;
	color: #6b7280;
	display: inline-flex;
	align-items: center;
	gap: 3px;
}

.cspcr-like-num,
.cspcr-dislike-num {
	font-weight: 600;
	min-width: 14px;
	display: inline-block;
	transition: transform 0.2s ease;
}

.cspcr-like-num.cspcr-pop,
.cspcr-dislike-num.cspcr-pop {
	animation: cspcr-count-pop 0.3s ease;
}

/* Inline error (e.g. login required) */
.cspcr-inline-error {
	font-size: 12px;
	color: #b91c1c;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 4px;
	padding: 3px 10px;
	animation: cspcr-fade-down 0.2s ease;
}

/* -----------------------------------------------------------------------------
   Upload widget — hidden elements rendered by PHP
   ----------------------------------------------------------------------------- */

.cspcr-upload-widget {
	margin-top: 10px;
}

/* -----------------------------------------------------------------------------
   Floating upload trigger icon (injected by JS into textarea wrapper)
   ----------------------------------------------------------------------------- */

/* JS wraps #comment with this */
.cspcr-textarea-wrap {
	position: relative;
	display: block;
}

.cspcr-textarea-wrap textarea {
	display: block;
	width: 100%;
	/* Reserve space so text never goes beneath the icon */
	padding-bottom: 40px !important;
	box-sizing: border-box;
}

/* The clickable icon button at bottom-right of the textarea */
.cspcr-upload-trigger {
	position: absolute;
	bottom: 10px;
	right: 10px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 1.5px solid #d1d5db;
	background: #ffffff;
	color: #6b7280;
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
	transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
	z-index: 5;
}

.cspcr-upload-trigger:hover {
	background: #f0f9ff;
	border-color: #6366f1;
	color: #4338ca;
	transform: scale(1.08);
	box-shadow: 0 3px 10px rgba(99, 102, 241, 0.20);
}

.cspcr-upload-trigger:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
}

/* Tooltip shown on hover */
.cspcr-upload-trigger::after {
	content: attr(aria-label);
	position: absolute;
	bottom: calc(100% + 6px);
	right: 0;
	background: #1f2937;
	color: #fff;
	font-size: 11px;
	white-space: nowrap;
	padding: 3px 8px;
	border-radius: 4px;
	pointer-events: none;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.cspcr-upload-trigger:hover::after {
	opacity: 1;
	transform: translateY(0);
}

/* Media required notice (shown below submit when validation fails) */
.cspcr-media-required-notice {
	display: block;
	margin-bottom: 10px;
	padding: 8px 14px;
	background: #fef2f2;
	color: #b91c1c;
	border: 1px solid #fecaca;
	border-radius: 6px;
	font-size: 13px;
	animation: cspcr-fade-down 0.2s ease;
}

/* -----------------------------------------------------------------------------
   Preview thumbnails
   ----------------------------------------------------------------------------- */

.cspcr-preview-area {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 12px;
	min-height: 0;
}

.cspcr-preview-item {
	position: relative;
	width: 90px;
	height: 90px;
	border-radius: 8px;
	overflow: hidden;
	background: #e5e7eb;
	border: 1.5px solid #d1d5db;
	flex-shrink: 0;
	animation: cspcr-scale-in 0.2s ease;
}

.cspcr-preview-item img,
.cspcr-preview-item video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cspcr-preview-remove {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: none;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.15s ease;
	z-index: 2;
}

.cspcr-preview-remove:hover { background: rgba(190, 18, 60, 0.85); }

.cspcr-progress {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: rgba(255, 255, 255, 0.35);
	z-index: 3;
}

.cspcr-progress-bar {
	height: 100%;
	background: #6366f1;
	transition: width 0.25s ease;
	width: 0%;
}

.cspcr-preview-item.cspcr-uploading::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.45);
	z-index: 1;
}

/* Upload area error */
.cspcr-upload-error {
	display: block;
	margin-top: 8px;
	padding: 6px 12px;
	background: #fef2f2;
	color: #b91c1c;
	border: 1px solid #fecaca;
	border-radius: 6px;
	font-size: 12px;
	animation: cspcr-fade-down 0.2s ease;
}

/* -----------------------------------------------------------------------------
   Lightbox
   ----------------------------------------------------------------------------- */

.cspcr-lightbox-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.92);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: zoom-out;
	animation: cspcr-fade-in 0.18s ease;
}

.cspcr-lightbox-img {
	max-width: min(92vw, 1200px);
	max-height: 90vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
	cursor: default;
	animation: cspcr-scale-in 0.2s ease;
}

.cspcr-lightbox-close {
	position: absolute;
	top: 18px;
	right: 22px;
	background: rgba(255, 255, 255, 0.12);
	border: 1.5px solid rgba(255, 255, 255, 0.25);
	color: #fff;
	font-size: 20px;
	line-height: 1;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}

.cspcr-lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

/* -----------------------------------------------------------------------------
   Keyframes
   ----------------------------------------------------------------------------- */

@keyframes cspcr-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes cspcr-fade-down {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0);    }
}

@keyframes cspcr-scale-in {
	from { opacity: 0; transform: scale(0.92); }
	to   { opacity: 1; transform: scale(1);    }
}

@keyframes cspcr-count-pop {
	0%   { transform: scale(1);    }
	45%  { transform: scale(1.45); }
	100% { transform: scale(1);    }
}

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

/* -----------------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------------- */

@media (max-width: 480px) {
	.cspcr-react-btn {
		padding: 5px 13px;
		font-size: 12px;
	}

	.cspcr-upload-trigger {
		width: 30px;
		height: 30px;
		font-size: 15px;
		bottom: 8px;
		right: 8px;
	}

	.cspcr-preview-item {
		width: 74px;
		height: 74px;
	}

	.cspcr-media-item { max-width: 100%; }
}
