/* ===== Reset & base ===== */
* {
  box-sizing: border-box;
}

:root {
  --cream: #FBF3E4;
  --cream-soft: #FDF9F1;
  --card-bg: #FFFFFF;
  --blue-baby: #AFD8EF;
  --blue-baby-dark: #6FB3DA;
  --gold: #C9A24B;
  --gold-dark: #A5822F;
  --text-dark: #33291A;
  --text-muted: #6B5F4E;
  --border-soft: #EFE2C8;
  --success: #4C8C5A;
  --danger: #B3452F;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 2px 10px rgba(51, 41, 26, 0.08);
  --shadow-elevated: 0 6px 20px rgba(51, 41, 26, 0.18);
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream);
  color: var(--text-dark);
  line-height: 1.45;
  padding-bottom: 104px; /* space for floating calculator */
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

/* ===== Header ===== */
.site-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px 16px 10px;
  background: var(--cream-soft);
  border-bottom: 1px solid var(--border-soft);
}

.brand-logo {
  height: 68px;
  width: auto;
}

/* ===== Main layout ===== */
.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

/* ===== Intro ===== */
.intro {
  text-align: center;
  padding: 6px 4px 0;
}

.intro h1 {
  font-size: 1.5rem;
  margin: 0 0 6px;
  color: var(--text-dark);
}

.intro-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ===== Catalog ===== */
.catalog-header h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.catalog-sub {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.product-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===== Product card ===== */
.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-card.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 162, 75, 0.2), var(--shadow-card);
}

.product-media {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--cream-soft);
  overflow: hidden;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-name {
  margin: 0;
  font-size: 1.08rem;
  color: var(--text-dark);
}

.product-price {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gold-dark);
}

.price-unit {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.product-subtotal {
  margin: 0;
  align-self: flex-start;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--success);
  background: #E8F4EA;
  padding: 6px 12px;
  border-radius: 999px;
}

.btn-select-product {
  border: none;
  border-radius: var(--radius-md);
  padding: 13px 14px;
  background: var(--blue-baby-dark);
  color: #fff;
  font-weight: 700;
  font-size: 0.96rem;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn-select-product:active {
  transform: scale(0.98);
}

.btn-select-product.btn-selected {
  background: var(--success);
  cursor: default;
}

.btn-select-product.btn-selected:active {
  transform: none;
}

.btn-select-product:disabled {
  opacity: 1;
}

.btn-flavor-toggle {
  border: 1px dashed var(--gold);
  border-radius: var(--radius-md);
  background: #FBF0D9;
  color: var(--gold-dark);
  font-weight: 700;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 0.92rem;
  transition: background 0.15s ease;
}

.btn-flavor-toggle:hover {
  background: #F7E6C0;
}

/* ===== Flavor selection panel ===== */
.flavor-panel {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flavor-panel-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.flavor-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flavor-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: var(--cream-soft);
  border-radius: var(--radius-sm);
}

.flavor-row-name {
  font-size: 0.9rem;
  color: var(--text-dark);
  flex: 1 1 auto;
  min-width: 0;
}

/* ===== Quantity control (-, text field, +) ===== */
.qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.qty-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: none;
  background: var(--blue-baby);
  color: var(--text-dark);
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
}

.qty-btn:hover {
  background: var(--blue-baby-dark);
  color: #fff;
}

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

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

.qty-input {
  width: 44px;
  text-align: center;
  font-size: 1rem;
  font-weight: 800;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  padding: 6px 2px;
  color: var(--text-dark);
  background: #fff;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-input[type="number"] {
  -moz-appearance: textfield;
}

/* ===== Order summary ===== */
.order-summary h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.summary-empty {
  text-align: center;
  padding: 18px 8px;
  color: var(--text-muted);
}

.summary-empty p {
  margin: 0 0 4px;
}

.summary-empty-hint {
  font-size: 0.85rem;
}

.summary-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-group-title {
  font-weight: 800;
  color: var(--gold-dark);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}

