/* Mobile grocery list enhancements for CookCLI static site */

.grocery-ingredient-li {
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.grocery-ingredient-li .grocery-check {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.5rem;
  accent-color: #ea580c;
  cursor: pointer;
}

.grocery-ingredient-li.is-unchecked {
  opacity: 0.55;
}

.grocery-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.recipe-scale-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid #fed7aa;
  background: linear-gradient(to right, #fff7ed, #fefce8);
}

.recipe-scale-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #9a3412;
}

.recipe-scale-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.recipe-scale-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: 1px solid #fdba74;
  background: #fff;
  color: #c2410c;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.recipe-scale-btn:active {
  transform: scale(0.96);
  background: #ffedd5;
}

.recipe-scale-input {
  width: 3.25rem;
  height: 2rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #9a3412;
  border: 1px solid #fdba74;
  border-radius: 0.5rem;
  background: #fff;
  -moz-appearance: textfield;
}

.recipe-scale-input::-webkit-outer-spin-button,
.recipe-scale-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.recipe-scale-base {
  font-size: 0.75rem;
  color: #78716c;
  font-weight: 600;
}

.dark .recipe-scale-bar {
  background: linear-gradient(to right, #1f2937, #111827);
  border-color: #4b5563;
}

.dark .recipe-scale-label {
  color: #fdba74;
}

.dark .recipe-scale-btn,
.dark .recipe-scale-input {
  background: #374151;
  border-color: #4b5563;
  color: #fdba74;
}

.dark .recipe-scale-base {
  color: #9ca3af;
}

.grocery-toolbar button,
.grocery-actions button {
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #c2410c;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.grocery-toolbar button.grocery-primary,
.grocery-actions button.grocery-primary {
  background: linear-gradient(to right, #f97316, #eab308);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.grocery-toolbar button:active,
.grocery-actions button:active {
  transform: scale(0.98);
}

.grocery-hint {
  font-size: 0.75rem;
  color: #78716c;
  margin-bottom: 0.75rem;
}

.grocery-hint a,
.grocery-sub a,
.grocery-empty a,
.grocery-inline-link {
  color: #ea580c;
  font-weight: 600;
  text-decoration: underline;
}

.grocery-inline-link {
  align-self: center;
  font-size: 0.875rem;
}

.grocery-nav-link {
  position: relative;
}

.grocery-badge {
  display: none;
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.25rem;
  border-radius: 9999px;
  background: #ea580c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}

.grocery-badge.is-visible {
  display: inline-block;
}

.grocery-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(120%);
  background: #1f2937;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 60;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  max-width: calc(100vw - 2rem);
  text-align: center;
  pointer-events: none;
}

.grocery-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.grocery-page {
  max-width: 40rem;
  margin: 0 auto;
}

.grocery-page h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #ea580c, #ca8a04);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.grocery-page .grocery-sub {
  color: #57534e;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.grocery-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.grocery-add-form {
  margin-bottom: 1rem;
}

.grocery-add-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #9a3412;
  margin-bottom: 0.4rem;
}

.grocery-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.grocery-add-name,
.grocery-add-qty {
  font-size: 1rem;
  line-height: 1.25rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #fdba74;
  background: #fff;
  color: #1c1917;
  min-width: 0;
}

.grocery-add-name {
  flex: 1 1 10rem;
}

.grocery-add-qty {
  flex: 0 1 5.5rem;
  width: 5.5rem;
}

.grocery-add-form button {
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.55rem 0.9rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: linear-gradient(to right, #f97316, #eab308);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.grocery-add-form button:active {
  transform: scale(0.98);
}

.grocery-empty {
  padding: 1.5rem;
  border-radius: 1rem;
  background: #fff7ed;
  border: 1px dashed #fdba74;
  color: #9a3412;
  text-align: center;
}

.grocery-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.grocery-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  background: linear-gradient(to right, #fff7ed, #fefce8);
  border: 1px solid #fed7aa;
}

.grocery-list li.is-bought {
  opacity: 0.55;
}

.grocery-list li.is-bought .grocery-item-text {
  text-decoration: line-through;
}

.grocery-list input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  accent-color: #ea580c;
}

.grocery-item-text {
  flex: 1;
  min-width: 0;
}

.grocery-item-name {
  font-weight: 600;
  color: #1c1917;
}

.grocery-item-qty {
  color: #c2410c;
  font-weight: 700;
  margin-left: 0.35rem;
}

.grocery-item-remove {
  border: none;
  background: transparent;
  color: #a8a29e;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.dark .grocery-toolbar button,
.dark .grocery-actions button {
  background: #374151;
  border-color: #4b5563;
  color: #fdba74;
}

.dark .grocery-toolbar button.grocery-primary,
.dark .grocery-actions button.grocery-primary {
  background: linear-gradient(to right, #ea580c, #ca8a04);
  color: #fff;
  border-color: transparent;
}

.dark .grocery-hint,
.dark .grocery-page .grocery-sub {
  color: #9ca3af;
}

.dark .grocery-add-label {
  color: #fdba74;
}

.dark .grocery-add-name,
.dark .grocery-add-qty {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

.dark .grocery-empty {
  background: #1f2937;
  border-color: #4b5563;
  color: #fdba74;
}

.dark .grocery-list li {
  background: linear-gradient(to right, #1f2937, #111827);
  border-color: #4b5563;
}

.dark .grocery-item-name {
  color: #f9fafb;
}

.grocery-aisle-heading {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9a3412;
  margin: 1.25rem 0 0.5rem;
}

.grocery-list-wrap .grocery-aisle-heading:first-child {
  margin-top: 0;
}

.grocery-recipe-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.grocery-recipe-bar-label {
  font-size: 0.8rem;
  color: #78716c;
  font-weight: 600;
}

.grocery-recipe-chip {
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 0.35rem 0.55rem;
  border-radius: 0.5rem;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 600;
  cursor: pointer;
}

.plan-page {
  padding-bottom: 5.5rem;
}

.plan-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.plan-toolbar button {
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #c2410c;
  font-weight: 600;
  cursor: pointer;
}

.plan-chapter {
  margin-bottom: 1.5rem;
}

.plan-chapter-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #9a3412;
  margin-bottom: 0.5rem;
}

.plan-recipe-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.plan-recipe-li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid #fed7aa;
  background: linear-gradient(to right, #fff7ed, #fefce8);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.plan-recipe-li.is-selected {
  border-color: #ea580c;
  box-shadow: inset 0 0 0 1px #ea580c;
}

.plan-recipe-li input[type='checkbox'] {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  accent-color: #ea580c;
}

.plan-recipe-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.plan-recipe-name {
  font-weight: 700;
  color: #1c1917;
}

.plan-recipe-meta {
  font-size: 0.75rem;
  color: #78716c;
}

.plan-recipe-open {
  font-size: 0.8rem;
  font-weight: 600;
  color: #ea580c;
  text-decoration: underline;
  flex-shrink: 0;
}

.plan-sticky-bar {
  position: sticky;
  bottom: 0.75rem;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: #1f2937;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.plan-sticky-count {
  font-size: 0.9rem;
  font-weight: 600;
}

.plan-sticky-bar button.grocery-primary {
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.5rem;
  border: none;
  background: linear-gradient(to right, #f97316, #eab308);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.plan-sticky-bar button.grocery-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.grocery-loading {
  color: #78716c;
  font-size: 0.95rem;
}

.dark .grocery-aisle-heading,
.dark .plan-chapter-title {
  color: #fdba74;
}

.dark .grocery-recipe-chip,
.dark .plan-toolbar button {
  background: #374151;
  border-color: #4b5563;
  color: #fdba74;
}

.dark .plan-recipe-li {
  background: linear-gradient(to right, #1f2937, #111827);
  border-color: #4b5563;
}

.dark .plan-recipe-li.is-selected {
  border-color: #fb923c;
  box-shadow: inset 0 0 0 1px #fb923c;
}

.dark .plan-recipe-name {
  color: #f9fafb;
}

.dark .plan-recipe-meta,
.dark .grocery-recipe-bar-label,
.dark .grocery-loading {
  color: #9ca3af;
}

.grocery-copy-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: rgba(28, 25, 23, 0.45);
}

.grocery-copy-sheet-panel {
  width: min(28rem, 100%);
  max-height: min(85vh, 40rem);
  overflow: auto;
  padding: 1.1rem 1rem 1rem;
  border-radius: 1rem 1rem 0.75rem 0.75rem;
  background: #fff;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
}

.grocery-copy-sheet-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #9a3412;
}

.grocery-copy-sheet-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #57534e;
}

.grocery-copy-sheet-text {
  display: block;
  width: 100%;
  min-height: 10rem;
  margin: 0 0 0.85rem;
  padding: 0.75rem;
  border-radius: 0.65rem;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #1c1917;
  font-size: 0.95rem;
  line-height: 1.4;
  resize: vertical;
  -webkit-user-select: text;
  user-select: text;
}

.grocery-copy-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.grocery-copy-sheet-actions button {
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #c2410c;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.grocery-copy-sheet-actions button.grocery-primary {
  background: linear-gradient(to right, #f97316, #eab308);
  border-color: transparent;
  color: #fff;
}

.dark .grocery-copy-sheet-panel {
  background: #1f2937;
}

.dark .grocery-copy-sheet-title {
  color: #fdba74;
}

.dark .grocery-copy-sheet-hint {
  color: #9ca3af;
}

.dark .grocery-copy-sheet-text {
  background: #111827;
  border-color: #4b5563;
  color: #f9fafb;
}

.dark .grocery-copy-sheet-actions button {
  background: #374151;
  border-color: #4b5563;
  color: #fdba74;
}

.dark .grocery-copy-sheet-actions button.grocery-primary {
  background: linear-gradient(to right, #ea580c, #ca8a04);
  color: #fff;
  border-color: transparent;
}

@media print {
  .grocery-toolbar,
  .grocery-actions,
  .grocery-add-form,
  .grocery-item-remove,
  .grocery-toast,
  .grocery-nav-link,
  .grocery-plan-nav-link,
  .plan-toolbar,
  .plan-sticky-bar,
  .grocery-recipe-bar,
  .recipe-scale-bar,
  .grocery-copy-sheet {
    display: none !important;
  }
}
