/* ---------------------------------------------------
   FONTS
--------------------------------------------------- */
/* Upright (normal) variable font */
@font-face {
    font-family: 'Roboto';
    src: url('/new/assets/fonts/Roboto-VariableFont_wdth,wght.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-stretch: 75% 125%;
    font-style: normal;
    font-display: swap;
}

/* Italic variable font */
@font-face {
    font-family: 'Roboto';
    src: url('/new/assets/fonts/Roboto-Italic-VariableFont_wdth,wght.woff2') format('woff2-variations');
    font-weight: 100 900;
    font-stretch: 75% 125%;
    font-style: italic;
    font-display: swap;
}

/* ---------------------------------------------------
   THEME VARIABLES
--------------------------------------------------- */
:root {
	--accent: #cb001b;
	--header-bg: #e9e9e9;
	--header-border: #e5e5e5;
	--content-bg: #fafafa;
	--card-bg: #ffffff;
	--card-bg-alt: #f5f5f5;
	--text-dark: #222;
	--text-light: #ffffff;
	--border-color: #d0d0d0;
	--radius: 14px;
	--font: Roboto, sans-serif;
	--input-padding: 0.5rem .75rem;
	--btn-padding: 0.5rem;
}

body.dark {
	--accent: #cb001b;
	--header-bg: #1c1c1e;
	--header-border: #2c2c2e;
	--content-bg: #000000;
	--card-bg: #1c1c1e;
	--card-bg-alt: #2a2a2c;
	--text-dark: #ffffff;
	--text-light: #ffffff;
	--border-color: #3a3a3c;
}

/* ---------------------------------------------------
   GLOBAL
--------------------------------------------------- */
:root {
  --vh: 100vh;
}

html, body {
  margin: 0;
  padding: 0;
  padding-top: env(safe-area-inset-top);
  background: var(--content-bg);
	height: 100%;
}

body {
	height: calc(var(--vh) * 1);
	margin: 0;
	padding-top: 70px; /* Space for fixed header; adjust if header height changes */
	background: var(--content-bg);
	font-family: var(--font);
	color: var(--text-dark);
}

/* ---------------------------------------------------
   HEADINGS (h1-h6)
--------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 500;          /* Medium weight as requested */
  margin: 1.5rem 0 0.75rem;  /* Consistent spacing (top/bottom) */
  color: var(--text-dark);   /* Matches your theme */
  line-height: 1.3;          /* Tight but readable */
}

/* Size hierarchy (mobile-first, scales well with your 1rem base ~16px) */
h1 { font-size: 1.4rem; }   /* As specified (e.g., header title) */
h2 { font-size: 1.3rem; }   /* Modal titles, card titles */
h3 { font-size: 1.2rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1.0rem; }
h6 { font-size: 0.9rem; }

/* Optional: Larger headings on bigger screens for better hierarchy */
@media (min-width: 768px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.4rem; }
  h4 { font-size: 1.3rem; }
}

/* ---------------------------------------------------
   SPLASH SCREEN
--------------------------------------------------- */
#splash {
	position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding-top: env(safe-area-inset-top);
	inset: 0;
	background: #000;
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 9999;
	opacity: 1;
	transition: opacity 0.6s ease-out;
}

#splashLogo {
	width: 140px;
	height: 140px;
	animation: splashBounce 1.2s ease-out forwards;
}

/* Slight zoom bounce */
@keyframes splashBounce {
	0% {
		transform: scale(0.85);
		opacity: 0;
	}

	60% {
		transform: scale(1.05);
		opacity: 1;
	}

	100% {
		transform: scale(1);
	}
}

/* When fading out */
#splash.fade-out {
	opacity: 0;
	pointer-events: none;
}

/* ---------------------------------------------------
   Toast Message
--------------------------------------------------- */
.toast {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	padding: 1rem 1.4rem;
	border-radius: 12px;
	font-size: 0.9rem;
	text-align: center;
	opacity: 0;
	transition: opacity 0.6s ease-out;
	z-index: 9998;
}

.toast.show {
	opacity: 1;
}

.toast.hidden {
	display: none;
}

