/* ==========================================================================
   Pantry Inventory — Custom Styles
   Extracted from Google Stitch export + design tokens from DESIGN.md
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* ── Colors: Primary ── */
  --color-primary: #006e1c;
  --color-on-primary: #ffffff;
  --color-primary-container: #4caf50;
  --color-on-primary-container: #003c0b;
  --color-inverse-primary: #78dc77;
  --color-primary-fixed: #94f990;
  --color-primary-fixed-dim: #78dc77;

  /* ── Colors: Secondary ── */
  --color-secondary: #785900;
  --color-on-secondary: #ffffff;
  --color-secondary-container: #fdc003;
  --color-on-secondary-container: #6c5000;
  --color-secondary-fixed: #ffdf9e;
  --color-secondary-fixed-dim: #fabd00;

  /* ── Colors: Tertiary ── */
  --color-tertiary: #a63360;
  --color-on-tertiary: #ffffff;
  --color-tertiary-container: #f26f9d;
  --color-on-tertiary-container: #690034;

  /* ── Colors: Error ── */
  --color-error: #ba1a1a;
  --color-on-error: #ffffff;
  --color-error-container: #ffdad6;
  --color-on-error-container: #93000a;

  /* ── Colors: Surfaces ── */
  --color-surface: #f9f9f9;
  --color-surface-dim: #dadada;
  --color-surface-bright: #f9f9f9;
  --color-surface-container-lowest: #ffffff;
  --color-surface-container-low: #f3f3f3;
  --color-surface-container: #eeeeee;
  --color-surface-container-high: #e8e8e8;
  --color-surface-container-highest: #e2e2e2;
  --color-on-surface: #1a1c1c;
  --color-on-surface-variant: #3f4a3c;
  --color-surface-tint: #006e1c;
  --color-surface-variant: #e2e2e2;
  --color-background: #f9f9f9;
  --color-on-background: #1a1c1c;

  /* ── Colors: Outline ── */
  --color-outline: #6f7a6b;
  --color-outline-variant: #becab9;

  /* ── Colors: Inverse ── */
  --color-inverse-surface: #2f3131;
  --color-inverse-on-surface: #f1f1f1;

  /* ── Typography ── */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;

  /* ── Spacing (4px base) ── */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-gutter: 12px;
  --space-container-padding: 16px;

  /* ── Border Radius ── */
  --radius-sm: 0.25rem;
  --radius-default: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* ── Elevation ── */
  --shadow-level-1: 0px 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-level-2: 0px 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-pressed: 0px 2px 8px rgba(0, 0, 0, 0.04);
}

/* --------------------------------------------------------------------------
   2. Base Styles
   -------------------------------------------------------------------------- */
body {
  background-color: var(--color-background);
  min-height: max(884px, 100dvh);
}

/* Smooth scrolling globally */
html {
  scroll-behavior: smooth;
}

/* --------------------------------------------------------------------------
   3. SPA View Routing System
   -------------------------------------------------------------------------- */

/* All views hidden by default — !important needed to override Tailwind CDN */
.app-view {
  display: none !important;
}

/* Active view is visible */
.app-view.active {
  display: block !important;
}

/* Header & bottom nav hidden until auth */
#app-header {
  display: none !important;
}

#bottom-nav {
  display: none !important;
}

#app-header.visible {
  display: flex !important;
}

#bottom-nav.visible {
  display: block !important;
}

/* --------------------------------------------------------------------------
   4. Auth View Styles
   -------------------------------------------------------------------------- */
.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-lg) var(--space-container-padding);
  background: linear-gradient(160deg, #f0fdf0 0%, var(--color-background) 40%, #fff8e8 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface-container-lowest);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-level-2);
  border: 1px solid var(--color-outline-variant);
  animation: fadeInUp 0.5s ease-out;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.auth-logo-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-on-primary);
  box-shadow: 0 4px 16px rgba(0, 110, 28, 0.25);
}

.auth-logo-icon .material-symbols-outlined {
  font-size: 36px;
}

.auth-logo h1 {
  font-family: var(--font-family);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.02em;
  margin: 0;
}

.auth-logo p {
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--color-on-surface-variant);
  margin: 0;
}

/* Form elements */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-group label {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-on-surface-variant);
}

.form-group input {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 24px;
  padding: 12px var(--space-md);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-on-surface);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 110, 28, 0.12);
}

