/**
 * Diary (mascots UI): add-meal banner, entry dialog, clear link, reminder art,
 * and the item-selector adjustments that apply only while the new diary UI is active.
 */

/* ─── Add-meal banner ─── */

.chefit-diary .cfk.diary-entry-banner {
	margin: 0 0 20px;
}

.chefit-diary .cfk.diary-entry-banner .cfk-banner {
	cursor: pointer;
}

/* ─── Entry dialog ─── */

/* The close button sits on the outer (left) edge. Inset the row so it covers empty space, not the face. */
#cfk-diary-entry .cfk-entry-intro {
	padding-inline-end: 36px;
}

#cfk-diary-entry .cfk-entry-footer {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 10px;
}

#cfk-diary-entry .cfk-entry-footer .cfk-text-button {
	font-size: 14px !important;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ─── Clear diary (moved below the meals) ─── */

.chefit-diary .diary-clear-row {
	display: flex;
	margin: 14px 0 6px;
}

.chefit-diary .diary-clear-link {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	width: 100%;
	min-height: 46px;
	padding: 10px 18px;
	border: 1px solid var(--chefit-diary-hair-soft, #e5e7eb);
	border-radius: 14px;
	background: var(--chefit-diary-card, #fff);
	color: var(--chefit-diary-danger, #c0392b);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	cursor: pointer;
}

.chefit-diary .diary-clear-link:hover,
.chefit-diary .diary-clear-link:focus-visible {
	color: var(--chefit-diary-danger, #dc3545) !important;
	background-color: var(--chefit-diary-danger-wash, #fdecee) !important;
}

.chefit-diary .diary-clear-link:focus-visible {
	outline: 2px solid var(--chefit-diary-danger, #dc3545);
	outline-offset: 2px;
}

/* ─── Reminder boxes with a mascot column ─── */

.chefit-diary-info-box.has-mascot {
	display: flex;
	align-items: stretch;
	gap: 12px;
	padding-right: 0;
	overflow: hidden;
}

.chefit-diary-info-box.has-mascot .chefit-diary-info-art {
	position: relative;
	flex: 0 0 112px;
	min-height: 110px;
	overflow: hidden;
	align-self: stretch;
}

/* Art column is on the right: keep the face toward the text and clip only the outer edge. */
.chefit-diary-info-box.has-mascot .chefit-diary-info-art .cfk-mascot {
	position: absolute;
	top: 0;
	bottom: auto;
	inset-inline-start: auto;
	inset-inline-end: 0;
	width: calc(100% + 16px);
	height: auto;
	object-fit: contain;
}

.chefit-diary-info-box.has-mascot .chefit-diary-info-art .cfk-mascot--custom {
	inset-inline-start: 0;
	inset-inline-end: 0;
	top: auto;
	bottom: 0;
	width: 100%;
	height: 100%;
	object-position: center bottom;
}

.chefit-diary-info-box.has-mascot .chefit-diary-info-art[data-characters=off] {
	display: none;
}

.chefit-diary-info-box.has-mascot .chefit-diary-info-inner {
	flex: 1;
	min-width: 0;
	align-self: center;
}

@media (max-width: 360px) {
	.chefit-diary-info-box.has-mascot .chefit-diary-info-art {
		flex-basis: 92px;
	}
}

/* ─── Item selector on the diary: AI + "my menu" live in the entry dialog instead ─── */

body.chefit-diary-entry-mode #chefit-item-selector-overlay #chefit-ai-text-btn,
body.chefit-diary-entry-mode #chefit-item-selector-overlay #chefit-ai-image-btn,
body.chefit-diary-entry-mode #chefit-item-selector-overlay #chefit-my-menu-btn {
	display: none !important;
}

/* ─── Menus screen ("בחירת תפריט קבוע"): search → view → choose ─── */

#chefit-menu-picker-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000004; /* above the item selector (999999), details and info-menu overlays (1000000–1000002) */
	display: flex;
	align-items: stretch;
	justify-content: center;
	background: var(--chefit-overlay-dark, rgba(20, 22, 32, .45));
}

#chefit-menu-picker-overlay[hidden] {
	display: none;
}

#chefit-menu-picker-overlay .chefit-menu-picker {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	background: var(--chefit-bg-card, #fff);
	color: var(--chefit-text, #161927);
	font-family: var(--chefit-font-family, inherit);
	animation: chefit-menu-picker-in .24s ease-out;
}

@media (min-width: 769px) {
	#chefit-menu-picker-overlay {
		align-items: center;
		padding: 24px;
	}
	#chefit-menu-picker-overlay .chefit-menu-picker {
		max-width: 560px;
		height: min(86vh, 820px);
		border-radius: 20px;
		overflow: hidden;
		box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
	}
}

@keyframes chefit-menu-picker-in {
	from { transform: translateY(24px); opacity: .6; }
	to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	#chefit-menu-picker-overlay .chefit-menu-picker {
		animation: none;
	}
}