/* ---------------------------------------------------
   HEADER
--------------------------------------------------- */
.app-header {
	background: var(--header-bg);
	border-bottom: 1px solid var(--header-border);
	color: var(--text-dark);
	padding: 0.75rem 1rem;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100;
	padding-top: calc(0.75rem + env(safe-area-inset-top)); /* Handles notch */
}

.app-header h1 {
	margin: 0;
	font-size: 1.4rem;
	font-weight: 500;
	color: var(--text-dark);
}

.header-logo {
	width: 34px;
	height: 34px;
}

.header-actions {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.theme-btn,
.settings-btn,
.log-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.theme-btn svg,
.settings-btn svg,
.log-btn svg {
  stroke: var(--text-dark);
}

.settings-btn {
	position: relative;
}

.settings-badge {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 10px;
	height: 10px;
	background: #e53935;
	/* red */
	border-radius: 50%;
	box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.settings-badge.hidden {
	display: none;
}

/* ---------------------------------------------------
   CENTERED APP CONTAINER (main content + cards)
--------------------------------------------------- */
.app-container {
  max-width: 430px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

/* ---------------------------------------------------
   MAIN CARD
--------------------------------------------------- */
.card {
	background: var(--card-bg);
	padding: 1rem;
	border-radius: var(--radius);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
	width: calc(100% - 2rem);
	margin: 0;
}

.card-title {
	margin: 0 0 1rem;
	font-size: 1.3rem;
	font-weight: 500;
	text-align: center;
	color: var(--text-dark);
}

body.dark .card {
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

/* ---------------------------------------------------
   FORM ELEMENTS
--------------------------------------------------- */
.form-row {
	margin-bottom: 1rem;
}

label {
	font-weight: 500;
	display: block;
	margin-bottom: 0.25rem;
	color: var(--text-dark);
	padding-top: 15px;
}

/* INPUT + BUTTON WRAPPER */
.input-with-buttons {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

/* STEP BUTTONS */
.step-btn {
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: var(--radius);
	padding: var(--btn-padding);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.step-btn svg {
	stroke: var(--text-dark);
}

/* NUMBER INPUT */
.input-with-buttons input[type="number"] {
	flex: 1;
}

input[type="number"] {
	width: 100%;
	padding: var(--input-padding);
	font-size: 1rem;
	border-radius: var(--radius);
	border: 1px solid var(--border-color);
	background-color: var(--card-bg);
	color: var(--text-dark);
	margin-bottom: 0.25rem;
	box-sizing: border-box;
  	text-align: center;
  	-moz-appearance: textfield;  /* Firefox */
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  	-webkit-appearance: none;
  	margin: 0;  /* Sometimes needed for Chrome/Edge */
}

/* SELECT */
.select-wrapper {
	position: relative;
}

select {
	width: 100%;
	padding: var(--input-padding);
	font-size: 1rem;
	border-radius: var(--radius);
	border: 1px solid var(--border-color);
	background-color: var(--card-bg);
	color: var(--text-dark);
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	box-sizing: border-box;
	margin-bottom: 0.15rem;
}

.select-wrapper::after {
	content: "";
	position: absolute;
	right: 0.85rem;
	top: 50%;
	width: 7px;
	height: 7px;
	pointer-events: none;
	transform: translateY(-60%) rotate(45deg);

	/* Chevron down made from borders */
	border-right: 2px solid var(--text-dark);
	border-bottom: 2px solid var(--text-dark);
}

/* RANGE SLIDER */
input[type="range"] {
	width: 100%;
	-webkit-appearance: none;
	height: 6px;
	background: var(--border-color);
	border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 22px;
	height: 22px;
	background: var(--accent);
	border-radius: 50%;
	border: 2px solid var(--card-bg);
}

/* ---------------------------------------------------
   DOSE BUTTON & FAQ & COPYRIGHT LINKS
--------------------------------------------------- */
.dose-btn {
	width: 100px;
	height: 100px;
	border-radius: 60px;
	background: var(--accent);
	color: var(--text-light);
	border: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	text-align: center;
	padding: 0;

	/* Center the button */
	margin: 1rem auto 0;
}

.dose-number {
	font-size: 2.2rem;
	/* BIG number */
	font-weight: 700;
	line-height: 1;
}

.dose-units {
	font-size: 0.9rem;
	/* Smaller label */
	opacity: 0.9;
	/* Slightly softer */
	margin-top: 0.15rem;
}

.dose-note {
	text-align: center;
	font-size: 0.85rem;
	color: var(--text-dark);
	margin-top: 0.75rem;
	opacity: 0.85;
}

.copyright {
	text-align: center;
	font-size: 0.8rem;
	color: var(--text-dark);
	opacity: 0.7;
	margin: 1.5rem 0 1rem;
}

/* ---------------------------------------------------
   MODAL
--------------------------------------------------- */
.modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 9999;
	padding: 1rem;
	box-sizing: border-box;
	overflow-y: auto;
}

.modal > div {
	width: 100%;
	max-width: 430px;
	max-height: calc(100vh - 2rem);
	padding: 1rem;
	background: var(--card-bg);
	border-radius: var(--radius);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
	overflow-y: auto;
	box-sizing: border-box;
}

.hidden {
	display: none;
}

body.dark .modal > div {
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

/* ---------------------------------------------------
   ACCORDION
--------------------------------------------------- */
.accordion-item {
	border-bottom: 1px solid var(--border-color);
}

.accordion-header {
	padding: 0.75rem;
	font-weight: 500;
	cursor: pointer;
	background: var(--card-bg);
	color: var(--text-dark);
}

/* ACTIVE ACCORDION HEADER */
.accordion-header.active {
	background: var(--card-bg-alt);
	border-left: 4px solid var(--accent);
	padding-left: calc(0.75rem - 4px);
	/* keeps alignment perfect */
	color: var(--text-dark);
}

.accordion-content {
	padding: 0.75rem;
	display: none;
	background: var(--card-bg-alt);
	color: var(--text-dark);
}

.accordion-content.open {
	display: block;
}

/* SAVE BUTTON */
.save-btn {
	width: 100%;
	padding: var(--btn-padding);
	background: var(--accent);
	color: var(--text-light);
	border: none;
	border-radius: var(--radius);
	font-size: 1rem;
	margin-top: 1rem;
}

/* ---------------------------------------------------
   LOG MODAL
--------------------------------------------------- */

.log-card {
  padding: 1rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius);
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
}

.log-entry {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

.log-entry-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.log-entry-details {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  display: none;
}

.log-entry.open .log-entry-details {
  display: block;
}

.log-disclaimer {
  font-size: 0.7rem;
  opacity: 0.8;
  padding: 0.5rem 1rem 1rem;
}

/* Match header width to content container on mobile for visual symmetry */
@media (max-width: 480px) {
  .card {
    width: calc(100% - 2rem);  /* Full width minus side "margins" */
  }
}

/* Hide scrollbar in long modals on desktop, but keep scrolling (like mobile overlay) */
.modal > div {
  -ms-overflow-style: none;    /* IE and Edge */
  scrollbar-width: none;       /* Firefox */
}

.modal > div::-webkit-scrollbar {
  display: none;               /* Chrome, Safari, Edge */
}

/* ---------------------------------------------------
   MEAL BUILDER STYLES
--------------------------------------------------- */
/* Meal Builder - Current Meal Header */
.meal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin: 1rem 0 0.5rem;
}

.meal-header h3 {
	margin: 0;
	font-size: 1.1rem;
}

/* Header actions: group + and clear buttons */
.meal-header-actions {
	display: flex;
	gap: 0.75rem;
	align-items: center;
}

/* Red + Icon Button */
.add-food-icon-btn {
	background: rgba(100, 100, 100, 0.08) !important;
	border: none;
	cursor: pointer;
	padding: 0;
	border-radius: 50%;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;     /* Total button size */
	height: 40px;
}

.add-food-icon-btn:hover {
	background: rgba(100, 100, 100, 0.18) !important;
	transform: scale(1.08);
}

.add-food-icon-btn:active {
	transform: scale(0.98);
}

.add-food-icon-btn svg {
	stroke: var(--text-dark);
	pointer-events: none;
}

/* Compact Meal Entries - like log style */
.meal-entry {
	border-bottom: 1px solid var(--border-color);
	cursor: pointer;
}

.meal-entry:last-child {
	border-bottom: none;
}

.meal-entry-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem 0;
}

.meal-name {
	flex: 1;
	font-weight: 500;
	font-size: 1rem;
	padding-right: 0.5rem;
}

.meal-quick-info {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	font-size: 0.95rem;
}

.servings-input.compact {
	width: 50px;
	padding: 0.3rem;
	font-size: 0.9rem;
	text-align: center;
}

.item-total-carbs {
	min-width: 45px;
	text-align: right;
	font-weight: 500;
}

.remove-item-btn {
	background: none;
	border: none;
	color: #dc2626;
	font-size: 1.3rem;
	cursor: pointer;
	padding: 0 0.3rem;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background 0.2s;
}

.remove-item-btn:hover {
	background: rgba(220, 38, 38, 0.15);
}

.meal-entry-details {
	display: none;
	padding: 0.5rem 0 0.75rem 1rem;
	font-size: 0.85rem;
	opacity: 0.9;
	border-top: 1px dashed var(--border-color);
	margin-top: 0.5rem;
}

.meal-entry.open .meal-entry-details {
	display: block;
}

/* Total row now centered (no right aicons) */
.meal-total-row.centered {
	text-align: center;
	margin: 1rem 0;
	font-size: 1.1rem;
}

.cart-action-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.5rem;
	border-radius: 50%;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cart-action-btn:hover {
	background: rgba(100, 100, 100, 0.1);
	transform: scale(1.1);
}

.expand-chevron {
	font-size: 0.9rem;
	margin-right: 0.5rem;
	color: var(--text-dark);
	opacity: 0.7;
	transition: transform 0.2s ease;
	display: inline-block;
	width: 12px;
	text-align: center;
}

.meal-name-expand {
	display: flex;
	align-items: center;
	flex: 1;
	cursor: pointer;
	padding-right: 0.5rem;
}

/* Clear Cart - faded red, matching + button style */
.clear-cart-faded {
	background: rgba(220, 38, 38, 0.08);
	border: none;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	cursor: pointer;
}

.clear-cart-faded:hover {
	background: rgba(220, 38, 38, 0.18);
	transform: scale(1.08);
}

.clear-cart-faded:active {
	transform: scale(0.98);
}

.clear-cart-faded svg {
	pointer-events: none;
}

/* Food Tabs */
.food-tabs {
	display: flex;
	border-bottom: 1px solid var(--border-color);
	margin-bottom: 1rem;
}

.tab-btn {
	background: none;
	border: none;
	padding: 0.75rem 1rem;
	font-size: 1rem;
	cursor: pointer;
	color: var(--text-dark);
	opacity: 0.6;
	transition: all 0.2s;
}

.tab-btn.active {
	opacity: 1;
	border-bottom: 3px solid var(--accent);
	font-weight: 500;
}

.tab-btn[data-tab="favorites"] {
	font-size: 1.4rem; /* larger for heart only */
	padding: 0.75rem 1.2rem;
}

/* Tab Content */
.tab-content {
	display: none;
}

.tab-content.active {
	display: block;
}

/* Search Container */
.search-container {
	position: relative;
	margin-bottom: 0.5rem;
}

#favoritesSearch {
	width: 100%;
	padding: var(--input-padding);
	padding-right: 2.5rem !important;
	font-size: 1rem;
	border-radius: var(--radius);
	border: 1px solid var(--border-color);
	background: var(--card-bg);
	color: var(--text-dark);
	box-sizing: border-box;
}

.edit-favorites-btn {
	position: absolute;
	right: 0.5rem;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.5rem;
	border-radius: 50%;
	transition: background 0.2s;
}

.edit-favorites-btn:hover {
	background: rgba(100, 100, 100, 0.1);
}

/* Favorites Results */
#favoritesResults {
	max-height: 300px;
	overflow-y: auto;
}

.favorite-result {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem;
	background: var(--card-bg-alt);
	margin-bottom: 0.5rem;
	border-radius: var(--radius);
}

.favorite-result span {
	flex: 1;
}

.favorite-result button {
	background: var(--accent);
	color: white;
	border: none;
	padding: 0.4rem 0.8rem;
	border-radius: 6px;
	font-size: 0.9rem;
	cursor: pointer;
}

.tab-btn[data-tab="favorites"] {
	padding: 0.75rem 1.5rem;
	font-size: 0; /* hide any text */
}

.modal-footer {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-top: 1.5rem;
	gap: 1rem;
}

/* FAQ Accordion Styles - Clean, readable, matches typical app themes */
.faq-accordion .faq-item {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #eee; /* subtle light separator; adjust if your app uses different borders */
}

.faq-accordion .faq-question {
    cursor: pointer;
    padding: 0.85rem 0;
    font-weight: 600;
    font-size: 1rem; /* standard readable size */
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color, #333);
    user-select: none;
}

.faq-accordion .faq-question::after {
    content: '+';
    font-size: 1.4rem;
    color: #666;
    margin-left: 0.5rem;
}

.faq-accordion .faq-question.active::after {
    content: '−';
}

.faq-accordion .faq-answer {
    display: none;
    padding-bottom: 1rem;
    font-size: 0.95rem; /* easy to read but not large */
    line-height: 1.55;
    color: var(--text-color, #444);
}

.faq-accordion .faq-answer ul {
    margin: 0.75rem 0;
    padding-left: 1.4rem;
}

.faq-accordion .faq-answer strong {
    color: var(--text-color, #222);
}

.faq-accordion .faq-answer p:last-child {
    margin-bottom: 0;
}

.faq-link-row {
	display: flex;
	justify-content: center;
	align-items: center;
	margin: 2rem 0 1rem 0; /* more space above, less below */
	padding: 0 1rem;
}

.footer-links-group {
	display: flex;
	align-items: center;
	gap: 1rem;
	color: var(--accent);
}

.footer-link {
	color: var(--accent);
	text-decoration: none;
	font-size: 1rem;
}

.footer-link:hover {
	text-decoration: underline;
}

.separator {
	color: inherit;
	opacity: 0.6;
}

#carbCalcModal .footer-link {
	display: block;
	text-align: center;
	margin: 1.5rem auto 0 auto;
	width: fit-content;
}

/* Favorites Manager */
#managerFavoritesList .favorite-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem;
	background: var(--card-bg-alt);
	margin-bottom: 0.5rem;
	border-radius: var(--radius);
}

#managerFavoritesList .favorite-info {
	flex: 1;
}

#managerFavoritesList .favorite-actions {
	display: flex;
	gap: 0.5rem;
}