.form-group input::placeholder {
  color: var(--color-outline);
}

/* Primary auth button */
.btn-auth-primary {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  height: 48px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-on-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 110, 28, 0.2);
}

.btn-auth-primary:hover {
  background: #005a16;
  box-shadow: 0 4px 12px rgba(0, 110, 28, 0.3);
}

.btn-auth-primary:active {
  transform: scale(0.98);
}

.btn-auth-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--color-outline);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-outline-variant);
}

/* Google sign-in button */
.btn-google {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  height: 48px;
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-md);
  background: var(--color-surface-container-lowest);
  color: var(--color-on-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.btn-google:hover {
  background: var(--color-surface-container-low);
  border-color: var(--color-outline);
}

.btn-google:active {
  transform: scale(0.98);
}

.btn-google svg {
  width: 18px;
  height: 18px;
}

/* Toggle link (Login ↔ Register) */
.auth-toggle {
  text-align: center;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--color-on-surface-variant);
  margin-top: var(--space-sm);
}

.auth-toggle button {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-family);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s ease;
}

.auth-toggle button:hover {
  text-decoration-color: var(--color-primary);
}

/* Error / success messages */
.auth-message {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  padding: 10px var(--space-md);
  border-radius: var(--radius-default);
  display: none;
  align-items: center;
  gap: var(--space-sm);
  animation: fadeInUp 0.3s ease-out;
}

.auth-message.visible {
  display: flex;
}

.auth-message.error {
  background: var(--color-error-container);
  color: var(--color-on-error-container);
}

.auth-message.success {
  background: rgba(76, 175, 80, 0.15);
  color: var(--color-primary);
}

/* Loading spinner on button */
.btn-loading .material-symbols-outlined {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------------------------------
   5. Empty State Styles (Inventory, Recipes, Impact)
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  min-height: 60vh;
  gap: var(--space-md);
}

.empty-state-icon {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-sm);
}

.empty-state-icon .material-symbols-outlined {
  font-size: 48px;
}

.empty-state-icon.primary {
  background: rgba(0, 110, 28, 0.08);
  color: var(--color-primary);
}

.empty-state-icon.secondary {
  background: rgba(120, 89, 0, 0.08);
  color: var(--color-secondary);
}

.empty-state-icon.tertiary {
  background: rgba(166, 51, 96, 0.08);
  color: var(--color-tertiary);
}

.empty-state h2 {
  font-family: var(--font-family);
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
  color: var(--color-on-surface);
  margin: 0;
}

.empty-state p {
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 20px;
  color: var(--color-on-surface-variant);
  margin: 0;
  max-width: 280px;
}

.btn-empty-state {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  height: 48px;
  padding: 0 24px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-on-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  transition: background-color 0.2s ease, transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 110, 28, 0.2);
}

.btn-empty-state:hover {
  background: #005a16;
}

.btn-empty-state:active {
  transform: scale(0.98);
}

/* --------------------------------------------------------------------------
   6. Component Styles
   -------------------------------------------------------------------------- */

/* Setting Cards — tactile press feedback per DESIGN.md */
.setting-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.setting-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-pressed);
}

/* Toggle Switch — custom accessible styles */
.toggle-track {
  transition: background-color 0.25s ease;
}

/* Default avatar placeholder */
.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-container);
  color: var(--color-on-primary-container);
  font-family: var(--font-family);
  font-weight: 700;
}

.inventory-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-weight: 700;
}

.avatar-placeholder.small {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 16px;
}

.avatar-placeholder.large {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  font-size: 36px;
}

/* --------------------------------------------------------------------------
   7. Animations & Micro-interactions
   -------------------------------------------------------------------------- */

/* Smooth fade-in for main content */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main>section {
  animation: fadeInUp 0.35s ease-out both;
}

main>section:nth-child(2) {
  animation-delay: 0.08s;
}

main>section:nth-child(3) {
  animation-delay: 0.16s;
}

main>section:nth-child(4) {
  animation-delay: 0.24s;
}

/* View transition */
.app-view.active {
  animation: fadeInUp 0.3s ease-out;
}

/* --------------------------------------------------------------------------
   8. Dark Mode Overrides
   -------------------------------------------------------------------------- */
