/*
 * Global component states (PS-01.12): default, hover, focus, active, selected, disabled, loading, success, error, empty.
 * State is never carried by colour alone: shape, text, border weight or icon always changes too.
 * Classes .is-hover / .is-active exist so the design review page can show states statically.
 */

/* ---------- Buttons ---------- */
.ak-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ak-space-2);
	min-height: var(--ak-target-min);
	padding: var(--ak-space-3) var(--ak-space-6);
	border: var(--ak-border-width) solid var(--ak-color-interactive-primary);
	border-radius: var(--ak-radius-control);
	background: var(--ak-color-interactive-primary);
	color: var(--ak-color-text-on-interactive);
	font-family: var(--ak-font-ui);
	font-size: var(--ak-type-button);
	font-weight: var(--ak-weight-medium);
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color var(--ak-motion-duration-fast) var(--ak-motion-ease-standard),
		color var(--ak-motion-duration-fast) var(--ak-motion-ease-standard),
		border-color var(--ak-motion-duration-fast) var(--ak-motion-ease-standard);
}

.ak-button:hover,
.ak-button.is-hover {
	background: var(--ak-color-interactive-primary-hover);
	border-color: var(--ak-color-interactive-primary-hover);
	color: var(--ak-color-text-on-interactive);
	text-decoration: none;
}

.ak-button:active,
.ak-button.is-active {
	transform: translateY(1px);
}

.ak-button--secondary {
	background: transparent;
	color: var(--ak-color-interactive-primary);
	border-width: var(--ak-border-width-emphasis);
}

.ak-button--secondary:hover,
.ak-button--secondary.is-hover {
	background: var(--ak-color-canvas-secondary);
	color: var(--ak-color-interactive-primary);
	border-color: var(--ak-color-interactive-primary);
}

.ak-button--text {
	background: transparent;
	border-color: transparent;
	color: var(--ak-color-interactive-primary);
	padding-inline: var(--ak-space-2);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.ak-button--text:hover {
	background: transparent;
	border-color: transparent;
	color: var(--ak-color-interactive-primary-hover);
	text-decoration-thickness: 2px;
}

.ak-button--block {
	display: flex;
	width: 100%;
}

/* Disabled: dashed edge and reduced weight, so colour is not the only cue */
.ak-button:disabled,
.ak-button[aria-disabled="true"] {
	background: var(--ak-color-canvas-secondary);
	border: var(--ak-border-width) dashed var(--ak-color-border-strong);
	color: var(--ak-color-text-muted);
	cursor: not-allowed;
	transform: none;
}

/* Loading: spinner plus the button keeps its label; aria-busy announced by script */
.ak-button[aria-busy="true"] {
	cursor: progress;
	pointer-events: none;
}

.ak-button[aria-busy="true"]::after {
	content: "";
	width: 1em;
	height: 1em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: ak-spin 0.8s linear infinite;
}

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

/* Icon-only buttons: label is supplied with aria-label or .ak-visually-hidden text */
.ak-icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: var(--ak-target-min);
	min-height: var(--ak-target-min);
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--ak-color-text-primary);
	cursor: pointer;
}

.ak-icon-button:hover {
	color: var(--ak-color-interactive-primary-hover);
}

