/* App Cozinha — Estilo visual para iPad 4 / Safari 10.1 */
/* Paleta JDA: terracotta #c05025, verde #3a4e3f */

:root {
  --bg: #f5f1eb;
  --bg-soft: #ebe6df;
  --text: #2c2c2c;
  --text-muted: #5c5c5c;
  --accent: #c05025;
  --accent-soft: rgba(192, 80, 37, 0.12);
  --forest: #3a4e3f;
  --white: #fff;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(44, 44, 44, 0.06);
  --checked-bg: rgba(58, 78, 63, 0.06);
  --checked-text: #a0a0a0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 120% 80% at 50% 0%, var(--accent-soft) 0%, transparent 50%), var(--bg);
  pointer-events: none;
  z-index: 0;
}

/* --- Tela principal --- */

.screen {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: clamp(48px, 10vw, 72px);
  overflow: hidden;
}

.screen-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px clamp(16px, 4vw, 24px);
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.8;
  background: var(--bg);
}

.screen-header__date {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.screen-header__logo {
  height: 56px;
  width: auto;
  object-fit: contain;
  opacity: 0.7;
}

/* --- Carousel --- */

.carousel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.carousel__track {
  display: flex;
  height: 100%;
  will-change: transform;
}

.carousel__slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(8px, 2vw, 16px) clamp(12px, 3vw, 24px);
  overflow: hidden;
}

/* --- Day separator label --- */

.day-label {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-align: center;
  margin-bottom: 2px;
}

/* --- Meal title --- */

.slide-header {
  text-align: center;
  flex-shrink: 0;
}

.meal-name {
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(22px, 4vw, 34px);
  color: var(--forest);
  letter-spacing: -0.02em;
  text-align: center;
}

/* --- PAX --- */

.pax-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  margin: clamp(2px, 0.5vw, 8px) 0;
}

.pax-number {
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(48px, 14vw, 100px);
  line-height: 0.9;
  color: var(--accent);
  letter-spacing: -0.04em;
}

.pax-label {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: clamp(13px, 2.5vw, 18px);
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Bloco "Quanto fazer" — CONTAINED SCROLL --- */

.scale-block {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(12px, 2.5vw, 20px) clamp(14px, 3vw, 20px);
  width: 100%;
  max-width: 560px;
  border: 1px solid rgba(44, 44, 44, 0.06);
  /* KEY: contained scroll */
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scale-title {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: clamp(11px, 1.8vw, 13px);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(44, 44, 44, 0.08);
  flex-shrink: 0;
}

/* --- Lista de itens (scrollable inside white card) --- */

.prod-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: clamp(12px, 1.8vw, 15px);
  line-height: 1.4;
  /* Scroll only vertical */
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.prod-category {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  opacity: 0.75;
  margin-top: 14px;
  margin-bottom: 6px;
  padding-left: 2px;
}

.prod-category:first-child { margin-top: 0; }

.prod-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-radius: 6px;
  min-height: 40px;
  transition: background 0.2s, opacity 0.3s;
  overflow: hidden;
}

.prod-item .nome {
  color: var(--text);
  font-weight: 600;
  font-size: clamp(13px, 2vw, 15px);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.3s, text-decoration-color 0.3s;
}

.prod-item .qty {
  color: var(--forest);
  font-weight: 700;
  font-size: clamp(12px, 1.8vw, 14px);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.3s;
}

.prod-item .per {
  color: var(--text-muted);
  font-size: clamp(10px, 1.5vw, 12px);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.3s;
}

.prod-item.proteina .qty { color: var(--accent); }

/* --- Checklist button --- */

.check-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 2px solid rgba(44, 44, 44, 0.15);
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, background 0.2s;
  padding: 0;
}

.check-btn:active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.check-icon {
  width: 15px;
  height: 15px;
  color: transparent;
  transition: color 0.2s;
}

/* Checked state */

.prod-item.is-checked {
  background: var(--checked-bg);
}