.dark {
  --color-surface: #1a1c1c;
  --color-background: #1a1c1c;
  --color-on-surface: #e2e2e2;
  --color-surface-container-lowest: #0e1110;
  --color-surface-container-low: #1a1c1c;
  --color-surface-container: #1e2020;
  --color-surface-container-high: #282a2a;
  --color-surface-container-highest: #333535;
}

.dark .auth-container {
  background: linear-gradient(160deg, #0e1110 0%, #1a1c1c 40%, #1e1a10 100%);
}

.dark .auth-card {
  border-color: var(--color-surface-container-high);
}

.dark .form-group input {
  background: var(--color-surface-container);
  border-color: var(--color-surface-container-highest);
  color: var(--color-on-surface);
}

.dark .btn-google {
  background: var(--color-surface-container);
  border-color: var(--color-surface-container-highest);
  color: var(--color-on-surface);
}

/* --------------------------------------------------------------------------
   9. Utility Overrides
   -------------------------------------------------------------------------- */

/* Ensures bottom nav doesn't cover content */
body {
  padding-bottom: 5rem;
}

/* When auth view is active, no bottom padding needed */
body.auth-active {
  padding-bottom: 0;
}

/* --------------------------------------------------------------------------
   10. Modal System
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: modalFadeIn 0.25s ease-out;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: var(--space-lg);
  }
}

.modal-card {
  background: var(--color-surface-container-lowest);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-level-2);
  animation: modalSlideUp 0.3s ease-out;
}

@media (min-width: 640px) {
  .modal-card {
    border-radius: var(--radius-xl);
  }
}

.modal-card-tall {
  max-height: 80vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-surface-container-high);
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--color-on-surface-variant);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.modal-close:hover {
  background: var(--color-surface-container-high);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-scroll {
  overflow-y: auto;
  max-height: 60vh;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-surface-container-high);
}

.btn-secondary {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  height: 40px;
  padding: 0 20px;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-on-surface-variant);
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-secondary:hover {
  background: var(--color-surface-container-high);
}

.btn-danger {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  height: 40px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-error);
  color: var(--color-on-error);
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (min-width: 640px) {
  @keyframes modalSlideUp {
    from {
      transform: translateY(20px) scale(0.95);
      opacity: 0;
    }

    to {
      transform: translateY(0) scale(1);
      opacity: 1;
    }
  }
}

/* --------------------------------------------------------------------------
   11. Form Select Styling
   -------------------------------------------------------------------------- */
.form-select {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 24px;
  padding: 12px var(--space-md);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-on-surface);
  outline: none;
  width: 100%;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%236f7a6b' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 110, 28, 0.12);
}

/* --------------------------------------------------------------------------
   12. Inventory Card Styles
   -------------------------------------------------------------------------- */
.inventory-card {
  background: var(--color-surface-container-lowest);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  border: 1px solid var(--color-outline-variant);
  box-shadow: var(--shadow-level-1);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeInUp 0.3s ease-out both;
}

.inventory-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-pressed);
}

.inventory-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.inventory-card-info {
  flex: 1;
  min-width: 0;
}

.inventory-card-info h4 {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-on-surface);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
 
.inventory-card-info .inventory-card-category {
  font-family: var(--font-family);
  font-size: 12px;
  color: var(--color-on-surface-variant);
  margin: 4px 0 0 0;
  line-height: 1.4;
}
 
.inventory-card-info p {
  font-family: var(--font-family);
  font-size: 12px;
  color: var(--color-on-surface-variant);
  margin: 2px 0 0 0;
}

.inventory-card-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.inventory-card-actions button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--color-on-surface-variant);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s;
}

.inventory-card-actions button:hover {
  background: var(--color-surface-container-high);
}

.inventory-card-actions button.delete-btn:hover {
  background: var(--color-error-container);
  color: var(--color-error);
}

/* Status chips */
.status-chip {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-top: 4px;
}

.status-chip.fresh {
  background: rgba(0, 110, 28, 0.1);
  color: var(--color-primary);
}

.status-chip.expiring {
  background: rgba(120, 89, 0, 0.1);
  color: var(--color-secondary);
}

.status-chip.expired {
  background: rgba(186, 26, 26, 0.1);
  color: var(--color-error);
}

/* --------------------------------------------------------------------------
   13. FAB Button
   -------------------------------------------------------------------------- */
.fab-button {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--color-primary);
  color: var(--color-on-primary);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 110, 28, 0.3);
  z-index: 45;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 110, 28, 0.4);
}

