/*
 * Shared components: buttons, form fields, chips, status badges.
 * WooCommerce's own button and field classes are mapped to the same styles,
 * so every button in the shop looks like the app button.
 */

/* ---------- Buttons ---------- */

/* Filled (main call to action), like the app's filled Button: 50px, white on darker red. */
.btn,
.button,
button[type="submit"],
input[type="submit"],
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-xs);
	min-height: var(--size-button);
	padding: 0 var(--space-xl);
	border: 0;
	border-radius: var(--radius-md);
	background: var(--color-button-primary);
	color: var(--color-on-button-primary);
	font-family: var(--font-family);
	font-size: var(--text-headline);
	font-weight: var(--font-weight-semibold);
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color var(--transition-fast), color var(--transition-fast);
	-webkit-appearance: none;
	appearance: none;
}

.btn:hover,
.btn:active,
.button:hover,
.button:active,
button[type="submit"]:hover,
input[type="submit"]:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover,
.woocommerce input.button.alt:hover {
	background: var(--color-button-primary-pressed);
	color: var(--color-on-button-primary);
}

/* WooCommerce product lists set their own display and em padding on buttons; keep ours. */
.woocommerce ul.products li.product .button {
	display: inline-flex;
	padding: 0 var(--space-md);
}

/* Tinted (secondary action), like the app's tinted Button: 44px, red text on a light tint. */
.btn--tinted,
button.btn--tinted,
.woocommerce a.button.btn--tinted {
	min-height: var(--size-button-small);
	padding: 0 var(--space-md);
	background: var(--color-button-tinted);
	color: var(--color-on-button-tinted);
	font-size: var(--text-subheadline);
}

.btn--tinted:hover,
.btn--tinted:active,
button.btn--tinted:hover,
.woocommerce a.button.btn--tinted:hover {
	background: var(--color-button-tinted-pressed);
	color: var(--color-on-button-tinted-pressed);
}

.btn--block {
	width: 100%;
}

/* Disabled: neutral grey, like the app. */
.btn:disabled,
.btn[aria-disabled="true"],
.button:disabled,
.button.disabled,
.woocommerce a.button.disabled,
.woocommerce button.button:disabled,
.woocommerce button.button:disabled[disabled] {
	background: var(--color-background-secondary);
	color: var(--color-text-secondary);
	cursor: not-allowed;
	opacity: 1;
}

/* ---------- Form fields ---------- */

label {
	display: inline-block;
	margin-bottom: var(--space-xxs);
	font-size: var(--text-subheadline);
	font-weight: var(--font-weight-semibold);
	color: var(--color-text-primary);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
select,
textarea,
.woocommerce form .form-row .input-text,
.woocommerce form .form-row select {
	width: 100%;
	min-height: var(--size-field);
	padding: 0 var(--space-md);
	border: 1px solid var(--color-separator);
	border-radius: var(--radius-md);
	background: var(--color-background);
	color: var(--color-text-primary);
	font-family: var(--font-family);
	font-size: var(--text-body);
	line-height: 1.4;
	transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
	-webkit-appearance: none;
	appearance: none;
}

/* Multi-line field: room around the text (WooCommerce's .input-text rule would set the top to 0). */
textarea,
.woocommerce form .form-row textarea,
.woocommerce form .form-row textarea.input-text {
	min-height: 112px;
	padding: var(--space-sm) var(--space-md);
	resize: vertical;
}

select {
	padding-right: var(--space-xxl);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23636366' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right var(--space-md) center;
}

/* Focus: 2px border in the selected red, like the app's text field. */
input:focus,
select:focus,
textarea:focus {
	outline: none;
	border-color: var(--color-selected);
	box-shadow: 0 0 0 1px var(--color-selected);
}

input::placeholder,
textarea::placeholder {
	color: var(--color-text-tertiary);
}

/* Error state: WooCommerce marks invalid rows with .woocommerce-invalid. */
.field--error input,
.woocommerce form .form-row.woocommerce-invalid .input-text,
.woocommerce form .form-row.woocommerce-invalid select {
	border-color: var(--color-error);
}

input[type="checkbox"],
input[type="radio"] {
	flex-shrink: 0;
	width: 24px; /* WCAG 2.5.8: a target of at least 24 × 24 px */
	height: 24px;
	margin: 0;
	accent-color: var(--color-selected);
}

/* Label that wraps a checkbox or radio: box and text aligned, 44px touch area. */
label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]) {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
	min-height: var(--size-touch-target);
	margin: 0;
	font-weight: var(--font-weight-regular);
	cursor: pointer;
}