#managerFavoritesList button {
	background: var(--accent);
	color: white;
	border: none;
	padding: 0.4rem 0.8rem;
	border-radius: 6px;
	font-size: 0.9rem;
	cursor: pointer;
}

#managerFavoritesList button.delete {
	background: #dc2626;
}

/* Favorites Manager Search - match other inputs */
#managerSearch {
	width: 100%;
	padding: var(--input-padding);
	font-size: 1rem;
	border-radius: var(--radius);
	border: 1px solid var(--border-color);
	background: var(--card-bg);
	color: var(--text-dark);
	box-sizing: border-box;
	margin-bottom: 1rem; /* spacing below */
	transition: border 0.2s;
}

#managerSearch:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(203, 0, 27, 0.2); /* subtle accent glow */
}

#managerSearch::placeholder {
	color: var(--text-dark);
	opacity: 0.6;
}

/* Database Search - match Favorites style */
#databaseSearch {
	width: 100%;
	padding: var(--input-padding);
	font-size: 1rem;
	border-radius: var(--radius);
	border: 1px solid var(--border-color);
	background: var(--card-bg);
	color: var(--text-dark);
	box-sizing: border-box;
	margin-bottom: 1rem;
	transition: border 0.2s;
}

#databaseSearch:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(203, 0, 27, 0.2);
}