.fab-button:active {
  transform: scale(0.95);
}

.fab-button .material-symbols-outlined {
  font-size: 28px;
}

/* --------------------------------------------------------------------------
   14. Recipe Card Hover
   -------------------------------------------------------------------------- */
.recipe-card-generated {
  width: 100%;
  min-height: 150px;
  max-height: 180px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-surface-container-low);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
 
.recipe-card-generated img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
 
.recipe-card-generated-icon {
  font-size: 2.5rem;
  color: var(--color-on-surface-variant);
}
 
.recipe-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.recipe-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.recipe-card:active {
  transform: scale(0.97);
}

/* --------------------------------------------------------------------------
   15. Inventory List Header
   -------------------------------------------------------------------------- */
.inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.inventory-count {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-on-surface-variant);
}

/* --------------------------------------------------------------------------
   16. Barcode Scanner Styles
   -------------------------------------------------------------------------- */
.modal-card-scanner {
  max-height: 95vh;
}

.scanner-body {
  position: relative;
  padding: 0;
  overflow: hidden;
  background: #000;
}

#scanner-reader {
  width: 100%;
  border: none;
}

#scanner-reader video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-status-text {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.scanner-line {
  position: absolute;
  top: 10%;
  left: 5%;
  right: 5%;
  height: 2px;
  background: var(--color-primary-fixed-dim);
  border-radius: 2px;
  box-shadow: 0 0 12px 2px var(--color-primary-fixed-dim);
  animation: scan-line-anim 2.5s infinite alternate ease-in-out;
  opacity: 0.8;
}

@keyframes scan-line-anim {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(calc(min(400px, 60vh) - 20px));
    /* Adjust based on typical modal height */
  }
}

.btn-scan-header {
  width: 100%;
  padding: 12px;
  border: 1px dashed var(--color-outline-variant);
  border-radius: var(--radius-md);
  background: var(--color-surface-container-low);
  color: var(--color-on-surface-variant);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.btn-scan-header:hover {
  background: var(--color-surface-container);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-empty-state.secondary {
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  box-shadow: 0 2px 8px rgba(120, 89, 0, 0.2);
}

.btn-empty-state.secondary:hover {
  background: #eab500;
}

/* --------------------------------------------------------------------------
   17. Scan Preview Styles
   -------------------------------------------------------------------------- */
.scan-preview {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-surface-container);
  border-radius: var(--radius-lg);
  animation: fadeInUp 0.3s ease-out;
}

.scan-preview img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: var(--radius-default);
  background: #fff;
  flex-shrink: 0;
}

.scan-preview-info h4 {
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-on-surface);
  margin: 0;
}

.scan-preview-info p {
  font-family: var(--font-family);
  font-size: 12px;
  color: var(--color-on-surface-variant);
  margin: 2px 0 0 0;
}

.nutrition-table {
  margin-top: var(--space-sm);
  font-family: var(--font-family);
  font-size: 11px;
  color: var(--color-on-surface-variant);
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.nutrition-table span {
  background: var(--color-surface-container-high);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   18. Toast Notification Styles
   -------------------------------------------------------------------------- */
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px var(--space-md);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-level-2);
  border: 1px solid transparent;
  min-width: 280px;
  max-width: 320px;
  animation: toast-in 0.4s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}

.toast.success {
  background: var(--color-primary-container);
  color: var(--color-on-primary-container);
  border-color: var(--color-primary);
}

.toast.error {
  background: var(--color-error-container);
  color: var(--color-on-error-container);
  border-color: var(--color-error);
}

.toast.info {
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  border-color: var(--color-secondary);
}

.toast.out {
  animation: toast-out 0.4s ease-out forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}

/* --------------------------------------------------------------------------
   19. Product Details Modal Styles
   -------------------------------------------------------------------------- */
.details-header {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-surface-container-high);
}

.details-header img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: var(--radius-default);
  background: #fff;
  flex-shrink: 0;
  border: 1px solid var(--color-surface-container-high);
}

.details-header-info h3 {
  font-family: var(--font-family);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-on-surface);
  margin: 0;
  line-height: 1.3;
}

.details-header-info p {
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--color-on-surface-variant);
  margin: 2px 0 0 0;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.details-grid-item {
  background: var(--color-surface-container-low);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
}

.details-grid-item label {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-on-surface-variant);
}