.prod-item.is-checked .check-btn {
  background: var(--forest);
  border-color: var(--forest);
}

.prod-item.is-checked .check-icon {
  color: var(--white);
}

.prod-item.is-checked .nome {
  color: var(--checked-text);
  text-decoration: line-through;
  text-decoration-color: var(--checked-text);
}

.prod-item.is-checked .qty,
.prod-item.is-checked .per {
  color: var(--checked-text);
}

/* Clickable (tem receita) */
.prod-item.clickable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.prod-item.clickable:hover { background: rgba(192, 80, 37, 0.06); }
.prod-item.clickable:active { background: rgba(192, 80, 37, 0.12); }

.prod-item.clickable .nome {
  text-decoration: underline;
  text-decoration-color: rgba(58, 78, 63, 0.25);
  text-underline-offset: 3px;
}

.prod-item.is-checked.clickable .nome {
  text-decoration: line-through;
  text-decoration-color: var(--checked-text);
}

/* --- Pagination dots --- */

.carousel__dots {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 clamp(12px, 3vw, 20px);
}

.carousel__dot {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(44, 44, 44, 0.08);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, transform 0.2s;
}

.carousel__dot.is-active {
  background: var(--forest);
  transform: scale(1.1);
}

.carousel__dot.is-active .dot-label {
  color: var(--white);
}

.dot-label {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1;
  transition: color 0.2s;
}

.dot-separator {
  width: 1px;
  height: 20px;
  background: rgba(44, 44, 44, 0.12);
  margin: 0 4px;
}

/* --- Overlay / Modal receita --- */

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.overlay.is-open { display: flex; }