.ak-icon {
	width: 1.5rem;
	height: 1.5rem;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.ak-icon--sm { width: 1.125rem; height: 1.125rem; }

/* ---------- Form fields ---------- */
.ak-field {
	display: grid;
	gap: var(--ak-space-2);
}

.ak-field__label {
	font-size: var(--ak-type-label);
	font-weight: var(--ak-weight-medium);
	color: var(--ak-color-text-primary);
}

.ak-field__hint {
	font-size: var(--ak-type-meta);
	color: var(--ak-color-text-muted);
}

.ak-input,
.ak-select,
.ak-textarea {
	width: 100%;
	min-height: var(--ak-target-min);
	padding: var(--ak-space-3) var(--ak-space-4);
	border: var(--ak-border-width) solid var(--ak-color-border-strong);
	border-radius: var(--ak-radius-control);
	background: var(--ak-color-surface-default);
	color: var(--ak-color-text-primary);
	font: inherit;
	transition: border-color var(--ak-motion-duration-fast) var(--ak-motion-ease-standard);
}

.ak-textarea { min-height: 8rem; resize: vertical; }

.ak-input:hover,
.ak-select:hover,
.ak-textarea:hover,
.ak-input.is-hover {
	border-color: var(--ak-color-text-primary);
}

.ak-input:focus-visible,
.ak-select:focus-visible,
.ak-textarea:focus-visible,
.ak-input.is-focus {
	outline: 0;
	box-shadow: 0 0 0 1px var(--ak-color-focus-ring);
	border-color: var(--ak-color-focus-ring);
}

.ak-input::placeholder {
	color: var(--ak-color-text-muted);
}

.ak-input:disabled,
.ak-select:disabled,
.ak-textarea:disabled {
	background: var(--ak-color-canvas-secondary);
	border-style: dashed;
	color: var(--ak-color-text-muted);
	cursor: not-allowed;
}

/* Error: thicker edge, message text and icon; never colour alone */
.ak-field--error .ak-input,
.ak-field--error .ak-select,
.ak-field--error .ak-textarea,
.ak-input[aria-invalid="true"] {
	border-color: var(--ak-color-error);
	border-width: var(--ak-border-width-emphasis);
}

.ak-field--success .ak-input {
	border-color: var(--ak-color-success);
	border-width: var(--ak-border-width-emphasis);
}

.ak-field__message {
	display: flex;
	align-items: flex-start;
	gap: var(--ak-space-2);
	font-size: var(--ak-type-body-small);
	font-weight: var(--ak-weight-medium);
}

.ak-field__message .ak-icon { margin-top: 0.1em; }
.ak-field--error .ak-field__message { color: var(--ak-color-error); }
.ak-field--success .ak-field__message { color: var(--ak-color-success); }

/* Checkbox and radio: native control, enlarged, with accent colour and a visible selected mark */
.ak-check {
	display: flex;
	align-items: flex-start;
	gap: var(--ak-space-3);
	min-height: var(--ak-target-min);
	padding-block: var(--ak-space-2);
	cursor: pointer;
}

.ak-check input {
	width: 1.375rem;
	height: 1.375rem;
	margin: 0.1rem 0 0;
	accent-color: var(--ak-color-interactive-primary);
	flex: none;
}

/* ---------- Messages (notices) ---------- */
.ak-message {
	display: flex;
	gap: var(--ak-space-3);
	padding: var(--ak-space-4);
	border: var(--ak-border-width) solid var(--ak-color-border-strong);
	border-inline-start-width: 0.375rem;
	background: var(--ak-color-surface-default);
	color: var(--ak-color-text-primary);
}

.ak-message__title {
	display: block;
	font-weight: var(--ak-weight-bold);
}

.ak-message--success { border-color: var(--ak-color-success); }
.ak-message--warning { border-color: var(--ak-color-warning); }
.ak-message--error { border-color: var(--ak-color-error); }
.ak-message--success .ak-icon { color: var(--ak-color-success); }
.ak-message--warning .ak-icon { color: var(--ak-color-warning); }
.ak-message--error .ak-icon { color: var(--ak-color-error); }

/* ---------- Empty state ---------- */
.ak-empty {
	padding-block: var(--ak-space-8);
	text-align: center;
}

.ak-empty p { margin-inline: auto; }

/* ---------- Badge ---------- */
.ak-badge {
	display: inline-block;
	padding: 0.125rem var(--ak-space-2);
	border: var(--ak-border-width) solid currentColor;
	border-radius: var(--ak-radius-badge);
	color: var(--ak-color-accent);
	background: var(--ak-color-surface-default);
	font-size: var(--ak-type-meta);
	font-weight: var(--ak-weight-medium);
	line-height: 1.4;
}

/* ---------- Price (GBP, real WooCommerce data only) ---------- */
.ak-price {
	font-family: var(--ak-font-ui);
	font-size: var(--ak-type-price);
	font-weight: var(--ak-weight-medium);
	font-variant-numeric: tabular-nums;
	color: var(--ak-color-text-primary);
}

.ak-price del {
	color: var(--ak-color-text-muted);
	font-weight: var(--ak-weight-regular);
	margin-inline-end: var(--ak-space-2);
}

.ak-price ins {
	text-decoration: none;
}

/* ---------- Selected state for product options, filters, tabs ---------- */
.ak-option {
	min-width: var(--ak-target-min);
	min-height: var(--ak-target-min);
	padding: var(--ak-space-2) var(--ak-space-4);
	border: var(--ak-border-width) solid var(--ak-color-border-strong);
	border-radius: var(--ak-radius-control);
	background: var(--ak-color-surface-default);
	color: var(--ak-color-text-primary);
	font: inherit;
	cursor: pointer;
}

.ak-option[aria-pressed="true"],
.ak-option[aria-checked="true"],
.ak-option.is-selected {
	border-color: var(--ak-color-interactive-primary);
	border-width: var(--ak-border-width-emphasis);
	font-weight: var(--ak-weight-bold);
}

/* Unavailable option: struck through, so it reads without colour */
.ak-option[aria-disabled="true"],
.ak-option:disabled {
	color: var(--ak-color-text-muted);
	border-style: dashed;
	text-decoration: line-through;
	cursor: not-allowed;
}

/* ---------- AYATOP 2027 buttons: forest primary, outlined secondary, text link. Sentence case, 48px. ---------- */
.ak-button { min-height: 3rem; padding: 0 1.625rem; font-size: 1rem; font-weight: 540; letter-spacing: 0; text-transform: none; border-radius: var(--ak-radius-control); }
.ak-button--secondary { background: transparent; border-color: var(--ak-color-brand-primary); color: var(--ak-color-brand-primary); }
.ak-button--secondary:hover, .ak-button--secondary.is-hover { background: var(--ak-color-brand-primary); border-color: var(--ak-color-brand-primary); color: #fff; }
.ak-badge { border-color: transparent; background: var(--ak-color-canvas-primary); color: var(--ak-color-text-primary); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 640; }
.ak-text-link { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 1rem; font-weight: 540; color: var(--ak-color-brand-primary); text-decoration: none; }
.ak-text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