.details-grid-item p {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-on-surface);
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   20. Search Input Styles
   -------------------------------------------------------------------------- */
.search-input {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 24px;
  padding: 12px 16px 12px 44px;
  /* Left padding for icon */
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-full);
  background: var(--color-surface-container-low);
  color: var(--color-on-surface);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 110, 28, 0.12);
  background: var(--color-surface-container-lowest);
}

/* --------------------------------------------------------------------------
   21. Sort Select Styles
   -------------------------------------------------------------------------- */
.sort-select {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 28px 4px 8px;
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-md);
  background-color: var(--color-surface-container-low);
  color: var(--color-on-surface-variant);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%233f4a3c' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  cursor: pointer;
  outline: none;
}

/* --------------------------------------------------------------------------
   22. Onboarding Styles
   -------------------------------------------------------------------------- */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-background);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: modalFadeIn 0.3s ease-out;
}

.onboarding-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.onboarding-steps {
  position: relative;
  min-height: 280px;
}

.onboarding-step {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.onboarding-step.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.onboarding-step.exiting {
  transform: translateX(-20px);
}

.onboarding-icon {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 110, 28, 0.08);
  color: var(--color-primary);
}

.onboarding-icon .material-symbols-outlined {
  font-size: 48px;
}

.onboarding-icon.secondary {
  background: rgba(120, 89, 0, 0.08);
  color: var(--color-secondary);
}

.onboarding-icon-row {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  justify-content: center;
}

.onboarding-icon-row .onboarding-icon {
  width: 80px;
  height: 80px;
}

.onboarding-icon-row .onboarding-icon .material-symbols-outlined {
  font-size: 40px;
}

.status-preview {
  flex-direction: column;
  gap: var(--space-sm);
}

.onboarding-title {
  font-family: var(--font-family);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-on-background);
  margin: 0;
}

.onboarding-text {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 24px;
  color: var(--color-on-surface-variant);
  max-width: 320px;
  margin: 0;
}

.onboarding-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.onboarding-dots {
  display: flex;
  gap: var(--space-sm);
}

.onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-surface-container-high);
  border: none;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s;
}

.onboarding-dot.active {
  background: var(--color-primary);
  transform: scale(1.2);
}

.onboarding-actions {
  display: flex;
  gap: var(--space-md);
  width: 100%;
}

.btn-onboarding-secondary {
  flex: 1;
  height: 48px;
  background: transparent;
  border: none;
  color: var(--color-on-surface-variant);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-onboarding-secondary:hover {
  background: var(--color-surface-container-high);
}

.btn-onboarding-primary {
  flex: 2;
  height: 48px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  border: none;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-onboarding-primary:hover {
  background: #005a16;
}

/* --------------------------------------------------------------------------
   23. Recipe Details Modal Styles
   -------------------------------------------------------------------------- */
.recipe-details-section-title {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-on-surface-variant);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--color-surface-container-high);
}

.recipe-ingredients-list {
  list-style: none;
  padding: 0;
  margin: 0;
  space-y: var(--space-sm);
}

.recipe-ingredient-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--color-on-surface);
}

.recipe-ingredient-item .icon {
  font-size: 18px;
}

.recipe-ingredient-item .icon.available {
  color: var(--color-primary);
}

.recipe-ingredient-item .icon.unavailable {
  color: var(--color-outline);
}

.recipe-ingredient-item .name {
  flex: 1;
}

.recipe-ingredient-item .quantity {
  font-weight: 500;
  color: var(--color-on-surface-variant);
}

.recipe-steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step-counter;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.recipe-step-item {
  display: flex;
  gap: var(--space-sm);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 20px;
  color: var(--color-on-surface);
}

.recipe-step-item::before {
  counter-increment: step-counter;
  content: counter(step-counter);
  font-weight: 700;
  color: var(--color-primary);
  background: rgba(0, 110, 28, 0.1);
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.recipe-card-image-wrapper {
  width: 100%;
  height: 120px;
  /* Fixed height for consistency */
  overflow: hidden;
  border-bottom: 1px solid var(--color-outline-variant);
}

.recipe-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Cover the area, cropping if necessary */
  transition: transform 0.3s ease;
}

.recipe-card:hover .recipe-card-image {
  transform: scale(1.05);
}

