/**
 * CR Feedback Form — styl rozszerzonego formularza dla 1-3★.
 * Mobile-first (base = 375px). Media queries dla większych ekranów.
 */

/* ==================================================================
   CONTAINER — slide animation
   ================================================================== */

.cr-feedback-extended {
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	margin: 0;
	transition: max-height 300ms cubic-bezier(0.4, 0, 0.2, 1),
	            opacity 200ms ease,
	            margin 200ms ease;
}

.cr-feedback-extended.cr-feedback-open {
	opacity: 1;
	margin: 16px 0 24px 0;
	/* max-height ustawiana dynamicznie przez JS */
}

.cr-feedback-extended[hidden] {
	display: none;
}

/* ==================================================================
   INTRO (empathic microcopy)
   ================================================================== */

.cr-feedback-intro {
	padding: 14px 18px;
	background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
	border-left: 4px solid #3B82F6;
	border-radius: 8px;
	margin-bottom: 20px;
}

.cr-feedback-empathy {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: #1E3A8A;
}

/* ==================================================================
   FIELDSETS
   ================================================================== */

.cr-feedback-fieldset {
	border: 0;
	padding: 0;
	margin: 0 0 20px 0;
}

.cr-feedback-legend {
	font-size: 14px;
	font-weight: 600;
	color: #1F2937;
	padding: 0;
	margin-bottom: 10px;
	display: block;
	width: 100%;
}

.cr-feedback-legend small {
	font-weight: 400;
	color: #6B7280;
	display: block;
	font-size: 12px;
	margin-top: 2px;
}

/* ==================================================================
   RADIO / CHECKBOX — custom styling
   ================================================================== */

.cr-feedback-radio-list,
.cr-feedback-checkbox-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cr-feedback-checkbox-inline {
	flex-direction: row;
	flex-wrap: wrap;
	gap: 8px 16px;
}

.cr-feedback-radio-item,
.cr-feedback-checkbox-item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 10px 12px;
	background: #F9FAFB;
	border: 1px solid #E5E7EB;
	border-radius: 8px;
	cursor: pointer;
	transition: background 120ms ease, border-color 120ms ease;
	font-size: 13px;
	line-height: 1.4;
}

.cr-feedback-radio-item:hover,
.cr-feedback-checkbox-item:hover {
	background: #F3F4F6;
	border-color: #D1D5DB;
}

.cr-feedback-radio-item input[type="radio"],
.cr-feedback-checkbox-item input[type="checkbox"] {
	flex-shrink: 0;
	margin-top: 2px;
	cursor: pointer;
}

.cr-feedback-radio-item input[type="radio"]:checked + .cr-feedback-radio-label,
.cr-feedback-checkbox-item input[type="checkbox"]:checked + .cr-feedback-checkbox-label {
	font-weight: 500;
	color: #132A5F;
}

.cr-feedback-radio-item:has(input:checked),
.cr-feedback-checkbox-item:has(input:checked) {
	background: #EFF6FF;
	border-color: #3B82F6;
}

/* ==================================================================
   FIELDS (single input / textarea / select)
   ================================================================== */

.cr-feedback-field {
	margin: 0 0 16px 0;
}

.cr-feedback-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #374151;
	margin-bottom: 6px;
}

.cr-feedback-field label small {
	font-weight: 400;
	color: #9CA3AF;
}

.cr-feedback-field input[type="text"],
.cr-feedback-field input[type="url"],
.cr-feedback-field input[type="number"],
.cr-feedback-field input[type="date"],
.cr-feedback-field select,
.cr-feedback-field textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #D1D5DB;
	border-radius: 6px;
	font-size: 14px;
	font-family: inherit;
	box-sizing: border-box;
	background: #fff;
	transition: border-color 120ms ease, box-shadow 120ms ease;
}

.cr-feedback-field input:focus,
.cr-feedback-field select:focus,
.cr-feedback-field textarea:focus {
	outline: none;
	border-color: #3B82F6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.cr-feedback-field textarea {
	resize: vertical;
	min-height: 90px;
}

.cr-feedback-field .cr-form-hint {
	display: block;
	margin-top: 4px;
	font-size: 12px;
	color: #6B7280;
}

/* ==================================================================
   ROW (numeric fields na jednym poziomie)
   ================================================================== */

.cr-feedback-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
}

.cr-feedback-row-numbers {
	grid-template-columns: 1fr;
}

@media (min-width: 600px) {
	.cr-feedback-row {
		grid-template-columns: 1fr 1fr;
	}
	.cr-feedback-row-numbers {
		grid-template-columns: 1fr 1fr 1fr;
	}
}

/* ==================================================================
   SUB-INPUT sections — fade in when shown
   ================================================================== */

.cr-feedback-sub {
	margin: 0 0 8px 0;
	padding: 16px 18px;
	background: #FFFBEB;
	border: 1px solid #FDE68A;
	border-radius: 8px;
	animation: cr-feedback-sub-fade-in 200ms ease;
}

.cr-feedback-sub[hidden] {
	display: none !important;
}