#databaseSearch::placeholder {
	color: var(--text-dark);
	opacity: 0.6;
}

/* Placeholder add button (same as favorites +) */
.add-placeholder {
	background: var(--accent);
	color: white;
	border: none;
	padding: 0.4rem 0.8rem;
	border-radius: 6px;
	font-size: 0.9rem;
	cursor: pointer;
	transition: background 0.2s;
}

.add-placeholder:hover {
	background: #a50014;
}

/* Consistent red focus glow for ALL main inputs */
#bsInput,
#carbInput,
#favoritesSearch,
#databaseSearch,
#managerSearch,
.servings-input.compact {
	transition: border 0.2s, box-shadow 0.2s;
}

#bsInput:focus,
#carbInput:focus,
#favoritesSearch:focus,
#databaseSearch:focus,
#managerSearch:focus,
.servings-input.compact:focus {
	outline: none;
	border-color: var(--accent) !important; /* #cb001b */
	box-shadow: 0 0 0 3px rgba(203, 0, 27, 0.2) !important; /* soft red glow */
}

/* Consistent red focus glow for dropdowns (select) */
select#meal {
	transition: border 0.2s, box-shadow 0.2s;
}

/* Focus state for the meal dropdown */
select#meal:focus {
	outline: none;
	border-color: var(--accent) !important;
	box-shadow: 0 0 0 3px rgba(203, 0, 27, 0.2) !important;
}

