/* =========================================================
   DishMenus — Design System
   Centralized CSS variables. Never hard-code these colors
   elsewhere in the app — reference the variables instead.
   ========================================================= */

:root {
  --dm-primary: #F56C0C;          /* DishMenus logo orange */
  --dm-primary-dark: #C75204;     /* logo orange, darker: 4.5:1 with white text */
  --dm-secondary: #141414;        /* logo black */
  --dm-accent: #FFBA08;
  --dm-background: #FCFAF5;       /* light tint of the logo cream (#F5F2E7) */
  --dm-surface: #FFFFFF;
  --dm-text: #141414;             /* logo black */
  --dm-muted: #6B7280;
  --dm-border: #E5E7EB;
  --dm-success: #2E7D32;
  --dm-warning: #F59E0B;
  --dm-danger: #D32F2F;

  /* Phase 11 (accessibility): #E85D04 on white is only 3.5:1 — fails WCAG AA
     for text. --dm-primary stays the brand color for decorative uses (logo
     mark, borders); text and button fills use the accessible shades below:
     --dm-primary-dark (#C94D00) = 4.62:1 with white text, and
     --dm-primary-strong (#B24400) = 5.17:1 on the #FFF3E8 tint. */
  --dm-primary-strong: #A84300;   /* 5.5:1 on the #FFF3E8 tint */

  --dm-font: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --dm-radius: 12px;
}

* { box-sizing: border-box; }

body {
  font-family: var(--dm-font);
  background: var(--dm-background);
  color: var(--dm-text);
}

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; }

.dm-muted { color: var(--dm-muted); }

/* ---------- Navbar ---------- */
.dm-navbar {
  background: var(--dm-surface);
  border-bottom: 1px solid var(--dm-border);
}

.dm-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--dm-primary-strong) !important;
}

.dm-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--dm-primary);
  color: #fff;
  font-size: 1.1rem;
}

/* ---------- Buttons ---------- */
.dm-btn-primary {
  background: var(--dm-primary-dark);
  border-color: var(--dm-primary-dark);
  color: #fff;
}
.dm-btn-primary:hover {
  background: var(--dm-primary-strong);
  border-color: var(--dm-primary-strong);
  color: #fff;
}

.dm-btn-outline {
  background: transparent;
  border: 1px solid var(--dm-border);
  color: var(--dm-text);
}
.dm-btn-outline:hover {
  border-color: var(--dm-primary-strong);
  color: var(--dm-primary-strong);
}

/* ---------- Hero ---------- */
.dm-hero {
  background: linear-gradient(180deg, #FFF3E8 0%, var(--dm-background) 100%);
}
.dm-hero-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
}
.dm-hero-sub {
  color: var(--dm-muted);
  font-size: 18px;
}
.dm-hero-search {
  max-width: 760px;
}

/* ---------- Cards ---------- */
.dm-card {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius);
}

.dm-badge-role {
  background: var(--dm-secondary);
  color: #fff;
  font-weight: 500;
}

.dm-alert-foundation {
  background: #FFF3E8;
  border: 1px solid var(--dm-accent);
  color: var(--dm-text);
  border-radius: var(--dm-radius);
}

/* ---------- Footer ---------- */
.dm-footer {
  border-top: 1px solid var(--dm-border);
  color: var(--dm-muted);
  margin-top: 3rem;
}


/* =========================================================
   Phase 11 — focus states & skip link (keyboard accessibility)
   Bootstrap removes/reduces some outlines; this restores a clearly
   visible, high-contrast focus ring for every interactive element,
   using :focus-visible so mouse users don't get it on click.
   ========================================================= */
:focus-visible {
  outline: 3px solid var(--dm-primary-strong);
  outline-offset: 2px;
}
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible {
  outline: 3px solid var(--dm-primary-strong);
  outline-offset: 2px;
  box-shadow: none;
}

.dm-skip-link {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  z-index: 2000;
  padding: 0.6rem 1rem;
  background: var(--dm-surface);
  color: var(--dm-text);
  border: 2px solid var(--dm-primary-strong);
  border-radius: 8px;
}

/* Respect users who ask their OS to reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Never let long content force sideways scrolling on small screens */
img, video { max-width: 100%; height: auto; }

/* ---------- Add-on selector widget ---------- */
.dm-addon-group {
  padding: 1rem;
  margin-bottom: 1rem;
}
.dm-addon-group-header { margin-bottom: 0.25rem; }
.dm-addon-counter { margin-bottom: 0.5rem; }
/* the group's own warning (addon-selector.js): over the limit, or a required choice still missing */
.dm-addon-notice {
  margin: -0.25rem 0 0.5rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #F5C26B;
  background: #FFF6E0;
  color: #8A5300;
  font-size: 0.85rem;
  font-weight: 600;
}
.dm-addon-notice[hidden] { display: none; }
.dm-addon-option-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--dm-border);
}
.dm-addon-option-row:first-of-type { border-top: none; }
.dm-addon-option-label { display: flex; align-items: center; flex: 1; margin: 0; min-width: 0; }
.dm-addon-option-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word; /* a long name wraps instead of pushing the price off-screen */
}
.dm-addon-option-price {
  flex: 0 0 auto;      /* never shrinks, never wraps, never gets squeezed out */
  white-space: nowrap;
  margin-left: 0.5rem;
  font-weight: 600;
  color: var(--dm-text);
}
.dm-addon-qty { width: 70px; }
.dm-addon-price-bar {
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.75rem 0;
}
.dm-addon-errors:empty { display: none; }
.dm-addon-add-to-cart:disabled { opacity: 0.5; cursor: not-allowed; }

/* A menu item the owner has marked "Not available right now": still listed, visibly greyed. */
.dm-unavailable { background-color: #F1F3F5; }
.dm-unavailable .fw-bold { color: #495057; }

/* Small dish picture on order screens (see food_thumb() in app/helpers/functions.php). */
.dm-thumb {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
  background: #F3F4F6;
  color: var(--dm-muted);
  font-size: 1.4rem;
}
.dm-thumb picture, .dm-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Dish page: comfortable to read and tap on a phone ---------- */
.dm-item-title {
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  line-height: 1.25;
  overflow-wrap: anywhere;      /* a very long dish name wraps instead of running off the screen */
}
@media (max-width: 575.98px) {
  .dm-addon-group { padding: 0.85rem; }
  .dm-addon-option-row { min-height: 48px; padding: 0.5rem 0; }         /* a comfortable finger-sized row */
  .dm-addon-option-label { font-size: 1rem; }
  .dm-addon-option-label .form-check-input { width: 1.4rem; height: 1.4rem; margin-top: 0; flex: 0 0 auto; }   /* rem, not em: independent of the input's own font size */
  .dm-addon-price-bar { font-size: 1.15rem; }
  .dm-addon-add-to-cart { width: 100%; padding: 0.85rem 1rem; font-size: 1.1rem; }
}

/* DishMenus logo image (header + sidebars) */
.dm-logo-img {
  height: 34px;
  width: auto;
  display: block;
}
.dm-brand-sub {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--dm-text-muted, #6c757d);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dm-sidebar .dm-brand {
  flex-wrap: wrap;
  row-gap: 0.15rem;
}
.dm-sidebar .dm-logo-img {
  height: 30px;
  max-width: 100%;
}
