/* ==========================================================================
   Foodie Design System
   Foundation layer: tokens, typography, forms, buttons, utilities.
   Loaded only when FOODIE_REDESIGN is true.
   ========================================================================== */

/* --- Google Fonts -------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400;1,9..40,500&display=swap');

/* --- Minimal Reset ------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Minimal Bootstrap modal styles (when full Bootstrap CSS is skipped) */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1050;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
}
.modal.show {
  display: block;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: #000;
}
.modal-backdrop.show {
  opacity: 0.5;
}
.modal-dialog {
  position: relative;
  width: auto;
  max-width: 500px;
  margin: 1.75rem auto;
  pointer-events: none;
}
.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 3.5rem);
}
.modal-dialog-scrollable .modal-content {
  max-height: calc(100vh - 3.5rem);
  overflow: hidden;
}
.modal-dialog-scrollable .modal-body {
  overflow-y: auto;
}
.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: 20px;
}
.modal-body h4 {
  margin: 0 0 8px;
}
.modal-body p {
  margin: 0 0 16px;
  color: var(--text-gray);
  font-size: 14px;
}
/* Bootstrap grid helpers used by the location modal */
.row { display: flex; flex-wrap: wrap; margin: 0 -12px; }
.col-12 { flex: 0 0 100%; max-width: 100%; padding: 0 12px; }
.mb-3 { margin-bottom: 1rem; }
/* Location modal card styles (from legacy style.css) */
.flmp-part_g1 {
  overflow: hidden;
  border-radius: 16px;
  cursor: pointer;
}
.flmp-part_g1.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.flmp-part_a3 {
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  padding: 78px 0;
  border-radius: 16px;
  height: 191px;
  transition: transform 0.2s ease;
  position: relative;
}
.flmp-part_a3:hover {
  transform: scale(1.02);
}
.flmp-part_a3 h2 {
  color: #fff;
  font-size: 25px;
  font-weight: 500;
  margin: 0;
  text-align: center;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.6);
}

/* --- Design Tokens ------------------------------------------------------- */
:root {
  /* Brand */
  --orange: #EF4C00;
  --orange-hover: #FF661E;
  --orange-light: #FFF1DF;
  --orange-muted: rgba(239, 76, 0, 0.08);
  --cyan: #8dd5e0;
  --cyan-dark: #5fb8c7;

  /* Surfaces */
  --canvas: #eeecea;
  --canvas-deep: #e5e3e0;
  --charcoal: #1e1e1e;
  --charcoal-elevated: #282828;
  --charcoal-border: rgba(255, 255, 255, 0.08);
  --card-surface: #f8f7f5;
  --card-border: rgba(0, 0, 0, 0.05);

  /* Semantic */
  --success: #2d8a4e;
  --success-bg: rgba(45, 138, 78, 0.06);

  /* Radii */
  --radius: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  /* Text */
  --text-dark: #2d2d2d;
  --text-gray: #777;
  --text-faint: #aaa;
  --text-light: #f5f5f0;
  --text-light-2: rgba(255, 255, 255, 0.6);
  --text-light-3: rgba(255, 255, 255, 0.35);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);

  /* Motion */
  --transition: 0.2s ease;

  /* Diet palette */
  --diet-traditional: #EF4C00;
  --diet-fitness-f: #e91e63;
  --diet-fitness-m: #009688;
  --diet-vegetarian: #4caf50;
  --diet-none: #8d6e63;
}

/* --- Typography Scale ---------------------------------------------------- */
body,
input,
textarea,
select,
button {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0;
}

h1 { font-size: 2.25rem; }    /* 36px */
h2 { font-size: 1.75rem; }    /* 28px */
h3 { font-size: 1.375rem; }   /* 22px */
h4 { font-size: 1.125rem; }   /* 18px */
h5 { font-size: 1rem; }       /* 16px */
h6 { font-size: 0.875rem; }   /* 14px */

body {
  font-size: 1rem;           /* 16px */
  line-height: 1.5;
}

small,
.text-sm {
  font-size: 0.875rem;        /* 14px */
  line-height: 1.4;
}

.text-xs {
  font-size: 0.75rem;         /* 12px */
  line-height: 1.35;
}

/* --- Container Utility --------------------------------------------------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Buttons ------------------------------------------------------------- */
.btn-primary,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 24px;
  font-family: inherit;
  font-size: 0.9375rem;      /* 15px */
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

/* Primary */
.btn-primary {
  background: var(--orange);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--orange-hover);
}

.btn-primary:active {
  background: #d94300;
}

/* Secondary (outlined) */
.btn-secondary {
  background: transparent;
  color: var(--orange);
  border: 2px solid var(--orange);
  /* compensate for border so height stays 48px */
  height: 48px;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: var(--orange);
  color: #fff;
}

.btn-secondary:active {
  background: #d94300;
  border-color: #d94300;
  color: #fff;
}

/* Ghost (text-only) */
.btn-ghost {
  background: transparent;
  color: var(--orange);
  padding: 0 12px;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  background: var(--orange-muted);
}

.btn-ghost:active {
  background: rgba(239, 76, 0, 0.14);
}

/* --- Form Components ----------------------------------------------------- */

/* Text inputs & selects */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
select {
  height: 48px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text-dark);
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-muted);
}

/* Textarea */
textarea {
  min-height: 80px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text-dark);
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-muted);
}

/* Select arrow */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23777' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* Checkboxes */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
}

input[type="checkbox"]:checked {
  background: var(--orange);
  border-color: var(--orange);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px var(--orange-muted);
}

/* Radio buttons */
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color var(--transition);
}

input[type="radio"]:checked {
  border-color: var(--orange);
  border-width: 2px;
}

input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  background: var(--orange);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

input[type="radio"]:focus-visible {
  box-shadow: 0 0 0 3px var(--orange-muted);
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition);
}

.toggle input:checked + .toggle-track {
  background: var(--orange);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.toggle input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px var(--orange-muted);
}

/* --- Mode Classes -------------------------------------------------------- */

/* Cream mode (selector / cart working pages) */
.mode-cream {
  background-color: var(--canvas);
  color: var(--text-dark);
}

/* Dark mode (marketing / checkout pages) */
.mode-dark {
  background-color: var(--charcoal);
  color: var(--text-light);
}

/* --- Utilities ----------------------------------------------------------- */

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