/* Optional: Style the dropdown arrow to match theme */
.select-wrapper::after {
	border-top-color: var(--text-dark);
}

/* When focused, make arrow accent-colored too (optional polish) */
select#meal:focus + .select-wrapper::after {
	border-top-color: var(--accent);
}

/* Consistent red focus glow for Log Range dropdown */
#logRangeSelect {
	transition: border 0.2s, box-shadow 0.2s;
	border: 1px solid var(--border-color);
	border-radius: var(--radius);
	background: var(--card-bg);
	color: var(--text-dark);
	padding: var(--input-padding);
	font-size: 1rem;
	width: 100%;
	box-sizing: border-box;
}

/* Focus state */
#logRangeSelect:focus {
	outline: none;
	border-color: var(--accent) !important;
	box-shadow: 0 0 0 3px rgba(203, 0, 27, 0.2) !important;
}

.label-with-calc {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 0.5rem;
}

.label-with-calc label {
	margin: 0;
	font-weight: 500;
}

.calc-icon-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.4rem;
	border-radius: 50%;
	transition: background 0.2s;
}

.calc-icon-btn:hover {
	background: rgba(203, 0, 27, 0.1);
}

.calc-icon-btn svg {
	stroke: var(--accent); /* red */
	display: block;
}

/* Carb Calculator Modal */
.carb-calculator {
	margin-top: 1rem;
}

