/* ==========================================================================
   Shopping List Template – FeedMeFood
   Uses only the 7 theme vars from custom.css. All other colours are literal.
   ========================================================================== */

/* ── Page & panel ──────────────────────────────────────────────────────── */
.sl-page {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    background: var(--white-color);
    min-height: calc(100vh - 120px);
    padding: 48px 16px;
}
.sl-panel--auth { display: flex; align-items: center; justify-content: center; min-height: 200px; }
.sl-auth-notice { font-size: 15px; color: #6b7280; text-align: center; }
.sl-auth-notice a { color: var(--green-color); font-weight: 600; }
#sl-body {
    width: 100%;
    margin: 0 auto;
    max-width: 722px;
}

/* ── Page header ───────────────────────────────────────────────────────── */
.sl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    gap: 12px;
    margin-bottom: 8px;
}
.sl-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--semi-black);
    margin: 0;
    line-height: 1.53;
    font-family: var(--header-font);
}
.sl-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.sl-mark-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--green-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 16px;
    line-height: 1;
    transition: opacity 0.3s;
    white-space: nowrap;
    font-family: var(--header-font);
}
.sl-mark-btn:hover { opacity: 0.72; }
.sl-mark-btn:disabled { opacity: 0.35; cursor: default; }

/* Double-check icon only shown on desktop alongside "Mark all complete". */
.sl-mark-btn-icon { display: none; width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
@media (min-width: 1200px) { .sl-mark-btn-icon { display: inline-block; } }


/* ── 3-dot dropdown (header menu) ──────────────────────────────────────── */
.sl-dots-wrap { position: relative; }
.sl-dots-btn {
    width: 34px;
    height: 34px;
    display: flex;
    gap: 2px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    color: var(--green-color);
    transition: background 0.15s;
    padding: 0;
}
.sl-dots-btn span {
    height: 4px;
    width: 4px;
    background-color: var(--green-color);
    border-radius: 4px;
}
.sl-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 200;
    min-width: 158px;
    display: none;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #939393;
    background: var(--white-color);
    box-shadow: 4px 8px 16px 0 rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    gap: 8px;
	padding: 12px;
}
.sl-dropdown.is-open { display: flex; }