.modal-receita {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-receita__header {
  flex-shrink: 0;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(44, 44, 44, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-receita__title {
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(18px, 3vw, 22px);
  color: var(--forest);
}

.modal-receita__pax {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
}

.modal-receita__close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.modal-receita__close:hover,
.modal-receita__close:focus {
  background: var(--accent-soft);
  color: var(--accent);
}

.modal-receita__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

.modal-receita__section { margin-bottom: 20px; }
.modal-receita__section:last-child { margin-bottom: 0; }

.modal-receita__section-title {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.modal-receita__ingredientes { list-style: none; }

.modal-receita__ingredientes li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(44, 44, 44, 0.06);
  font-size: 15px;
  line-height: 1.4;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.modal-receita__ingredientes li:last-child { border-bottom: none; }

.modal-receita__ingredientes .qty {
  font-weight: 700;
  color: var(--forest);
  white-space: nowrap;
}

.modal-receita__ingredientes .per-pax {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

.modal-receita__preparo { list-style: none; counter-reset: step; }

.modal-receita__preparo li {
  counter-increment: step;
  padding: 10px 0 10px 36px;
  position: relative;
  font-size: 15px;
  line-height: 1.5;
  border-bottom: 1px solid rgba(44, 44, 44, 0.06);
}

.modal-receita__preparo li:last-child { border-bottom: none; }

.modal-receita__preparo li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
}

.modal-receita__footer {
  flex-shrink: 0;
  padding: 16px 20px;
  border-top: 1px solid rgba(44, 44, 44, 0.08);
}

.modal-receita__footer .btn-fechar {
  width: 100%;
  padding: 14px 20px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--white);
  background: var(--forest);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.modal-receita__footer .btn-fechar:hover,
.modal-receita__footer .btn-fechar:focus { background: var(--accent); }

/* --- Café da manhã --- */

.scale-block--cafe .prod-item {
  min-height: 36px;
}

.scale-block--cafe .prod-item .nome {
  font-size: clamp(12px, 1.8vw, 14px);
  font-weight: 500;
}

.scale-block--cafe .prod-item .qty {
  font-size: clamp(10px, 1.5vw, 12px);
  font-weight: 600;
  color: var(--text-muted);
}

/* --- Receita partial extras --- */

.receita-nome {
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--forest);
  margin-bottom: 12px;
}

.receita-ponto {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  padding: 8px 12px;
  background: var(--accent-soft);
  border-radius: 6px;
}

.receita-obs {
  list-style: disc;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}

.receita-obs li { margin-bottom: 4px; }

.receita-erro {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 16px;
}

/* --- Swipe hint overlay (one-time on load) --- */

.swipe-hint {
  position: absolute;
  top: 8px;
  right: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  animation: swipeHintFade 3.5s ease-out 0.6s forwards;
}

.swipe-hint__arrow {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  opacity: 0.7;
  animation: swipeHintSlide 1.2s ease-in-out 0.6s 3;
}

.swipe-hint__arrow svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.swipe-hint__text {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent);
}

@keyframes swipeHintSlide {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(10px); }
}

@keyframes swipeHintFade {
  0% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* ==========================================================================
   MOBILE RESPONSIVE (iPhone / phones ≤ 480px)
   iPad (768px+) keeps all original values untouched.
   ========================================================================== */

@media (max-width: 480px) {
  /* Header: smaller logo, tighter padding */
  .screen-header {
    padding: 4px 12px;
  }
  .screen-header__logo {
    height: 36px;
  }
  .screen-header__date {
    font-size: 10px;
  }

  /* Screen: less top padding for smaller header */
  .screen {
    padding-top: 44px;
  }

  /* Slides: tighter padding */
  .carousel__slide {
    padding: 4px 10px;
  }

  /* Day label */
  .day-label {
    font-size: 10px;
    margin-bottom: 1px;
  }

  /* Meal name: smaller */
  .meal-name {
    font-size: 20px;
  }

  /* PAX: much smaller on mobile */
  .pax-number {
    font-size: 42px;
  }
  .pax-label {
    font-size: 12px;
  }
  .pax-block {
    margin: 2px 0;
  }

  /* White card: tighter padding */
  .scale-block {
    padding: 10px 12px;
    border-radius: 10px;
  }
  .scale-title {
    font-size: 10px;
    margin-bottom: 8px;
    padding-bottom: 6px;
  }

  /* Product list items: compact */
  .prod-list {
    font-size: 13px;
  }
  .prod-item {
    gap: 5px;
    padding: 5px 2px;
    min-height: 36px;
  }
  .prod-item .nome {
    font-size: 13px;
  }
  .prod-item .qty {
    font-size: 12px;
  }
  .prod-item .per {
    font-size: 10px;
  }

  /* Check button: slightly smaller */
  .check-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
  }
  .check-icon {
    width: 14px;
    height: 14px;
  }

  /* Category headers */
  .prod-category {
    font-size: 10px;
    margin-top: 10px;
    margin-bottom: 4px;
  }

  /* Café items: even more compact */
  .scale-block--cafe .prod-item {
    min-height: 32px;
  }
  .scale-block--cafe .prod-item .nome {
    font-size: 12px;
  }
  .scale-block--cafe .prod-item .qty {
    font-size: 10px;
  }

  /* Navigation dots: smaller */
  .carousel__dots {
    gap: 4px;
    padding: 6px 0 10px;
  }
  .carousel__dot {
    width: 28px;
    height: 28px;
    border-radius: 6px;
  }
  .dot-label {
    font-size: 11px;
  }
  .dot-separator {
    height: 16px;
    margin: 0 3px;
  }

  /* Modal: full-screen on mobile */
  .overlay {
    padding: 8px;
  }
  .modal-receita {
    max-width: 100%;
    max-height: 90vh;
  }
  .modal-receita__header {
    padding: 12px 14px;
  }
  .modal-receita__title {
    font-size: 18px;
  }
  .modal-receita__close {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .modal-receita__body {
    padding: 14px;
  }
  .modal-receita__ingredientes li {
    font-size: 14px;
  }
  .modal-receita__preparo li {
    font-size: 14px;
    padding-left: 30px;
  }
  .modal-receita__footer {
    padding: 10px 14px;
  }
  .modal-receita__footer .btn-fechar {
    padding: 12px 16px;
    font-size: 15px;
  }
}