/* Display row (AC + output) */
.calc-display {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
	align-items: stretch;
}

#calcAC {
	background: var(--accent);
	color: white;
	border: none;
	border-radius: var(--radius);
	padding: var(--btn-padding);
	font-size: 1.1rem;
	font-weight: bold;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

#calcAC:hover {
	background: #a50014;
}

#calcOutput {
	flex: 1;
	background: var(--card-bg-alt);
	border-radius: var(--radius);
	padding: var(--input-padding);
	font-size: 1.6rem;
	font-weight: 500;
	color: var(--text-dark);
	text-align: right;
	display: flex;
	align-items: center;
	justify-content: flex-end;
}

/* Grid including = button */
.calc-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.5rem;
}

.calc-grid .calc-btn {
	background: var(--card-bg);
	border: 1px solid var(--border-color);
	border-radius: var(--radius);
	padding: var(--btn-padding);
	font-size: 1.2rem;
	font-weight: 500;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
	color: var(--text-dark) !important;
}

.calc-grid .calc-btn:hover {
	background: var(--card-bg-alt);
}

.calc-grid .calc-btn.op {
	font-size: 1.4rem;
	font-weight: bold;
}

/* Equals button spans all 4 columns */
.calc-grid .equals {
	grid-column: span 4;
	background: var(--accent);
	color: white !important;
	font-size: 1.5rem;
	font-weight: bold;
}

.calc-grid .equals:hover {
	background: #a50014;
}