.sl-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    color: var(--semi-black);
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
    line-height: 1.4;
    font-family: var(--header-font);
}
.sl-dropdown-item:hover { font-weight: 700; }
.sl-dropdown-item--danger { color: #c0392b; }


/* ── Banners ───────────────────────────────────────────────────────────── */
.sl-banner {
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
}
.sl-banner--upgrade {
    border-radius: 12px;
    background: #FFF2D5;
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
    flex-wrap: wrap;
}
.sl-banner--upgrade .sl-banner-text {
    color: var(--semi-black);
    font-family: var(--header-font);
    font-size: 14px;
    line-height: 18px;
    letter-spacing: -0.076px;
    margin: 0;
}
.sl-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    margin-left: auto;
}
.sl-banner-dismiss, .sl-banner-upgrade-link, .sl-text-btn {
    font-size: 14px;
    color: var(--green-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-weight: 700;
    transition: opacity 0.2s;
    font-family: var(--header-font);
}
.sl-banner-dismiss:hover { opacity: 0.72; }

/* Success (premium "all done") and info (free upsell / new-week) banners
   use a neutral soft-gray background per Figma — green tone is reserved
   for the circle-check icon, not the background. */
.sl-banner--success,
.sl-banner--info { background: #EFEFEF; display: flex; align-items: flex-start; gap: 10px; }

.sl-banner-icon { flex-shrink: 0; color: var(--green-color); margin-top: 1px; line-height: 0; }
.sl-banner-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; }

.sl-banner-body { flex: 1; min-width: 0; }
.sl-banner-title {
    color: var(--semi-black);
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.28;
    font-family: var(--header-font);
}
.sl-banner-links {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: end;
}
.sl-banner-link {
    color: var(--green-color);
    font-weight: 700;
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.2s;
    font-family: var(--header-font);
}
.sl-banner-link:hover { opacity: 0.72; }


/* ── Stats + progress ──────────────────────────────────────────────────── */
.sl-meta-row, .sl-progress > span {
    margin: 0;
    color: var(--semi-black);
    font-family: var(--header-font);
    font-size: 12px;
    line-height: 16px;
    letter-spacing: -0.076px;
    margin-bottom: 4px;
}
.sl-progress {
    margin-bottom: 12px;
}
.sl-progress > span { display: block;}
.sl-progress-track { width: 100%; height: 8px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.sl-progress-fill { height: 100%; background: var(--green-color); border-radius: 99px; transition: width 0.4s ease; }


/* ── Show purchased toggle ─────────────────────────────────────────────── */
.sl-show-purchased {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: var(--semi-black);
	user-select: none;
	transition: background 0.12s;
	font-family: var(--header-font);
	border-radius: 8px;
}
.sl-show-purchased:hover { background: #E2EBE8;}
.sl-show-purchased--checked .sl-checkbox { background: var(--green-color); border-color: var(--green-color); }
.sl-show-purchased--checked .sl-check-icon { display: block; }


/* ── List & items ──────────────────────────────────────────────────────── */
.sl-list { list-style: none; margin: 0; padding: 0; }

/* <li> wrapper — block-level so the inline accordion sheet can sit below the row.
   Border uses a slightly darker gray (#d1d5db) so it stays visible on the
   hover/active background (#E2EBE8). */
.sl-item {
	cursor: pointer;
	position: relative;
	transition: background 0.12s;
	padding: 0 16px;
	border-radius: 8px;
}
.sl-item:last-child { border-bottom: none; }
.sl-item-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 0;
}
/* Hover & active states share the same soft green background. */
.sl-item:hover, .sl-item--active { background: #E2EBE8; }
@media screen and (max-width: 575px){
	#sl-list, #sl-show-purchased {
		margin: 0 -16px;
	}
	.sl-item {
		border-radius: 0;
	}
	
}
/* Checkbox */
.sl-checkbox {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--green-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    transition: background 0.15s, border-color 0.15s;
    background: var(--white-color);
}
.sl-item--checked .sl-checkbox { background: var(--green-color); border-color: var(--green-color); }
.sl-check-icon { display: none; width: 12px; height: 12px; fill: var(--white-color); }
.sl-item--checked .sl-check-icon { display: block; }


/* Item content */
.sl-item-body { flex: 1; min-width: 0; }
.sl-item-name {
    color: var(--semi-black);
    margin: 0 0 2px;
    font-family: var(--header-font);
}
.sl-item-qty { font-weight: 700; }
.sl-item--checked .sl-item-name { text-decoration: line-through; color: #6b7280; }
.sl-item-source {
    font-size: 12px;
    color: #666;
    margin: 0;
    line-height: 1.3;
    font-family: var(--header-font);
}
.sl-item-pantry { font-size: 12px; color: var(--green-color); margin: 3px 0 0; line-height: 1.4; }


/* Premium: 3-dot button */
.sl-options-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; border-radius: 50%; color: #6b7280; flex-shrink: 0; transition: background 0.12s, color 0.12s; }
.sl-options-btn:hover { background: #e5e7eb; color: var(--semi-black); }
.sl-options-btn svg { width: 4px; height: 14px; fill: currentColor; }

/* Free: direct trash button */
.sl-delete-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; border-radius: 4px; color: var(--green-color); flex-shrink: 0; transition: opacity 0.15s; padding: 0; }
.sl-delete-btn:hover { opacity: 0.7; }
.sl-delete-btn svg { width: 16px; height: 18px; fill: currentColor; }
/* Checked items don't need an action button — the user has already "completed" them. */
.sl-item--checked .sl-delete-btn,
.sl-item--checked .sl-options-btn { display: none; }


/* ── Empty state ───────────────────────────────────────────────────────── */
.sl-empty { background: #eaf5f0; border-radius: 14px; padding: 44px 24px; text-align: center; margin: 16px 0; }
.sl-empty-title { font-size: 16px; font-weight: 700; color: var(--semi-black); margin: 0 0 10px; font-family: var(--header-font); }
.sl-empty-desc { font-size: 14px; color: #6b7280; margin: 0 auto 26px; line-height: 1.55; max-width: 280px; font-family: var(--body-font); }
.sl-empty-cta { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--green-color); color: var(--green-color); font-size: 14px; font-weight: 600; border-radius: 24px; padding: 12px 28px; text-decoration: none; transition: all 0.2s; font-family: var(--header-font); }
.sl-empty-cta:hover { background: var(--green-color); color: var(--white-color); text-decoration: none; }
.sl-empty-cta svg { fill: currentColor; }


/* ── Add Ingredient pill button (desktop header) ───────────────────────── */
.sl-add-btn {
    font-family: var(--header-font);
    border: 2px solid var(--green-color);
    color: var(--green-color);
    background-repeat: no-repeat;
    background-position: left 22px center;
    font-weight: 700;
    padding: 10px 24px 10px 24px;
    transition: 0.3s;
    border-radius: 24px;
    margin-right: 8px;
    background-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sl-add-btn:hover { background: var(--green-color); color: var(--white-color); }

.sl-add-btn--header { display: none; }
@media (min-width: 1200px) { .sl-add-btn--header { display: inline-flex; } }


/* ── Mobile bottom add bar — slides down on scroll-down ────────────────── */
.sl-add-bar {
    position: fixed;
    bottom: 65px;
    left: 0;
    right: 0;
    background: var(--white-color);
    border-top: 1px solid #808080;
    padding: 11px 16px 12px;
    z-index: 100;
    transform: translateY(0);
    transition: transform 0.3s ease;
    width: 100%;
}
.sl-add-bar.is-hidden {
    transform: translateY(calc(100% + -8px));
}
.sl-add-bar-container {
    max-width: 700px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
@media (min-width: 1200px) {
	.sl-add-bar { display: none; }
}
.sl-add-input {
    flex: 1;
    border-radius: 4px;
    border: 1px solid #B5B5B5;
    background: #FFF;
    padding: 12px 16px;
    color: var(--green-color);
    font-family: var(--header-font);
    outline: none;
}
.sl-add-input::placeholder { color: #939393; }
.sl-add-submit {
    background: none;
    border: 2px solid var(--green-color);
    color: var(--green-color);
    border-radius: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: var(--header-font);
    padding: 10px 22px;
}
.sl-add-submit:hover { background: var(--green-color); color: var(--white-color); }


/* ── Confirmation modals ───────────────────────────────────────────────── */
.sl-modal { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; padding: 24px; }
.sl-modal.is-open { display: flex; }
.sl-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.38); }
.sl-modal-box {
    position: relative;
    z-index: 1;
    background: var(--white-color);
    border-radius: 24px;
    padding: 16px;
    max-width: 343px;
    width: 100%;
}
.sl-modal-title, .sl-modal-subtitle {
    font-size: 16px;
    font-weight: 700;
    color: var(--semi-black);
    font-family: var(--header-font);
    margin: 0;
}
p.sl-modal-subtitle {
    font-weight: 400;
}
.sl-modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    margin-top: 24px;
}
.sl-modal-cancel {
    font-weight: 700;
    color: var(--green-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 16px;
    font-family: var(--header-font);
    transition: opacity 0.2s;
}
.sl-modal-cancel:hover { opacity: 0.72; }
.sl-modal-confirm {
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    cursor: pointer;
    color: var(--white-color);
    transition: opacity 0.2s;
    font-family: var(--header-font);
}
.sl-modal-confirm:hover { opacity: 0.88; }
.sl-modal-confirm--green { background: var(--green-color); }
.sl-modal-confirm--red {
    background: #B51111;
}
/* Add Ingredient modal input (desktop) */
.sl-modal-input {
    width: 100%;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--semi-black);
    background: var(--white-color);
    margin: 14px 0 0;
    outline: none;
    box-sizing: border-box;
    font-family: var(--body-font);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.sl-modal-input::-webkit-input-placeholder { color: #aab0b8; }
.sl-modal-input::placeholder { color: #aab0b8; }


/* ── Inline accordion sheet (premium 3-dot) ────────────────────────────── */
/* Open: insert with no .is-open → reflow → add .is-open (max-height transitions 0→content).
   Close: remove .is-open (max-height transitions back to 0) → DOM removal after duration. */
.sl-item-sheet {
	border-top: 1px solid #d1d5db;
	padding: 0;
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.3s ease;
}
.sl-item-sheet.is-open { max-height: 400px; }
.sl-sheet-label {
	font-size: 12px;
	color: var(--semi-black);
	text-transform: uppercase;
	font-family: var(--header-font);
	line-height: 1.333;
	margin: 8px 0 0 0;
}
.sl-sheet-action {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	font-size: 14px;
	color: var(--black-color);
	cursor: pointer;
	border: none;
	background: none;
	width: 100%;
	text-align: left;
	transition: opacity 0.12s;
	font-family: var(--body-font);
	padding: 8px 0;
	line-height: 1.28;
}
.sl-sheet-action:hover { opacity: 0.72; }
.sl-sheet-action-row { display: flex; align-items: center; gap: 10px; }
.sl-sheet-action-row svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }
.sl-sheet-action-desc {
	font-size: 12px;
	color: #666;
	margin-top: 1px;
	line-height: 1.33;
}
.sl-sheet-cancel-wrap {
	text-align: center;
}
.sl-sheet-cancel {
	font-size: 14px;
	font-weight: 700;
	color: var(--green-color);
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px;
	font-family: var(--header-font);
	transition: opacity 0.12s;
}
.sl-sheet-cancel:hover { opacity: 0.72; }


/* ── Loading skeleton ──────────────────────────────────────────────────── */
.sl-skeleton { padding: 8px 0 4px; }
.sl-skeleton-bar { height: 15px; background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%); background-size: 200% 100%; animation: sl-shimmer 1.4s infinite; border-radius: 4px; margin-bottom: 13px; }
.sl-skeleton-bar--short { width: 55%; }

@keyframes sl-shimmer {
	0%   { background-position:  200% 0; }
	100% { background-position: -200% 0; }
}


/* ── Loading state ─────────────────────────────────────────────────────── */
#sl-app.sl-loading .sl-mark-btn,
#sl-app.sl-loading .sl-dots-btn,
#sl-app.sl-loading .sl-add-submit { pointer-events: none; opacity: 0.45; }



@media screen and (max-width: 1199px){
	#sl-body {
		max-width: 700px;
	}
}
@media screen and (max-width: 767px){
	.sl-page {
		padding: 0 16px 48px;
	}
	.sl-title {
		font-size: 21px;
	}
	.sl-dots-btn {
		flex-direction: row;
		width: 24px;
		height: 24px;
	}
	.sl-mark-btn {
		padding: 12px 0;
	}
	.sl-header {
		margin: 0;
	}
	.sl-banner {
		margin: 0 0 12px;
	}
	p.sl-item-name {
		color: var(--black-color);
	}
}



/* ── Print ─────────────────────────────────────────────────────────────── */
@media print {
	@page { margin: 1.2cm; }

	/* Hide every element on the page first */
	body * { visibility: hidden !important; }

	/* Then reveal ONLY the shopping list page and its descendants */
	.sl-page, .sl-page * { visibility: visible !important; }

	/* Pull .sl-page out of the document flow so hidden siblings can't push it
	   off-screen or onto blank pages */
	html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; min-height: 0 !important; height: auto !important; overflow: visible !important; }

	.sl-page {
		position: absolute !important;
		left: 0 !important;
		top: 0 !important;
		right: 0 !important;
		width: 100% !important;
		max-width: none !important;
		min-height: 0 !important;
		height: auto !important;
		margin: 0 !important;
		padding: 0 !important;
		background: #fff !important;
	}
	.sl-panel { padding: 0 !important; min-height: 0 !important; height: auto !important; }
	#sl-body { max-width: none !important; margin: 0 !important; padding: 0 !important; }

	/* Hide interactive controls + dynamic UI inside .sl-page */
	.sl-header-actions,
	.sl-add-bar,
	.sl-options-btn,
	.sl-delete-btn,
	.sl-banner,
	.sl-show-purchased,
	.sl-meta-row,
	.sl-progress,
	.sl-item-sheet,
	.sl-skeleton,
	.sl-modal { display: none !important; }

	/* Title */
	.sl-header { display: block !important; margin: 0 0 0.6cm !important; padding: 0 !important; }
	.sl-title { font-size: 22pt !important; color: #000 !important; visibility: visible !important; }

	/* Items — flat layout, clean borders, page-break safe */
	.sl-list { display: block !important; }
	.sl-item { display: block !important; background: transparent !important; margin: 0 !important; padding: 0 !important; border-bottom: 1px solid #999 !important; page-break-inside: avoid; }
	.sl-item-row { display: flex !important; padding: 8pt 0 !important; gap: 10pt !important; }
	.sl-item-name { font-size: 11pt !important; color: #000 !important; }
	.sl-item-source { font-size: 9pt !important; color: #555 !important; }
	.sl-item--checked .sl-item-name { text-decoration: line-through; color: #888 !important; }

	/* Checkbox — force colours so checked items show black squares on paper */
	.sl-checkbox { width: 14pt !important; height: 14pt !important; min-width: 14pt !important; border: 1.5pt solid #333 !important; background: #fff !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
	.sl-item--checked .sl-checkbox { background: #000 !important; border-color: #000 !important; -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
	.sl-check-icon { display: block !important; fill: #fff !important; }
}


/* ── Utility ───────────────────────────────────────────────────────────── */
.sl-hidden { display: none !important; }