#chefit-menu-picker-overlay .chefit-menu-picker__header {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 58px;
	padding: max(8px, env(safe-area-inset-top)) 12px 8px;
	border-bottom: 1px solid var(--chefit-border-light, #e5e7eb);
}

#chefit-menu-picker-overlay .chefit-menu-picker__title {
	flex: 1;
	min-width: 0;
	margin: 0;
	font-size: 18px;
	font-weight: 800;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#chefit-menu-picker-overlay button.chefit-menu-picker__icon-btn {
	display: inline-grid;
	place-items: center;
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
}

#chefit-menu-picker-overlay button.chefit-menu-picker__icon-btn[hidden] {
	display: none;
}

#chefit-menu-picker-overlay button.chefit-menu-picker__icon-btn svg {
	width: 22px;
	height: 22px;
}

#chefit-menu-picker-overlay .chefit-menu-picker__body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 14px 14px 20px;
}

#chefit-menu-picker-overlay .chefit-menu-picker__list-view[hidden],
#chefit-menu-picker-overlay .chefit-menu-picker__preview-view[hidden],
#chefit-menu-picker-overlay .chefit-menu-picker__footer[hidden] {
	display: none;
}

#chefit-menu-picker-overlay .chefit-menu-picker__search {
	position: relative;
	display: flex;
	align-items: center;
}

#chefit-menu-picker-overlay .chefit-menu-picker__search svg {
	position: absolute;
	inset-inline-start: 12px;
	width: 18px;
	height: 18px;
	color: var(--chefit-text-muted, #6b7280);
	pointer-events: none;
}