.summary-list .summary-group-title:first-child {
  margin-top: 0;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.92rem;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-soft);
}

.summary-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.summary-item-name {
  color: var(--text-dark);
}

.summary-item-qty {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
  padding-left: 10px;
}

.summary-totals {
  border-top: 1px solid var(--border-soft);
  padding-top: 10px;
  margin-top: 4px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  padding: 3px 0;
  color: var(--text-muted);
}

.summary-row-total {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark);
  padding-top: 6px;
}

.summary-row-total span:last-child {
  color: var(--gold-dark);
}

.order-message {
  margin: 12px 0 0;
  font-size: 0.88rem;
  text-align: center;
  min-height: 1.2em;
  color: var(--text-muted);
}

.order-message.error {
  color: var(--danger);
  font-weight: 600;
}

.order-message.ok {
  color: var(--success);
  font-weight: 600;
}

/* ===== Send button ===== */
.btn-send {
  width: 100%;
  margin-top: 10px;
  padding: 15px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--success);
  color: #fff;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn-send:active {
  transform: scale(0.98);
}

.btn-send:disabled {
  background: #C9C2B2;
  cursor: not-allowed;
}

/* ======================================================
   CALCULADORA INTERATIVA FLUTUANTE
   Fixa no canto inferior direito, acompanha o scroll da página
   ====================================================== */
.floating-calc {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  max-height: calc(100vh - 28px);
}

.calc-fab {
  display: flex;
  align-items: center;
  gap: 9px;
  border: none;
  border-radius: 999px;
  padding: 13px 18px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #fff;
  box-shadow: var(--shadow-elevated);
  cursor: pointer;
  position: relative;
  transition: transform 0.1s ease;
}

.calc-fab:active {
  transform: scale(0.96);
}

.calc-fab-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.calc-fab-total {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.calc-fab-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  background: var(--danger);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--cream);
}

.calc-panel {
  width: min(360px, calc(100vw - 28px));
  max-height: min(72vh, 560px);
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calc-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--blue-baby-dark);
  color: #fff;
}

.calc-panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.calc-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.calc-clear-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.calc-clear-btn:hover {
  background: rgba(255, 255, 255, 0.32);
}

.calc-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.calc-empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.calc-list {
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
}

.calc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--cream-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
}

.calc-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.calc-item-name {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-item-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-item-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.calc-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--blue-baby);
  color: var(--text-dark);
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.calc-qty-btn:hover {
  background: var(--blue-baby-dark);
  color: #fff;
}

.calc-item-qty {
  min-width: 24px;
  text-align: center;
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--gold-dark);
}

.calc-footer {
  border-top: 1px solid var(--border-soft);
  padding: 13px 16px calc(13px + env(safe-area-inset-bottom));
  background: var(--cream-soft);
  flex: 0 0 auto;
}

.calc-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.calc-total-row span:first-child {
  font-weight: 700;
  color: var(--text-dark);
  font-size: 0.94rem;
}

.calc-total-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--gold-dark);
  letter-spacing: 0.2px;
}

.calc-footer .btn-send {
  margin-top: 0;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  background: var(--text-dark);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 55;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ===== Responsive: tablet & desktop ===== */
@media (min-width: 560px) {
  .app-main {
    padding: 24px;
  }

  .order-summary {
    padding: 20px;
  }
}

@media (min-width: 860px) {
  .site-header {
    padding: 22px 16px;
  }

  .brand-logo {
    height: 78px;
  }

  .app-main {
    max-width: 960px;
    padding: 32px 24px 60px;
    gap: 22px;
  }

  .intro h1 {
    font-size: 1.85rem;
  }

  .product-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    align-items: start;
  }

  .floating-calc {
    right: 24px;
    bottom: 24px;
  }

  .calc-panel {
    width: 380px;
  }

  body {
    padding-bottom: 40px;
  }
}

@media (min-width: 1200px) {
  .product-list {
    grid-template-columns: repeat(3, 1fr);
  }
}