/* ---------- Chips ---------- */

.chip {
	display: inline-flex;
	align-items: center;
	min-height: var(--size-chip);
	padding: 0 var(--space-md);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-full);
	background: var(--color-background);
	color: var(--color-text-primary);
	font-size: var(--text-subheadline);
	font-weight: var(--font-weight-semibold);
	text-decoration: none;
	white-space: nowrap;
	transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.chip:hover {
	background: var(--color-background-secondary);
	color: var(--color-text-primary);
}

.chip.is-selected {
	border-color: var(--color-selected);
	background: var(--color-selected);
	color: var(--color-on-selected);
}

/* ---------- Status badges (stock, order status) ---------- */

.badge {
	display: inline-flex;
	align-items: center;
	padding: var(--space-xxs) var(--space-xs);
	border-radius: var(--radius-sm);
	font-size: var(--text-footnote);
	font-weight: var(--font-weight-semibold);
	line-height: 1.3;
}

.badge--success {
	background: var(--color-status-success);
	color: var(--color-on-status-success);
}

.badge--warning {
	background: var(--color-status-warning);
	color: var(--color-on-status-warning);
}

.badge--neutral {
	background: var(--color-status-neutral);
	color: var(--color-on-status-neutral);
}

.badge--error {
	background: var(--color-status-error);
	color: var(--color-on-status-error);
}

/* ---------- Card ---------- */

.card {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-background);
	box-shadow: var(--shadow-card);
}

/* ---------- Breadcrumbs (all WooCommerce pages: lists and products) ---------- */

.breadcrumbs {
	margin-bottom: var(--space-xs);
	font-size: var(--text-footnote);
	color: var(--color-text-secondary);
}

.breadcrumbs__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	margin: 0;
	padding: 0;
	list-style: none;
}

.breadcrumbs__item {
	display: inline-flex;
	align-items: center;
	min-height: var(--size-touch-target);
}

/* Separator: small chevron drawn in CSS, so screen readers read only the names. */
.breadcrumbs__item + .breadcrumbs__item::before {
	content: "";
	width: 16px;
	height: 16px;
	margin-inline: var(--space-xxs);
	background-color: var(--color-text-tertiary);
	-webkit-mask: url("../icons/chevron-right.svg") center / contain no-repeat;
	mask: url("../icons/chevron-right.svg") center / contain no-repeat;
}

.breadcrumbs a {
	/* The whole row is the target (the list item already has the touch height). */
	display: inline-flex;
	align-items: center;
	min-height: var(--size-touch-target);
	color: var(--color-text-secondary);
	text-decoration: none;
}

.breadcrumbs a:hover {
	color: var(--color-primary-pressed);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Current page: last item, plain text. */
.breadcrumbs__item:last-child {
	color: var(--color-text-primary);
	font-weight: var(--font-weight-semibold);
}


/* ---------- WooCommerce notices ("… je dodano u vašu korpu", errors, info) ---------- */

/*
 * Same look as the status badges: soft tinted box, 12px corners, no WooCommerce top
 * border or font icon. Success green, info grey, error red; the link/button on the
 * right ("Vidi korpu") as a tinted button. Used on product, cart and checkout pages.
 */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm) var(--space-md);
	margin: 0 0 var(--space-xl);
	padding: var(--space-md) var(--space-lg);
	border: 0;
	border-radius: var(--radius-md);
	font-size: var(--text-subheadline);
	line-height: 1.45;
	list-style: none;
}

.woocommerce-message::before,
.woocommerce-info::before,
.woocommerce-error::before {
	content: none;
}

.woocommerce-message {
	background: var(--color-status-success);
	color: var(--color-on-status-success);
}

.woocommerce-info {
	background: var(--color-status-neutral);
	color: var(--color-text-primary);
}

.woocommerce-error {
	background: var(--color-status-error);
	color: var(--color-on-status-error);
}

.woocommerce-error li {
	margin: 0;
}

/* The action inside the notice: text first in the markup, the button floats right in WooCommerce. */
.woocommerce-message .button,
.woocommerce-info .button,
.woocommerce-error .button,
.woocommerce .woocommerce-message a.button,
.woocommerce .woocommerce-info a.button,
.woocommerce .woocommerce-error a.button {
	order: 2;
	float: none;
	min-height: var(--size-touch-target);
	margin: 0;
	padding: 0 var(--space-md);
	background: var(--color-background);
	color: var(--color-text-primary);
	font-size: var(--text-subheadline);
}