.recipe-details-image-container {
  width: 100%;
  height: 180px;
  /* Larger image for modal */
  overflow: hidden;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.recipe-details-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   24. Shopping List Styles
   -------------------------------------------------------------------------- */
.shopping-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-container-low);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--color-on-surface);
  cursor: pointer;
  transition: background-color 0.2s;
}

.shopping-list-item:hover {
  background: var(--color-surface-container);
}

.shopping-list-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-outline);
  background: var(--color-surface);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color 0.2s, border-color 0.2s;
}

.shopping-list-item input[type="checkbox"]:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
}

.shopping-list-item label {
  flex: 1;
  transition: color 0.2s, text-decoration 0.2s;
}

.shopping-list-item input[type="checkbox"]:checked+label {
  color: var(--color-on-surface-variant);
  text-decoration: line-through;
}

/* --------------------------------------------------------------------------
   26. Shopping List Item Completion Animation
   -------------------------------------------------------------------------- */
.shopping-list-item.completed {
  animation: slide-out-left-fade 0.3s ease-out forwards;
}

@keyframes slide-out-left-fade {
  from {
    opacity: 1;
    transform: translateX(0);
    max-height: 60px;
    /* Approximate height of a shopping list item */
    margin-bottom: var(--space-sm);
    padding-top: var(--space-sm);
    padding-bottom: var(--space-sm);
  }

  to {
    opacity: 0;
    transform: translateX(-100%);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    border: none;
    /* Hide border during animation */
  }
}

/* --------------------------------------------------------------------------
   25. Manual Add Shopping Item Form
   -------------------------------------------------------------------------- */
.add-shopping-item-form {
  display: flex;
  gap: var(--space-sm);
}

.add-shopping-item-form input {
  flex-grow: 1;
  font-family: var(--font-family);
  font-size: 14px;
  padding: 10px var(--space-md);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-on-surface);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.add-shopping-item-form input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 110, 28, 0.12);
}

.add-shopping-item-form button {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-on-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.add-shopping-item-form button:hover {
  background: #005a16;
}

/* --------------------------------------------------------------------------
   27. Generated Recipe Card Visuals
   -------------------------------------------------------------------------- */
.recipe-card-generated {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--color-outline-variant);
}

.recipe-card-generated-icon {
  font-size: 48px;
  opacity: 0.8;
}

.recipe-theme-green {
  background: linear-gradient(145deg, rgba(0, 110, 28, 0.15), rgba(0, 110, 28, 0.05));
  color: var(--color-primary);
}

.recipe-theme-yellow {
  background: linear-gradient(145deg, rgba(120, 89, 0, 0.15), rgba(120, 89, 0, 0.05));
  color: var(--color-secondary);
}

.recipe-theme-red {
  background: linear-gradient(145deg, rgba(186, 26, 26, 0.15), rgba(186, 26, 26, 0.05));
  color: var(--color-error);
}

.recipe-theme-blue {
  background: linear-gradient(145deg, rgba(0, 77, 168, 0.15), rgba(0, 77, 168, 0.05));
  color: #004da8;
  /* A generic blue if needed */
}

/* --------------------------------------------------------------------------
   27. Generated Recipe Card Visuals
   -------------------------------------------------------------------------- */
.recipe-card-generated {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--color-outline-variant);
}

.recipe-card-generated-icon {
  font-size: 48px;
  opacity: 0.8;
}

.recipe-theme-green {
  background: linear-gradient(145deg, rgba(0, 110, 28, 0.15), rgba(0, 110, 28, 0.05));
  color: var(--color-primary);
}

.recipe-theme-yellow {
  background: linear-gradient(145deg, rgba(120, 89, 0, 0.15), rgba(120, 89, 0, 0.05));
  color: var(--color-secondary);
}

.recipe-theme-red {
  background: linear-gradient(145deg, rgba(186, 26, 26, 0.15), rgba(186, 26, 26, 0.05));
  color: var(--color-error);
}

.recipe-theme-blue {
  background: linear-gradient(145deg, rgba(0, 77, 168, 0.15), rgba(0, 77, 168, 0.05));
  color: #004da8;
  /* A generic blue if needed */
}

/* --------------------------------------------------------------------------
   28. Recipe Image Credit
   -------------------------------------------------------------------------- */
.recipe-image-credit {
  font-family: var(--font-family);
  font-size: 11px;
  color: var(--color-on-surface-variant);
  opacity: 0.75;
  margin-top: -8px;
  margin-bottom: var(--space-md);
  text-align: right;
}