/**
 * Pet Compare Bar Block Styles
 * Two states: expanded (full bar) and collapsed (compact pill)
 */

/* Base styles - hidden by default */
.pet-compare-bar {
	position: fixed;
	left: 0;
	right: 0;
	width: fit-content;
	margin: 0 auto;
	z-index: 999;
	transform: translateY(100%);
	transition: transform 0.3s ease, opacity 0.3s ease;
	opacity: 0;
	pointer-events: none;
	/* Reset — aside is structural only, children own all visuals. */
	background: transparent;
	border: none;
	padding: 0;
	box-shadow: none;
}

/* Show when has pets */
.pet-compare-bar.is-visible,
.pet-compare-bar:not([hidden]) {
	transform: translateY(0);
	opacity: 1;
	pointer-events: auto;
}

/* Explicit hidden state */
.pet-compare-bar[hidden] {
	display: block !important; /* Override for animation */
	transform: translateY(100%);
	opacity: 0;
	pointer-events: none;
}

.pet-compare-bar--bottom {
	bottom: 0;
}

.pet-compare-bar--top {
	top: 0;
	bottom: auto;
	transform: translateY(-100%);
}

.pet-compare-bar--top.is-visible,
.pet-compare-bar--top:not([hidden]) {
	transform: translateY(0);
}

/* ============================================
   COLLAPSED PILL
   ============================================ */