.woocommerce-message .button:hover,
.woocommerce-info .button:hover,
.woocommerce-error .button:hover,
.woocommerce .woocommerce-message a.button:hover,
.woocommerce .woocommerce-info a.button:hover,
.woocommerce .woocommerce-error a.button:hover {
	background: var(--color-background-secondary);
	color: var(--color-text-primary);
}

.woocommerce-message a:not(.button),
.woocommerce-info a:not(.button),
.woocommerce-error a:not(.button) {
	color: inherit;
	font-weight: var(--font-weight-semibold);
}

/* ---------- Quantity stepper (product page, cart) ---------- */

/* Quantity: one rounded field with − and + inside (44px touch targets). */
.qty-stepper {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	height: var(--size-button);
	border: 1px solid var(--color-separator);
	border-radius: var(--radius-full);
	background: var(--color-background);
}

.qty-stepper:focus-within {
	border-color: var(--color-selected);
	box-shadow: 0 0 0 1px var(--color-selected);
}

.qty-stepper__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--size-touch-target);
	height: var(--size-touch-target);
	margin: 0 2px;
	padding: 0;
	border: 0;
	border-radius: var(--radius-full);
	background: transparent;
	color: var(--color-text-primary);
	cursor: pointer;
	transition: background-color var(--transition-fast);
}

.qty-stepper__button:hover:not(:disabled) {
	background: var(--color-background-secondary);
}

.qty-stepper__button:disabled {
	color: var(--color-text-tertiary);
	cursor: default;
}

.qty-stepper__button svg {
	width: 20px;
	height: 20px;
}

.woocommerce div.product form.cart .qty-stepper div.quantity,
.woocommerce .quantity {
	float: none;
	margin: 0;
}

/* The number itself: no frame and no browser arrows inside the stepper. */
.woocommerce div.product form.cart .qty-stepper .quantity .qty,
.qty-stepper .qty {
	width: 3.2em;
	min-height: 0;
	height: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	font-size: var(--text-headline);
	font-weight: var(--font-weight-semibold);
	text-align: center;
	-moz-appearance: textfield;
}

.qty-stepper .qty::-webkit-outer-spin-button,
.qty-stepper .qty::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

.qty-stepper .qty:focus {
	border: 0;
	box-shadow: none;
}

@media (max-width: 419px) {
	.qty-stepper__button {
		width: 40px;
	}

	.woocommerce div.product form.cart .qty-stepper .quantity .qty,
	.qty-stepper .qty {
		width: 2.6em;
	}
}

/* ---------- Bar at the bottom of the screen (product page, cart; phones) ---------- */

.buy-bar {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 40;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-md);
	padding: var(--space-sm) var(--gutter);
	padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--color-border);
	background: rgba(255, 255, 255, 0.96);
	box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
	transform: translateY(0);
	transition: transform 200ms ease-out;
}

@supports (backdrop-filter: blur(1px)) {
	.buy-bar {
		background: rgba(255, 255, 255, 0.86);
		backdrop-filter: saturate(1.8) blur(16px);
	}
}

.buy-bar[hidden] {
	display: flex;
	transform: translateY(110%);
	visibility: hidden;
	transition: transform 200ms ease-out, visibility 0s linear 200ms;
}

.buy-bar__total {
	display: flex;
	flex-direction: column;
	margin: 0;
	line-height: 1.2;
}

.buy-bar__label {
	color: var(--color-text-secondary);
	font-size: var(--text-caption);
}

.buy-bar__value {
	font-size: var(--text-headline);
	font-weight: var(--font-weight-bold);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.buy-bar__value .woocommerce-Price-amount {
	color: inherit;
}

.buy-bar__add {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	gap: var(--space-xs);
	min-height: var(--size-button-small);
	padding: 0 var(--space-lg);
	white-space: nowrap;
}

.buy-bar__add svg {
	width: 20px;
	height: 20px;
}

/* While the bar is up, the page ends above it, so the footer is not hidden behind it. */
body.has-buy-bar {
	padding-bottom: 76px;
}

@media (prefers-reduced-motion: reduce) {
	.buy-bar,
	.buy-bar[hidden] {
		transition: none;
	}
}

/* ---------- Empty state (empty product list, empty search, empty cart) ---------- */

/* Icon in a light red circle, heading, one sentence, the way on (like the app's empty cart). */
.shop-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: 480px;
	margin: var(--space-xxl) auto var(--space-xxxl);
	text-align: center;
}