#chefit-menu-picker-overlay .chefit-menu-picker__search input {
	width: 100%;
	min-height: 46px;
	padding: 10px 40px 10px 12px;
	border: 1px solid var(--chefit-border, #d1d5db);
	border-radius: 12px;
	background: var(--chefit-bg-input, #fff);
	font-size: 16px;
}

#chefit-menu-picker-overlay .chefit-menu-picker__footer {
	padding: 10px 14px max(12px, env(safe-area-inset-bottom));
	border-top: 1px solid var(--chefit-border-light, #e5e7eb);
	background: var(--chefit-bg-card, #fff);
}

#chefit-menu-picker-overlay button.chefit-menu-picker__choose {
	display: block;
	width: 100%;
	min-height: 48px;
	padding: 12px 16px;
	border: 0;
	border-radius: 12px;
	background: var(--chefit-diary-green-deep, #4f7f12);
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	text-align: center;
	white-space: normal;
}

#chefit-menu-picker-overlay button.chefit-menu-picker__choose:hover,
#chefit-menu-picker-overlay button.chefit-menu-picker__choose:focus {
	background-color: var(--chefit-diary-green-deep, #4f7f12) !important;
	color: #fff !important;
}

#chefit-menu-picker-overlay button.chefit-menu-picker__choose:disabled {
	background: var(--chefit-bg-muted, #e5e7eb);
	color: var(--chefit-text-muted, #6b7280);
	cursor: default;
}

.chefit-menu-picker-current {
	margin: 0 0 12px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--chefit-text-muted, #6b7280);
}

.chefit-menu-picker-results {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 12px;
}

#chefit-menu-picker-overlay button.chefit-menu-picker-item {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	min-height: 60px;
	padding: 8px 12px;
	border: 1px solid var(--chefit-border-light, #e5e7eb);
	border-radius: 14px;
	background: var(--chefit-bg-card, #fff);
	color: inherit;
	font-size: inherit;
	font-weight: inherit;
	text-align: right;
	white-space: normal;
}

#chefit-menu-picker-overlay button.chefit-menu-picker-item:hover,
#chefit-menu-picker-overlay button.chefit-menu-picker-item:focus-visible {
	border-color: var(--chefit-accent-600, #66b01c);
	background-color: var(--chefit-accent-50, #f3fbe9) !important;
}

#chefit-menu-picker-overlay button.chefit-menu-picker-item.is-current {
	border-color: var(--chefit-accent-600, #66b01c);
}

.chefit-menu-picker-view {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	margin-inline-start: auto;
	flex-shrink: 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--chefit-diary-green-deep, #4f7f12);
}

.chefit-menu-picker-view svg {
	width: 16px;
	height: 16px;
}

.chefit-menu-picker-badge {
	display: inline-block;
	margin-bottom: 12px;
	padding: 3px 10px;
	border-radius: 999px;
	background: var(--chefit-accent-50, #f3fbe9);
	color: var(--chefit-diary-green-deep, #4f7f12);
	font-size: 12px;
	font-weight: 700;
}

.chefit-menu-picker-cover {
	display: block;
	width: 100%;
	max-height: 180px;
	margin-bottom: 14px;
	border-radius: 14px;
	object-fit: cover;
}

.chefit-menu-picker-macros {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 8px;
	margin-bottom: 16px;
}

.chefit-menu-picker-macros > div {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 10px 4px;
	border-radius: 12px;
	background: var(--chefit-bg-muted, #f3f4f6);
	text-align: center;
}

.chefit-menu-picker-macros strong {
	font-size: 18px;
	font-weight: 800;
	line-height: 1.2;
}

.chefit-menu-picker-macros span {
	font-size: 11px;
	color: var(--chefit-text-muted, #6b7280);
}

.chefit-menu-picker-meal {
	margin-bottom: 14px;
}

.chefit-menu-picker-meal h3 {
	margin: 0 0 6px;
	font-size: 15px;
	font-weight: 800;
}

.chefit-menu-picker-meal ul {
	margin: 0;
	padding: 0;
	list-style: none;
	border: 1px solid var(--chefit-border-light, #e5e7eb);
	border-radius: 12px;
}

.chefit-menu-picker-meal li {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	padding: 9px 12px;
	font-size: 14px;
}

.chefit-menu-picker-meal li + li {
	border-top: 1px solid var(--chefit-border-light, #e5e7eb);
}

.chefit-menu-picker-meal li small {
	flex-shrink: 0;
	color: var(--chefit-text-muted, #6b7280);
}

.chefit-menu-picker-thumb {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border-radius: 10px;
	overflow: hidden;
	background: var(--chefit-bg-muted, #f3f4f6);
	color: var(--chefit-text-muted, #6b7280);
}

.chefit-menu-picker-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.chefit-menu-picker-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.chefit-menu-picker-text strong {
	font-size: 15px;
	font-weight: 700;
	overflow-wrap: anywhere;
}

.chefit-menu-picker-text small {
	font-size: 12px;
	color: var(--chefit-text-muted, #6b7280);
}

.chefit-menu-picker-empty {
	margin: 12px 0;
	text-align: center;
	color: var(--chefit-text-muted, #6b7280);
}