.pet-compare-bar__pill {
	display: none;
	align-items: center;
	gap: 6px;
	margin: 0 auto 0.75rem;
	padding: 10px 16px;
	background: var(--wp--preset--color--primary, #2271b1);
	color: #fff;
	border: none;
	border-radius: 24px;
	font-size: 0.8125rem;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
	transition: background 0.15s ease, box-shadow 0.15s ease;
	white-space: nowrap;
}

.pet-compare-bar__pill:hover {
	background: var(--wp--preset--color--primary-dark, #135e96);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.pet-compare-bar__pill:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.pet-compare-bar__pill-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	font-size: 0.75rem;
	font-weight: 700;
	background: rgba(255, 255, 255, 0.25);
	border-radius: 10px;
}

/* Collapsed (not expanded): show pill, hide inner */
.pet-compare-bar:not(.is-expanded) .pet-compare-bar__pill {
	display: flex;
}

.pet-compare-bar:not(.is-expanded) .pet-compare-bar__inner {
	display: none;
}

/* Expanded: hide pill, show inner (inner is flex by default) */
.pet-compare-bar.is-expanded .pet-compare-bar__pill {
	display: none;
}

/* ============================================
   EXPANDED BAR
   ============================================ */

/* Inner container */
.pet-compare-bar__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem 1.25rem 1rem;
	background: var(--wp--preset--color--base, #fff);
	border-top: 1px solid var(--wp--preset--color--contrast-3, #e0e0e0);
	border-radius: 12px 12px 0 0;
	box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
}

/* Header row with label + minimize */
.pet-compare-bar__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
}

/* Label */
.pet-compare-bar__label {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--wp--preset--color--contrast, #1e1e1e);
}

/* Minimize button */
.pet-compare-bar__minimize {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	background: transparent;
	border: 1px solid var(--wp--preset--color--contrast-3, #ddd);
	border-radius: 6px;
	color: var(--wp--preset--color--contrast-2, #666);
	cursor: pointer;
	transition: all 0.15s ease;
}

.pet-compare-bar__minimize:hover {
	background: var(--wp--preset--color--base-2, #f5f5f5);
	color: var(--wp--preset--color--contrast, #1e1e1e);
}

.pet-compare-bar__minimize:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #2271b1);
	outline-offset: 2px;
}

/* Pet slots container - centered */
.pet-compare-bar__pets {
	display: flex;
	gap: 0.625rem;
	justify-content: center;
}

/* Individual slot wrapper */
.pet-compare-bar__slot {
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	min-width: 48px;
}

/* Base pet styles */
.pet-compare-bar__pet {
	position: relative;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	transition: transform 0.15s ease;
}

.pet-compare-bar__pet:hover {
	transform: scale(1.05);
}

/* Empty slot */
.pet-compare-bar__pet--empty {
	background: var(--wp--preset--color--base-2, #f5f5f5);
	border: 2px dashed var(--wp--preset--color--contrast-3, #ccc);
}

/* Filled slot */
.pet-compare-bar__pet--filled {
	background: var(--wp--preset--color--base, #fff);
}

/* Pet image — applies whether inside --filled or not */
.pet-compare-bar__pet-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	border: 2px solid var(--wp--preset--color--primary, #2271b1);
}

.pet-compare-bar__pet-image[hidden] {
	display: none;
}

/* Pet name label under avatar */
.pet-compare-bar__pet-name {
	display: block;
	max-width: 56px;
	font-size: 0.6875rem;
	font-weight: 500;
	text-align: center;
	color: var(--wp--preset--color--contrast-2, #636363);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.2;
}

.pet-compare-bar__pet-name[hidden] {
	display: none;
}

/* Remove button */
.pet-compare-bar__remove {
	position: absolute;
	top: -4px;
	right: -4px;
	width: 20px;
	height: 20px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid var(--wp--preset--color--base, #fff);
	border-radius: 50%;
	background: #ef4444;
	color: #fff;
	cursor: pointer;
	transition: transform 0.15s ease, background 0.15s ease;
}

.pet-compare-bar__remove svg {
	display: block;
}

.pet-compare-bar__remove[hidden] {
	display: none;
}

.pet-compare-bar__remove:hover {
	background: #dc2626;
	transform: scale(1.1);
}

.pet-compare-bar__remove:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #2271b1);
	outline-offset: 2px;
}

/* Actions - centered row */
.pet-compare-bar__actions {
	display: flex;
	gap: 0.5rem;
	justify-content: center;
	width: 100%;
	max-width: 320px;
}

/* Buttons */
.pet-compare-bar__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.375rem;
	padding: 0.5rem 1rem;
	border-radius: 6px;
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	transition: all 0.15s ease;
	border: none;
}

.pet-compare-bar__btn--primary {
	flex: 1;
	background: var(--wp--preset--color--primary, #2271b1);
	color: #fff;
}

.pet-compare-bar__btn--primary:hover {
	background: var(--wp--preset--color--primary-dark, #135e96);
}

.pet-compare-bar__btn--secondary {
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--contrast, #1e1e1e);
	border: 1px solid var(--wp--preset--color--contrast-3, #ddd);
	padding: 0.5rem;
	aspect-ratio: 1;
}

.pet-compare-bar__btn--secondary:hover {
	background: var(--wp--preset--color--base-2, #f5f5f5);
	border-color: var(--wp--preset--color--contrast-2, #999);
}

.pet-compare-bar__btn--secondary svg {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
}

.pet-compare-bar__btn--text {
	background: transparent;
	color: var(--wp--preset--color--contrast-2, #666);
	padding: 0.5rem;
}

.pet-compare-bar__btn--text:hover {
	color: var(--wp--preset--color--contrast, #1e1e1e);
}

.pet-compare-bar__btn:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary, #2271b1);
	outline-offset: 2px;
}

/* Hide share button text, show icon only */
.pet-compare-bar__btn-text {
	display: none;
}

/* Disabled state */
.pet-compare-bar__btn:disabled,
.pet-compare-bar__btn[disabled] {
	opacity: 0.4;
	cursor: not-allowed;
	pointer-events: none;
}

/* Toast notification */
.pet-compare-bar__toast {
	position: fixed;
	bottom: 110px;
	left: 50%;
	transform: translateX(-50%);
	padding: 0.75rem 1.25rem;
	background: var(--wp--preset--color--contrast, #1e1e1e);
	color: #fff;
	font-size: 0.875rem;
	font-weight: 500;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
	z-index: 1001;
	max-width: calc(100vw - 2rem);
	text-align: center;
	/* Hidden by default — shown only when content is present and not [hidden]. */
	display: none;
}

/* Show only when the toast has text content and is not hidden. */
.pet-compare-bar__toast:not([hidden]):not(:empty) {
	display: block;
	animation: compare-toast-in 0.25s ease;
}

.pet-compare-bar__toast[hidden] {
	display: none !important;
}

@keyframes compare-toast-in {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

/* ============================================
   MOBILE ADJUSTMENTS
   ============================================ */

@media (max-width: 480px) {
	.pet-compare-bar__pill {
		padding: 6px 10px;
		font-size: 0.75rem;
	}

	.pet-compare-bar__pill-count {
		min-width: 18px;
		height: 18px;
		font-size: 0.6875rem;
	}

	.pet-compare-bar__slot {
		min-width: 40px;
	}

	.pet-compare-bar__pet {
		width: 40px;
		height: 40px;
	}
	
	.pet-compare-bar__remove {
		width: 18px;
		height: 18px;
		top: -3px;
		right: -3px;
	}

	.pet-compare-bar__remove svg {
		width: 8px;
		height: 8px;
	}
	
	.pet-compare-bar__pet-name {
		max-width: 44px;
		font-size: 0.625rem;
	}

	.pet-compare-bar__actions {
		max-width: 280px;
	}
}

/* Top position overrides */
.pet-compare-bar--top:not(.is-expanded) .pet-compare-bar__pill {
	margin: 0.75rem auto 0;
}

.pet-compare-bar--top .pet-compare-bar__inner {
	border-top: none;
	border-bottom: 1px solid var(--wp--preset--color--contrast-3, #e0e0e0);
	border-radius: 0 0 12px 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}