/**
 * RandList styles.
 * Uses Directorist design tokens where available and stays theme agnostic.
 */

:root {
	--randlist-accent: #445bf3;
	--randlist-danger: #e5484d;
	--randlist-radius: 10px;
	--randlist-border: rgba(17, 24, 39, 0.1);
	--randlist-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
	--randlist-surface: #fff;
	--randlist-text: #111827;
	--randlist-muted: #6b7280;
}

/* ------------------------------------------------------------ Toasts */

.randlist-toasts {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-width: min(360px, calc(100vw - 40px));
}

.randlist-toast {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 14px 16px;
	background: var(--randlist-surface);
	color: var(--randlist-text);
	border: 1px solid var(--randlist-border);
	border-left: 4px solid var(--randlist-accent);
	border-radius: var(--randlist-radius);
	box-shadow: var(--randlist-shadow);
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.randlist-toast.is-visible {
	opacity: 1;
	transform: translateY(0);
}

.randlist-toast__icon {
	color: var(--randlist-accent);
	font-size: 16px;
	line-height: 1.4;
}

.randlist-toast__body {
	flex: 1 1 auto;
	min-width: 0;
}

.randlist-toast__title {
	display: block;
	font-size: 14px;
	line-height: 1.3;
}

.randlist-toast__text {
	margin: 4px 0 0;
	font-size: 13px;
	color: var(--randlist-muted);
}

.randlist-toast__link {
	display: inline-block;
	margin-top: 8px;
	font-size: 13px;
	font-weight: 600;
	color: var(--randlist-accent);
	text-decoration: underline;
}

.randlist-toast__close {
	background: none;
	border: 0;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	color: var(--randlist-muted);
	padding: 0 2px;
}

/* ------------------------------------------------- Favorite button state */

.randlist-is-saved,
.randlist-is-saved i,
.randlist-is-saved svg {
	color: var(--randlist-danger) !important;
}

.randlist-is-saved i {
	font-weight: 900;
}

.randlist-saved-link .randlist-heart {
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-right: 6px;
	background: var(--randlist-danger);
	-webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 21s-8-4.9-8-10.6A4.4 4.4 0 0 1 12 7a4.4 4.4 0 0 1 8 3.4C20 16.1 12 21 12 21Z'/></svg>") center/contain no-repeat;
	mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 21s-8-4.9-8-10.6A4.4 4.4 0 0 1 12 7a4.4 4.4 0 0 1 8 3.4C20 16.1 12 21 12 21Z'/></svg>") center/contain no-repeat;
	vertical-align: -2px;
}

/* --------------------------------------------------- TikTok social icon */

.randlist-social-tiktok .randlist-tiktok-icon {
	display: block;
}

/* ---------------------------------------------------- Saved listings page */

.randlist-saved-wrapper {
	margin: 0 auto;
}

.randlist-saved-header {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
}

.randlist-saved-title {
	margin: 0;
	font-size: 24px;
	line-height: 1.2;
}

.randlist-saved-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.randlist-saved-toolbar .randlist-action[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

.randlist-saved-status {
	margin-bottom: 14px;
	font-size: 14px;
	color: var(--randlist-muted);
}

.randlist-saved-grid {
	display: grid;
	gap: 20px;
	grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 640px) {
	.randlist-cols-2,
	.randlist-cols-3,
	.randlist-cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 992px) {
	.randlist-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.randlist-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.randlist-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--randlist-surface);
	border: 1px solid var(--randlist-border);
	border-radius: var(--randlist-radius);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.randlist-card:hover {
	box-shadow: var(--randlist-shadow);
	transform: translateY(-2px);
}

.randlist-card__thumb {
	display: block;
	aspect-ratio: 16 / 10;
	background: #f3f4f6;
	overflow: hidden;
}

.randlist-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.randlist-card__thumb-empty {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #eef1f5, #dfe4ec);
}

.randlist-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px 16px;
	flex: 1 1 auto;
}

.randlist-card__title {
	margin: 0;
	font-size: 16px;
	line-height: 1.35;
}

.randlist-card__title a {
	color: inherit;
	text-decoration: none;
}

.randlist-card__title a:hover {
	color: var(--randlist-accent);
}

.randlist-card__meta {
	margin: 0;
	font-size: 13px;
	color: var(--randlist-muted);
}

.randlist-card__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: auto;
	padding-top: 12px;
}

.randlist-card__date {
	font-size: 12px;
	color: var(--randlist-muted);
}

.randlist-empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 48px 20px;
	border: 1px dashed var(--randlist-border);
	border-radius: var(--randlist-radius);
}

.randlist-empty__title {
	margin: 0 0 6px;
	font-size: 18px;
	font-weight: 600;
}

.randlist-empty__text {
	margin: 0 0 16px;
	color: var(--randlist-muted);
}

/* ------------------------------------------------------------- Printing */

@media print {
	.randlist-saved-toolbar,
	.randlist-card__remove,
	.randlist-toasts {
		display: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.randlist-toast,
	.randlist-card {
		transition: none;
	}
}
