/* ==========================================================================
   Accessibility: Skip to Content Link (WCAG 2.4.1 Bypass Blocks)
   ========================================================================== */

.skip-to-content {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 99999;
}

.skip-to-content:focus {
  position: fixed;
  top: 10px;
  left: 10px;
  width: auto;
  height: auto;
  padding: 1rem 1.5rem;
  background: var(--fs-accent);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  outline: 3px solid #e67300;
  outline-offset: 2px;
}

.skip-to-content:focus:hover {
  background: #e67300;
}

/* Main content focus state for skip link target */
#main-content:focus {
  outline: none;
}

/* ==========================================================================
   End Accessibility Styles
   ========================================================================== */

h1:focus {
  outline: none;
}

.valid.modified:not([type="checkbox"]) {
  outline: 1px solid #26b050;
}

.invalid {
  outline: 1px solid #e50000;
}

.validation-message {
  color: #e50000;
}

.blazor-error-boundary {
  background:
    url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4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iIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=)
      no-repeat 1rem/1.8rem,
    #b32121;
  padding: 1rem 1rem 1rem 3.7rem;
  color: white;
}

.blazor-error-boundary::after {
  content: "We hit a snag";
}

.darker-border-checkbox.form-check-input {
  border-color: #929292;
}

/* .NET 9 Blazor Reconnection Modal Styles */
#components-reconnect-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  backdrop-filter: blur(2px);
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
  display: flex;
  align-items: center;
  justify-content: center;
}

.reconnect-modal-content {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  margin: 0 1rem;
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.reconnect-spinner {
  margin-bottom: 1rem;
}

.reconnect-title {
  color: #333;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.reconnect-message {
  color: #666;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.reconnect-details {
  color: #888;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.reconnect-actions {
  margin-top: 1rem;
}

/* State-specific styling */
#components-reconnect-modal.components-reconnect-failed
  .reconnect-title::before {
  content: "⚠️ ";
}

#components-reconnect-modal.components-reconnect-rejected
  .reconnect-title::before {
  content: "❌ ";
}

#components-reconnect-modal.components-reconnect-rejected .reconnect-title {
  color: #dc3545;
}

#components-reconnect-modal.components-reconnect-rejected .reconnect-message {
  color: #dc3545;
}

/* Responsive design */
@media (max-width: 576px) {
  .reconnect-modal-content {
    padding: 1.5rem;
    margin: 0 0.5rem;
  }

  .reconnect-title {
    font-size: 1.1rem;
  }

  .reconnect-message {
    font-size: 0.9rem;
  }
}

/* Custom transition for smooth appearance */
#components-reconnect-modal {
  transition: opacity 0.2s ease-in-out;
}

/* Ensure text is readable in dark mode scenarios */
@media (prefers-color-scheme: dark) {
  .reconnect-modal-content {
    background: #2d3748;
    color: #e2e8f0;
  }

  .reconnect-title {
    color: #f7fafc;
  }

  .reconnect-message {
    color: #cbd5e0;
  }

  .reconnect-details {
    color: #a0aec0;
  }
}

/* Snack Section Styling */
.snacks-section {
  border-top: 2px solid #e9ecef;
  padding-top: 1.5rem;
}

.snacks-section .section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #6c757d;
  margin-bottom: 0.75rem;
}

/* Apply special styling to snack meal cards */
.snacks-section .optimized-meal-card {
  background-color: #fafbfc;
  border: 1px solid #e3e8ed;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Compact header for snacks */
.snacks-section .optimized-meal-header {
  background-color: #f6f8fa;
  padding: 0.625rem 0.875rem;
  min-height: auto;
}

.snacks-section .optimized-meal-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: #586069;
}

/* Smaller chevron icon for snacks */
.snacks-section .meal-chevron-icon {
  font-size: 0.75rem;
}

/* Compact macro display for snacks */
.snacks-section .optimized-meal-macros,
.snacks-section .optimized-meal-status {
  font-size: 0.813rem;
}

.snacks-section .macro-item {
  margin: 0 0.375rem;
}

.snacks-section .macro-label {
  font-size: 0.75rem;
  color: #6c757d;
}

/* Smaller buttons for snacks */
.snacks-section .btn-sm {
  font-size: 0.813rem;
  padding: 0.25rem 0.5rem;
}

/* Compact content area for snacks */
.snacks-section .optimized-meal-content {
  padding: 0.75rem;
  background-color: #fefefe;
}

.snacks-section .food-item {
  padding: 0.625rem 0;
}

/* Smaller input fields for snacks */
.snacks-section input.form-control-sm {
  font-size: 0.813rem;
  padding: 0.25rem 0.375rem;
  height: calc(1.5rem + 2px);
}

/* Pills/Chips style for snack items (alternative display) */
.snack-chip {
  display: inline-flex;
  align-items: center;
  background-color: #e9ecef;
  border: 1px solid #dee2e6;
  border-radius: 1rem;
  padding: 0.375rem 0.75rem;
  margin: 0.25rem;
  font-size: 0.875rem;
  color: #495057;
  transition: all 0.2s ease;
}

.snack-chip:hover {
  background-color: #dee2e6;
  border-color: #ced4da;
}

.snack-chip .chip-calories {
  font-weight: 600;
  margin-left: 0.5rem;
  color: #343a40;
}

/* Add Snack Button - styled as a subtle action */
.snacks-section .btn-outline-primary {
  color: #586069;
  border-color: #d1d5da;
  background-color: transparent;
  font-size: 0.813rem;
  padding: 0.375rem 0.75rem;
  transition: all 0.2s ease;
}

.snacks-section .btn-outline-primary:hover {
  color: #0366d6;
  background-color: #f6f8fa;
  border-color: #0366d6;
}

/* Empty snacks message */
.snacks-section .text-muted {
  font-size: 0.875rem;
  font-style: italic;
}

/* Mobile responsiveness for snacks */
@media (max-width: 576px) {
  .snacks-section .optimized-meal-header {
    padding: 0.5rem 0.75rem;
  }

  .snacks-section .optimized-meal-title {
    font-size: 0.875rem;
  }

  .snacks-section .btn-sm {
    font-size: 0.75rem;
    padding: 0.25rem 0.375rem;
  }

  .snacks-section .optimized-meal-content {
    padding: 0.625rem;
  }
}

/* Optional: Pill-style layout for snack foods */
.snack-foods-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.75rem;
}

.snack-food-pill {
  display: inline-flex;
  align-items: center;
  background-color: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 1.25rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.813rem;
  color: #24292e;
  white-space: nowrap;
  max-width: 100%;
}

.snack-food-pill .food-name {
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 0.5rem;
}

.snack-food-pill .food-calories {
  font-weight: 600;
  color: #586069;
  flex-shrink: 0;
}

/* ==========================================================================
   Sticky CTA Bottom Padding (Mobile)
   Prevents content from being hidden behind the sticky CTA bar
   ========================================================================== */

@media (max-width: 991px) {
  body {
    padding-bottom: 80px;
  }
}

/* ==========================================================================
   Section Title Styling
   ========================================================================== */

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 1.25rem;
  margin-top: 0;
}
