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

:root {
  --primary: #c41e3a;
  --primary-dark: #a01830;
  --secondary: #f5a623;
  --background: #faf9f6;
  --card-bg: #ffffff;
  --text: #333333;
  --text-muted: #666666;
  --border: #e5e5e5;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --radius: 12px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: 120px;
}

/* HEADER (não é fixo) */
.header {
  position: relative;
  z-index: 10;
  background: var(--background);
}

.header-profile {
  padding: 0;
}

.header-cover {
  height: 120px;
  background:
    radial-gradient(1200px 260px at 50% -60%, rgba(245, 166, 35, 0.35), transparent 55%),
    linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.header-shell {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px 14px 16px;
}

.header-card {
  margin-top: -54px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14);
  padding: 58px 16px 16px 16px;
  position: relative;
  text-align: center;
}

/* LOGO CENTRALIZADO */
.header-logo-wrap {
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: #fff;
  border: 3px solid #fff;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  position: absolute;
  left: 50%;
  top: -46px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-info {
  max-width: 520px;
  margin: 0 auto;
}

.store-name {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.2px;
  color: var(--text);
  word-break: break-word;
}

.store-subline {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.dot {
  opacity: 0.7;
}

.store-mode {
  color: var(--primary);
  font-weight: 800;
}

.header-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  align-items: center;
}

/* STATUS */
.store-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.store-status.open {
  background: rgba(34, 197, 94, 0.15);
  color: #166534;
  border: 1px solid rgba(34, 197, 94, 0.30);
}

.store-status.closed {
  background: rgba(239, 68, 68, 0.14);
  color: #7f1d1d;
  border: 1px solid rgba(239, 68, 68, 0.30);
}

/* PÍLULAS */
.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
}

.meta-pill:empty {
  display: none;
}

.meta-eta {
  background: rgba(245, 166, 35, 0.16);
  border: 1px solid rgba(245, 166, 35, 0.28);
  color: #8a5200;
  font-weight: 800;
}

.header-hint {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.header-hint strong {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* BOTÃO WHATSAPP NO CANTO DO CARD */
.header-wa {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(37, 211, 102, 0.95);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s, filter 0.2s;
}

.header-wa:active {
  transform: scale(0.95);
}

.header-wa-icon {
  width: 22px;
  height: 22px;
}

.closed-warning {
  background: #fef3cd;
  color: #856404;
  padding: 12px 16px;
  text-align: center;
  font-weight: 500;
  font-size: 0.9rem;
}

.main-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

.menu-section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
}

.menu-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.menu-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
}

.menu-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}

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

.menu-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-word;
}

.menu-card-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}

.menu-card-weight {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(196, 30, 58, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
  margin: 0 0 4px 0;
  line-height: 1;
}

.menu-card-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.menu-card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 6px;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--background);
  padding: 6px 12px;
  border-radius: 25px;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.qty-btn.minus {
  background: var(--border);
  color: var(--text);
}

.qty-btn.plus {
  background: var(--primary);
  color: white;
}

.qty-btn:active {
  transform: scale(0.95);
}

.qty-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.qty-value {
  font-size: 1.1rem;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

.menu-card.out-of-stock {
  opacity: 0.72;
}

.out-of-stock-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--danger);
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 6px 10px;
  border-radius: 999px;
  letter-spacing: 0.4px;
}

.out-of-stock-bar {
  margin-top: 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px dashed rgba(239, 68, 68, 0.5);
  color: var(--danger);
  font-weight: 800;
  text-align: center;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
}

.out-of-stock-sub {
  display: block;
  margin-top: 2px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* escondido pra não confundir */
.help-button {
  display: none;
}

.whatsapp-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease-in-out;
}

.footer.expanded {
  padding-top: 20px;
}

.footer.expanded .cart-summary-items {
  max-height: 220px;
  overflow-y: auto;
}

.cart-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.cart-summary-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 72px;
  overflow: hidden;
}

.cart-item-line {
  font-size: 0.8rem;
  color: var(--text);
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
  word-break: break-word;
}

.cart-more {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.cart-more.clickable {
  cursor: pointer;
  color: var(--primary);
  text-decoration: underline;
  padding: 4px 0;
}

.cart-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cart-total-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 4px;
}

.checkout-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.checkout-btn:active {
  background: var(--primary-dark);
}

.checkout-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  max-width: 500px;
  margin: 0 auto;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--primary);
  color: white;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-body {
  padding: 16px;
}

.order-summary {
  background: var(--background);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.order-summary-bottom {
  margin-top: 14px;
  margin-bottom: 18px;
}

.order-summary h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.order-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.order-item:last-child {
  border-bottom: none;
}

.order-total {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid var(--primary);
  text-align: right;
  font-size: 1.1rem;
}

.form-section {
  margin-bottom: 20px;
}

.form-section h3 {
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 12px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  max-width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group select {
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.flex-1 {
  flex: 1;
  min-width: 0;
}

.flex-2 {
  flex: 2;
  min-width: 0;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.btn-primary {
  flex: 2;
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  flex: 1;
  background: white;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.delivery-fee-info {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.toast {
  position: fixed;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 0.9rem;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
}

.redirect-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.redirect-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
}

.redirect-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.redirect-text {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.redirect-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

.redirect-cancel,
.redirect-go {
  border: none;
  border-radius: 999px;
  padding: 12px 14px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}

.redirect-cancel {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
}

.redirect-go {
  background: var(--primary);
  color: white;
}

.redirect-go:active {
  background: var(--primary-dark);
}

.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 4px;
  text-align: center;
}

.loading-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.loading-sub {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.progress-ring {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background: conic-gradient(var(--primary) 0deg, rgba(0,0,0,0.10) 0deg);
  position: relative;
}

.progress-ring::after {
  content: "";
  position: absolute;
  inset: 10px;
  background: var(--card-bg);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.progress-percent {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--primary);
  z-index: 1;
}

@media (max-width: 520px) {
  .form-group select {
    -webkit-appearance: menulist;
    appearance: menulist;
    background-image: none;
    padding-right: 12px;
  }

  .modal {
    padding: 10px;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  .header-cover {
    height: 112px;
  }

  .header-card {
    margin-top: -52px;
    border-radius: 16px;
    padding: 56px 14px 14px 14px;
  }

  .header-logo-wrap {
    width: 86px;
    height: 86px;
    top: -43px;
  }

  .store-name {
    font-size: 1.08rem;
  }

  .header-wa {
    width: 42px;
    height: 42px;
    right: 10px;
    top: 10px;
  }

  .checkout-btn {
    padding: 12px 16px;
    font-size: 0.85rem;
  }

  .cart-item-line {
    font-size: 0.75rem;
  }

  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .toast {
    bottom: 130px;
  }
}

@media (max-height: 650px) {
  .modal {
    align-items: flex-start;
  }

  .modal-content {
    margin: 6px auto;
  }
}

@supports (-webkit-touch-callout: none) {
  .form-group select {
    font-size: 16px;
  }
}
