/**
 * Digital Reviews Pro — front end.
 *
 * Everything is scoped under .dgtrp. Colours come from custom properties so a theme can
 * be matched by overriding four values rather than by fighting specificity.
 */

.dgtrp {
	--dgtrp-accent: var( --primary-color, #446084 );
	--dgtrp-star: #f5a623;
	--dgtrp-text: inherit;
	--dgtrp-muted: #6b7280;
	--dgtrp-border: #e2e4e7;
	--dgtrp-surface: #fff;
	--dgtrp-radius: 4px;
	--dgtrp-tint: rgba( 0, 0, 0, 0.03 );
	--dgtrp-overlay: rgba( 0, 0, 0, 0.55 );
	--dgtrp-modal-width: 640px;
	--dgtrp-error: #b32d2e;

	color: var( --dgtrp-text );
	box-sizing: border-box;
}

.dgtrp *,
.dgtrp *::before,
.dgtrp *::after {
	box-sizing: inherit;
}

@media ( prefers-color-scheme: dark ) {
	.dgtrp {
		--dgtrp-muted: #9ca3af;
		--dgtrp-border: #3f4247;
		--dgtrp-surface: #1f2126;
		--dgtrp-tint: rgba( 255, 255, 255, 0.05 );
	}
}

/* -- Armura față de temă --------------------------------------------------- */

/*
 * Modalul aterizează în foaia de stil a altcuiva. Flatsome — ca aproape orice temă
 * comercială — stilează selectorii goi `button`, `input` și `.button`, iar câteva dintre
 * regulile alea sunt „scrie totul cu majuscule" și „fără padding". Tot ce nu declarăm
 * noi, declară tema în locul nostru: exact așa au ajuns cele patru etichete de tab să
 * țipe și să se calce una pe alta.
 *
 * Deci declarăm. `text-transform` și `letter-spacing` poartă `!important` fiindcă o
 * opțiune de temă le poate emite din customizer cu aceeași greutate pe care o avem noi
 * aici, iar pierderea acelui aruncat cu banul schimbă lățimea fiecărei etichete.
 */
.dgtrp button,
.dgtrp input,
.dgtrp select,
.dgtrp textarea,
.dgtrp label,
.dgtrp legend,
.dgtrp h2,
.dgtrp h3,
.dgtrp h4 {
	text-transform: none !important;
	letter-spacing: normal !important;
	font-family: inherit;
}

.dgtrp button {
	min-height: 0;
	margin: 0;
	box-shadow: none;
	text-shadow: none;
}

/* Multe teme ridică butoanele la hover. Într-un dialog, asta arată ca o eroare. */
.dgtrp button:hover,
.dgtrp button:focus {
	box-shadow: none;
	transform: none;
}

.dgtrp input,
.dgtrp select,
.dgtrp textarea {
	min-height: 0;
	margin: 0;
	box-shadow: none;
}

/* -- Stars ---------------------------------------------------------------- */

.dgtrp .dgtrp-stars {
	display: inline-flex;
	gap: 2px;
	vertical-align: middle;
}

.dgtrp .dgtrp-star {
	width: 16px;
	height: 16px;
	background-color: currentColor;
	color: var( --dgtrp-star );
	/* Inline mask rather than an icon font: no extra request, no FOUT, scales cleanly. */
	-webkit-mask: var( --dgtrp-star-shape ) center / contain no-repeat;
	mask: var( --dgtrp-star-shape ) center / contain no-repeat;
	--dgtrp-star-shape: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E" );
}

.dgtrp .dgtrp-star.is-empty {
	opacity: 0.25;
}

.dgtrp .dgtrp-star.is-half {
	-webkit-mask-image: var( --dgtrp-star-shape ), linear-gradient( to right, #000 50%, transparent 50% );
	mask-image: var( --dgtrp-star-shape ), linear-gradient( to right, #000 50%, transparent 50% );
	-webkit-mask-composite: source-in;
	mask-composite: intersect;
}

/* -- Summary button ------------------------------------------------------- */

.dgtrp-summary {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	margin: 16px 0;
}

.dgtrp-summary__rating {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.dgtrp-summary__average {
	font-weight: 600;
}

.dgtrp-summary__count {
	color: var( --dgtrp-muted );
	font-size: 0.9em;
	text-decoration: underline;
}

/* -- Buttons -------------------------------------------------------------- */

.dgtrp .dgtrp-button {
	display: inline-block;
	min-height: 44px;
	padding: 11px 20px;
	border: 1px solid transparent;
	border-radius: 8px;
	background: none;
	color: inherit;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.dgtrp .dgtrp-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.dgtrp .dgtrp-button--primary {
	background: var( --dgtrp-accent );
	border-color: var( --dgtrp-accent );
	color: #fff;
}

.dgtrp .dgtrp-button--outline {
	border-color: var( --dgtrp-accent );
	color: var( --dgtrp-accent );
}

.dgtrp .dgtrp-button--outline:hover,
.dgtrp .dgtrp-button--outline:focus-visible {
	background: var( --dgtrp-accent );
	color: #fff;
}

.dgtrp .dgtrp-button--secondary {
	background: var( --dgtrp-border );
	color: inherit;
}

.dgtrp .dgtrp-button--link {
	padding-left: 4px;
	padding-right: 4px;
	color: var( --dgtrp-muted );
	text-decoration: underline;
}

/* -- Modal ---------------------------------------------------------------- */

html.dgtrp-modal-open {
	overflow: hidden;
}

.dgtrp-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.dgtrp-modal[hidden] {
	display: none;
}

.dgtrp-modal__overlay {
	position: absolute;
	inset: 0;
	background: var( --dgtrp-overlay );
}

.dgtrp-modal__dialog {
	position: relative;
	width: 100%;
	max-width: var( --dgtrp-modal-width );
	max-height: calc( 100vh - 48px );
	overflow-y: auto;
	background: var( --dgtrp-surface );
	border-radius: 12px;
	box-shadow: 0 24px 64px rgba( 0, 0, 0, 0.28 );
}

.dgtrp-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 24px 16px;

	/* Formularul de review e lung. Titlul și butonul de închidere rămân la vedere. */
	position: sticky;
	top: 0;
	z-index: 2;
	background: var( --dgtrp-surface );

	/* Un fir, nu o bordură: se citește ca separator când conținutul trece pe sub el. */
	box-shadow: 0 1px 0 var( --dgtrp-border );
}

.dgtrp-modal__title {
	margin: 0;
	font-size: 1.2em;
	font-weight: 700;
	line-height: 1.3;
}

.dgtrp .dgtrp-modal__close {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var( --dgtrp-muted );
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.dgtrp .dgtrp-modal__close:hover,
.dgtrp .dgtrp-modal__close:focus-visible {
	background: var( --dgtrp-tint );
	color: inherit;
}

.dgtrp-modal__body {
	padding: 20px 24px 24px;
}

/* -- Modal tabs ----------------------------------------------------------- */

/*
 * Grilă, nu rând.
 *
 * Patru etichete în română încăpeau într-un dialog de 640px cu patru pixeli de rezervă
 * — adică nu încăpeau. O temă care le scrie cu majuscule adaugă vreo 15% și rândul se
 * sparge, exact ce se vede în captura clientului. `auto-fit` așază patru coloane egale
 * când e loc și două când nu, iar textul are voie să treacă pe rândul al doilea: o
 * etichetă pe două rânduri e doar mai înaltă, niciodată stricată.
 */
.dgtrp-modal__tabs {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 128px, 1fr ) );
	gap: 8px;
	padding: 4px 24px 0;
}

.dgtrp-modal__tabs[hidden] {
	display: none;
}

.dgtrp .dgtrp-tab {
	padding: 10px 10px;
	border: 1px solid var( --dgtrp-border );
	border-radius: 999px;
	background: none;
	color: var( --dgtrp-muted );
	font: inherit;
	font-size: 0.82em;
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	white-space: normal;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.dgtrp .dgtrp-tab:hover {
	border-color: var( --dgtrp-accent );
	color: var( --dgtrp-accent );
}

.dgtrp .dgtrp-tab.is-active {
	border-color: var( --dgtrp-accent );
	background: var( --dgtrp-accent );
	color: #fff;
}

.dgtrp .dgtrp-tab:focus-visible {
	outline: 2px solid var( --dgtrp-accent );
	outline-offset: -2px;
}

/* Below this width the dialog becomes a full-screen sheet: a centred box with
   margins wastes space on a phone and pushes the submit button off-screen. */
@media ( max-width: 782px ) {
	.dgtrp-modal {
		padding: 0;
	}

	.dgtrp-modal__dialog {
		max-width: none;
		max-height: 100vh;
		height: 100%;
		border-radius: 0;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.dgtrp * {
		transition: none !important;
	}
}

/* -- Form ----------------------------------------------------------------- */

.dgtrp-field {
	margin: 0 0 18px;
}

.dgtrp-field label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.92em;
	font-weight: 600;
}

.dgtrp-field input[type="text"],
.dgtrp-field input[type="email"],
.dgtrp-field textarea {
	width: 100%;
	min-height: 44px;
	padding: 11px 13px;
	border: 1px solid var( --dgtrp-border );
	border-radius: 8px;
	background: var( --dgtrp-surface );
	color: inherit;
	font: inherit;
	line-height: 1.4;
	transition: border-color 0.15s ease;
}

.dgtrp-field input[type="text"]:focus,
.dgtrp-field input[type="email"]:focus,
.dgtrp-field textarea:focus {
	border-color: var( --dgtrp-accent );
	outline: 2px solid var( --dgtrp-accent );
	outline-offset: -1px;
}

.dgtrp-field textarea {
	min-height: 128px;
	resize: vertical;
}

.dgtrp-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

@media ( max-width: 600px ) {
	.dgtrp-field-row {
		grid-template-columns: 1fr;
	}
}

.dgtrp-hint {
	display: block;
	margin-top: 4px;
	color: var( --dgtrp-muted );
	font-size: 0.85em;
	font-weight: 400;
}

.dgtrp-required {
	color: var( --dgtrp-error );
}

.dgtrp-form__error {
	margin: 0 0 16px;
	padding: 10px 14px;
	border-left: 3px solid var( --dgtrp-error );
	background: rgba( 179, 45, 46, 0.07 );
	color: var( --dgtrp-error );
}

.dgtrp-form__actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	margin: 24px 0 0;
	padding-top: 18px;
	border-top: 1px solid var( --dgtrp-border );
}

/*
 * Pe telefon butoanele stau unul peste altul, cu cel principal deasupra. Două butoane
 * înghesuite pe un rând de 320px ajung amândouă prea mici ca să fie nimerite.
 */
@media ( max-width: 600px ) {
	.dgtrp-form__actions {
		flex-direction: column-reverse;
		align-items: stretch;
	}

	.dgtrp-form__actions .dgtrp-button {
		width: 100%;
	}
}

/* The honeypot must be unreachable to people but present to a bot: off-screen rather
   than display:none, which some bots skip. */
.dgtrp-hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* -- Star selector -------------------------------------------------------- */

/* Nota e primul lucru pe care îl cere formularul, deci arată ca o zonă, nu ca un rând. */
.dgtrp-rating {
	margin: 0 0 22px;
	padding: 16px;
	border: 1px solid var( --dgtrp-border );
	border-radius: 10px;
	background: var( --dgtrp-tint );
}

.dgtrp-rating legend {
	float: left;
	width: 100%;
	margin-bottom: 10px;
	padding: 0;
	font-size: 0.92em;
	font-weight: 600;
}

/* Radios laid out in reverse so the CSS sibling selector can light up every star to
   the left of the hovered or checked one. */
.dgtrp-rating__stars {
	display: inline-flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
	gap: 6px;
	vertical-align: middle;
}

.dgtrp-rating__input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.dgtrp-rating__label {
	width: 32px;
	height: 32px;
	background-color: currentColor;
	color: var( --dgtrp-border );
	cursor: pointer;
	-webkit-mask: var( --dgtrp-star-shape ) center / contain no-repeat;
	mask: var( --dgtrp-star-shape ) center / contain no-repeat;
	--dgtrp-star-shape: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E" );
	transition: color 0.12s ease, transform 0.12s ease;
}

.dgtrp-rating__input:checked ~ .dgtrp-rating__label,
.dgtrp-rating__label:hover,
.dgtrp-rating__label:hover ~ .dgtrp-rating__label {
	color: var( --dgtrp-star );
}

.dgtrp-rating__input:focus-visible + .dgtrp-rating__label {
	outline: 2px solid var( --dgtrp-accent );
	outline-offset: 3px;
}

.dgtrp-rating__label:hover {
	transform: scale( 1.08 );
}

.dgtrp-rating__readout {
	display: inline-block;
	margin-left: 14px;
	color: var( --dgtrp-muted );
	font-size: 0.92em;
	font-weight: 600;
	vertical-align: middle;
}

/* -- Success -------------------------------------------------------------- */

.dgtrp-success {
	padding: 8px 0;
	text-align: center;
}

.dgtrp-success__heading {
	margin: 0 0 8px;
	font-size: 1.15em;
	font-weight: 700;
}

.dgtrp-blocked {
	text-align: center;
}

/* -- Contribution list ---------------------------------------------------- */

.dgtrp-list__heading {
	margin: 0 0 20px;
}

.dgtrp-card {
	padding: 20px 0;
	border-bottom: 1px solid var( --dgtrp-border );
}

.dgtrp-card:last-child {
	border-bottom: 0;
}

.dgtrp-card__header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 10px;
}

.dgtrp-card__avatar img {
	display: block;
	border-radius: 50%;
}

.dgtrp-card__meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.dgtrp-card__author {
	font-weight: 600;
}

.dgtrp-card__date,
.dgtrp-card__language {
	color: var( --dgtrp-muted );
	font-size: 0.85em;
}

.dgtrp-card__rating {
	margin: 0 0 8px;
}

.dgtrp-card__title {
	margin: 0 0 8px;
	font-size: 1.05em;
}

.dgtrp-card__content p:last-child {
	margin-bottom: 0;
}

.dgtrp .dgtrp-badge--verified {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba( 0, 128, 0, 0.1 );
	color: #00650a;
	font-size: 0.75em;
	font-weight: 600;
}

/* -- Attachments ---------------------------------------------------------- */

.dgtrp-card__photo {
	margin: 12px 0 0;
}

.dgtrp-card__photo img {
	max-width: 260px;
	height: auto;
	border-radius: var( --dgtrp-radius );
}

.dgtrp-card__video {
	margin-top: 12px;
	max-width: 560px;
}

/* Keeps an oEmbed iframe from overflowing on a phone. */
.dgtrp-card__video iframe {
	max-width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
}

.dgtrp-card__video-link {
	margin-top: 12px;
	word-break: break-all;
}

/* -- Replies -------------------------------------------------------------- */

.dgtrp-card__replies {
	margin-top: 16px;
	padding-left: 20px;
	border-left: 2px solid var( --dgtrp-border );
}

.dgtrp-reply + .dgtrp-reply {
	margin-top: 12px;
}

.dgtrp-reply__meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 4px;
	font-size: 0.9em;
}

.dgtrp-reply__author {
	font-weight: 600;
}

.dgtrp-reply__meta time {
	color: var( --dgtrp-muted );
	font-size: 0.9em;
}

/* A reply from the shop is the one people scan for, so it gets the accent. */
.dgtrp-reply--store {
	padding: 12px 14px;
	border-radius: var( --dgtrp-radius );
	background: rgba( 68, 96, 132, 0.06 );
}

.dgtrp .dgtrp-badge--store {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	background: var( --dgtrp-accent );
	color: #fff;
	font-size: 0.75em;
	font-weight: 600;
}

.dgtrp-card__actions {
	margin: 12px 0 0;
}

.dgtrp-field--file input[type="file"] {
	width: 100%;
	padding: 8px 0;
}

.dgtrp-list__more,
.dgtrp-list__cta {
	margin-top: 20px;
	text-align: center;
}

.dgtrp-list__empty {
	color: var( --dgtrp-muted );
}

.dgtrp-loading {
	color: var( --dgtrp-muted );
	text-align: center;
}

/* -- Rating summary box --------------------------------------------------- */

.dgtrp-summary-box {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 32px;
	margin-bottom: 24px;
	padding-bottom: 24px;
	border-bottom: 1px solid var( --dgtrp-border );
}

.dgtrp-summary-box__average {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	min-width: 120px;
}

.dgtrp-summary-box__number {
	font-size: 2.5em;
	font-weight: 700;
	line-height: 1;
}

.dgtrp-summary-box__count {
	color: var( --dgtrp-muted );
	font-size: 0.85em;
}

/* -- Histogram ------------------------------------------------------------ */

.dgtrp-histogram {
	flex: 1 1 260px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.dgtrp-histogram__row + .dgtrp-histogram__row {
	margin-top: 4px;
}

.dgtrp-histogram__bar-link {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 2px 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

/* A row with no reviews is not a filter worth offering. */
.dgtrp-histogram__bar-link:disabled {
	opacity: 0.45;
	cursor: default;
}

.dgtrp-histogram__label {
	flex: 0 0 32px;
	font-size: 0.85em;
	white-space: nowrap;
}

.dgtrp-histogram__track {
	flex: 1;
	height: 8px;
	border-radius: 999px;
	background: var( --dgtrp-border );
	overflow: hidden;
}

.dgtrp-histogram__fill {
	display: block;
	height: 100%;
	background: var( --dgtrp-star );
}

.dgtrp-histogram__count {
	flex: 0 0 28px;
	color: var( --dgtrp-muted );
	font-size: 0.85em;
	text-align: right;
}

.dgtrp-histogram__bar-link:not(:disabled):hover .dgtrp-histogram__track {
	outline: 1px solid var( --dgtrp-accent );
}

/* -- Sort and filter controls --------------------------------------------- */

.dgtrp-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	margin-bottom: 20px;
}

.dgtrp-controls__group {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
}

.dgtrp-controls label {
	color: var( --dgtrp-muted );
	font-size: 0.9em;
}

.dgtrp-controls select {
	padding: 6px 10px;
	border: 1px solid var( --dgtrp-border );
	border-radius: var( --dgtrp-radius );
	background: var( --dgtrp-surface );
	color: inherit;
	font: inherit;
}

/* -- Votes and reporting -------------------------------------------------- */

.dgtrp-card__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	margin-top: 14px;
}

.dgtrp-votes {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.dgtrp-votes__question {
	color: var( --dgtrp-muted );
	font-size: 0.9em;
}

.dgtrp .dgtrp-vote {
	padding: 4px 12px;
	border: 1px solid var( --dgtrp-border );
	border-radius: 999px;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.9em;
	cursor: pointer;
}

.dgtrp .dgtrp-vote.is-active {
	border-color: var( --dgtrp-accent );
	background: var( --dgtrp-accent );
	color: #fff;
}

.dgtrp .dgtrp-flag:disabled {
	opacity: 0.6;
	cursor: default;
	text-decoration: none;
}

/* -- Qualifiers ----------------------------------------------------------- */

.dgtrp-card__qualifiers {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 4px 12px;
	margin: 12px 0 0;
	padding: 10px 14px;
	border-radius: var( --dgtrp-radius );
	background: rgba( 0, 0, 0, 0.03 );
	font-size: 0.9em;
}

.dgtrp-card__qualifiers dt {
	color: var( --dgtrp-muted );
}

.dgtrp-card__qualifiers dd {
	margin: 0;
	font-weight: 600;
}

.dgtrp-qualifier {
	margin: 0 0 18px;
	padding: 0;
	border: 0;
}

.dgtrp-qualifier legend {
	margin-bottom: 6px;
	padding: 0;
	font-weight: 600;
}

.dgtrp-qualifier__option {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-right: 16px;
	font-weight: 400;
}

/* Anything mid-reload should look like it is working, not like it is broken. */
.dgtrp-list__items[aria-busy="true"] {
	opacity: 0.5;
	transition: opacity 0.15s ease;
}

/* -- Touch targets -------------------------------------------------------- */

/*
 * Keyed to the pointer, not the screen width: a small laptop with a mouse does not need
 * bigger targets, and a large tablet with a finger does. 32px and 41px clear the WCAG AA
 * minimum comfortably, but they are under the 44px that fingers actually want.
 */
@media ( pointer: coarse ) {
	.dgtrp-rating__label {
		width: 44px;
		height: 44px;
	}

	.dgtrp .dgtrp-button {
		padding-top: 13px;
		padding-bottom: 13px;
	}

	.dgtrp .dgtrp-tab {
		padding-top: 13px;
		padding-bottom: 13px;
	}

	.dgtrp .dgtrp-vote {
		padding: 9px 16px;
	}

	.dgtrp .dgtrp-modal__close {
		width: 44px;
		height: 44px;
	}
}