.shop-empty__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	margin-bottom: var(--space-lg);
	border-radius: var(--radius-full);
	background: var(--color-button-tinted);
	color: var(--color-on-button-tinted);
}

.shop-empty__icon svg {
	width: 36px;
	height: 36px;
}

.shop-empty__title {
	margin: 0 0 var(--space-xs);
	font-size: var(--text-title3);
	font-weight: var(--font-weight-bold);
	line-height: 1.3;
	text-wrap: balance;
}

.shop-empty__text {
	margin: 0 0 var(--space-xl);
	color: var(--color-text-secondary);
	text-wrap: pretty;
}

/* Empty search (phase 6, section 2): main categories as chips that wrap, centred. */
.shop-empty__categories {
	margin: 0 0 var(--space-xl);
}

.shop-empty__categories-title {
	margin: 0 0 var(--space-sm);
	font-size: var(--text-subheadline);
	font-weight: var(--font-weight-semibold);
}

.shop-empty__chips {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-xs);
	margin: 0;
	padding: 0;
	list-style: none;
}

.shop-empty__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-sm);
}

.shop-empty__phone {
	margin: var(--space-lg) 0 0;
	color: var(--color-text-secondary);
	font-size: var(--text-subheadline);
}

.shop-empty__phone a {
	font-weight: var(--font-weight-semibold);
	white-space: nowrap;
}

/* Both buttons the same height side by side. */
.shop-empty__actions .btn--tinted {
	min-height: var(--size-button);
}

/* "Fizičko lice | Pravno lice" as one segmented control, like the app. */
.account-type {
	margin-inline: 0;
	padding: 0;
	border: 0;
}

.account-type__options {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	padding: 3px;
	border-radius: var(--radius-md);
	background: var(--color-background-secondary);
}

.account-type__option {
	position: relative;
	display: block;
	cursor: pointer;
}

.account-type__option input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.account-type__option span {
	display: flex;
	flex: 1;
	width: 100%;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	border-radius: calc(var(--radius-md) - 3px);
	color: var(--color-text-secondary);
	font-size: var(--text-subheadline);
	font-weight: var(--font-weight-semibold);
	transition: background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.account-type__option input:checked + span {
	background: var(--color-background);
	color: var(--color-text-primary);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.account-type__option input:focus-visible + span {
	outline: 2px solid var(--color-selected);
	outline-offset: 1px;
}

/* ---------- Address card (account pages and checkout) ---------- */

/* Address card with icons (order details, "Adrese", checkout). */
.address-card {
	padding: var(--space-lg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-background);
}

.address-card__title {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	margin: 0 0 var(--space-md);
	font-size: var(--text-headline);
	font-weight: var(--font-weight-semibold);
}

.address-card__badge {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: var(--radius-full);
	background: var(--color-button-tinted);
	color: var(--color-on-button-tinted);
}

.address-card__badge svg {
	width: 20px;
	height: 20px;
}

.address-card__rows {
	display: grid;
	gap: var(--space-sm);
	margin: 0;
	padding: 0;
	list-style: none;
}

.address-card__row {
	display: flex;
	align-items: flex-start;
	gap: var(--space-sm);
	font-size: var(--text-subheadline);
	line-height: 1.4;
}

.address-card__icon {
	display: inline-flex;
	flex-shrink: 0;
	color: var(--color-text-tertiary);
}

.address-card__icon svg {
	width: 18px;
	height: 18px;
	margin-top: 1px;
}

.address-card__text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.address-card__main {
	color: var(--color-text-primary);
	overflow-wrap: anywhere;
}

.address-card__extra {
	color: var(--color-text-secondary);
	overflow-wrap: anywhere;
}

/* "Telefon nije upisan": the row stays, the note is quieter. */
.address-card__missing {
	color: var(--color-text-secondary);
	font-style: italic;
}

.address-card__note {
	margin: 0;
	color: var(--color-text-secondary);
	font-size: var(--text-subheadline);
}

.address-card__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-xs) var(--space-sm);
	margin-top: auto;
	padding-top: var(--space-lg);
}