@keyframes cr-feedback-sub-fade-in {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ==================================================================
   PROGRESSIVE STEPS — fade-in dla kolejnych kroków formularza
   ================================================================== */

.cr-feedback-step[hidden] {
	display: none !important;
}

.cr-feedback-step.cr-step-revealed {
	animation: cr-feedback-step-reveal 300ms ease;
}

@keyframes cr-feedback-step-reveal {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ==================================================================
   DIVIDER (separator między C a D)
   ================================================================== */

.cr-feedback-divider {
	height: 1px;
	background: linear-gradient(to right, transparent, #E5E7EB, transparent);
	margin: 24px 0;
}

/* ==================================================================
   SCREENSHOT DROPZONE
   ================================================================== */

.cr-feedback-dropzone {
	position: relative;
	border: 2px dashed #D1D5DB;
	border-radius: 8px;
	background: #F9FAFB;
	padding: 24px 16px;
	text-align: center;
	transition: border-color 150ms ease, background 150ms ease;
	cursor: pointer;
}

.cr-feedback-dropzone:hover,
.cr-feedback-dropzone.cr-dragover {
	border-color: #3B82F6;
	background: #EFF6FF;
}

.cr-feedback-dropzone input[type="file"] {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

.cr-feedback-dropzone-inner {
	pointer-events: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}

.cr-feedback-dropzone-icon {
	font-size: 28px;
	opacity: 0.7;
}

.cr-feedback-dropzone-text {
	font-size: 13px;
	color: #374151;
	font-weight: 500;
}

.cr-feedback-dropzone-inner small {
	font-size: 11px;
	color: #9CA3AF;
}

/* Preview — po wybraniu pliku */
.cr-feedback-dropzone-preview {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0;
}

.cr-feedback-dropzone-preview[hidden] {
	display: none;
}

.cr-feedback-preview-img {
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 6px;
	border: 1px solid #E5E7EB;
	flex-shrink: 0;
}

.cr-feedback-preview-meta {
	flex: 1;
	text-align: left;
	display: flex;
	flex-direction: column;
	gap: 2px;
	overflow: hidden;
}

.cr-feedback-preview-name {
	font-size: 13px;
	font-weight: 500;
	color: #374151;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cr-feedback-preview-size {
	font-size: 11px;
	color: #9CA3AF;
}

.cr-feedback-preview-remove {
	background: #FEE2E2;
	color: #991B1B;
	border: 0;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 120ms ease;
	flex-shrink: 0;
}

.cr-feedback-preview-remove:hover {
	background: #FECACA;
}

/* ==================================================================
   ERROR MESSAGES
   ================================================================== */

.cr-feedback-error {
	margin: 4px 0 0;
	font-size: 12px;
	color: #DC2626;
	min-height: 0;
	line-height: 1.3;
}

.cr-feedback-error.cr-has-error {
	margin-top: 6px;
	padding: 6px 10px;
	background: #FEF2F2;
	border-left: 3px solid #DC2626;
	border-radius: 3px;
	font-weight: 500;
}

.cr-feedback-field input:invalid:not(:placeholder-shown),
.cr-feedback-field textarea:invalid:not(:placeholder-shown),
.cr-feedback-field select:invalid:not([data-cr-untouched]) {
	/* Nie używaj :invalid globalnie — za agresywne UX. Obsługujemy przez JS. */
}

.cr-feedback-field input[aria-invalid="true"],
.cr-feedback-field textarea[aria-invalid="true"],
.cr-feedback-field select[aria-invalid="true"] {
	border-color: #DC2626;
}

/* Required asterisk (jeśli nie ma w innych stylach pluginu) */
.cr-feedback-extended .cr-required {
	color: #DC2626;
	font-weight: 700;
}

/* ==================================================================
   MOBILE (< 600px) — dokładne dostrojenie
   ================================================================== */

@media (max-width: 599px) {
	.cr-feedback-extended {
		font-size: 14px;
	}

	.cr-feedback-intro {
		padding: 12px 14px;
	}

	.cr-feedback-empathy {
		font-size: 13px;
	}

	.cr-feedback-sub {
		padding: 12px 14px;
	}

	.cr-feedback-radio-item,
	.cr-feedback-checkbox-item {
		padding: 12px;  /* więcej miejsca pod touch target */
	}

	.cr-feedback-dropzone {
		padding: 20px 14px;
	}

	.cr-feedback-dropzone-icon {
		font-size: 24px;
	}

	/* touch targets ≥ 44px */
	.cr-feedback-field input,
	.cr-feedback-field select,
	.cr-feedback-field textarea {
		min-height: 44px;
		padding: 12px;
	}

	.cr-feedback-checkbox-inline {
		flex-direction: column;
		gap: 6px;
	}
}

/* ==================================================================
   DESKTOP tweaks (>= 900px)
   ================================================================== */

@media (min-width: 900px) {
	.cr-feedback-radio-list:not(.cr-feedback-checkbox-inline) {
		/* Dłuższa lista 11 powodów — 2 kolumny dla lepszego wykorzystania miejsca */
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 6px 10px;
	}
}
