/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary:      #0f4c81; /* Azul Corporativo */
  --primary-mid:  #1d70b8; /* Azul Claro/Brilhante */
  --primary-light:#e6f0f5; /* Azul Suave */
  --gold:         #d4a017; /* Destaques em Ouro */
  --gold-light:   #fdf3d0;
  --white:        #ffffff;
  --gray-light:   #f5f5f5;
  --gray-text:    #5c6e5e;
  --shadow:       0 4px 20px rgba(15, 76, 129, 0.08);
  --radius:       16px;
}

html, body {
  height: 100%;
  background: var(--primary-light);
  color: #0a2540;
  overflow-x: hidden;
}

/* ===== PAGES ===== */
.page {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
  position: relative;
}

.page.active {
  display: flex;
}

/* ===== HEADER ===== */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  padding: 40px 24px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  box-shadow: 0 4px 15px rgba(15, 76, 129, 0.15);
}

.logo {
  width: 120px;
  height: 120px;
  background: white;
  border-radius: 50%;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  object-fit: contain;
}

.brand-name {
  color: white;
  font-size: 24px;
  font-weight: 800;
  margin-top: 16px;
  letter-spacing: 0.5px;
}

.brand-sub {
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  margin-top: 4px;
}

/* ===== HEADER REDUZIDO (PÁGINA 2 E 3) ===== */
.header-small {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 3px 12px rgba(15, 76, 129, 0.12);
  height: 68px;
}

.header-small-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-small {
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 50%;
  padding: 3px;
  object-fit: contain;
}

.brand-name-small {
  color: white;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
}

.btn-back {
  position: absolute;
  left: 14px;
  top: 16px;
  background: rgba(255,255,255,0.12);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-back:active {
  background: rgba(255,255,255,0.25);
}

/* ===== CONTENT ===== */
.content {
  flex: 1;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ===== PAGE 1 ===== */
.welcome-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
}

.welcome-sub {
  font-size: 14px;
  color: #4a607a;
  text-align: center;
  margin-top: -12px;
  line-height: 1.5;
}

.form-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  border: 1px solid #d2e1e9;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-group input {
  border: 2px solid var(--input);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  color: #0a2540;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--gray-light);
  width: 100%;
}

.input-group input:focus {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px rgba(29, 112, 184, 0.12);
  background: white;
}

/* ===== BOTÃO PRIMÁRIO ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(15, 76, 129, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
  width: 100%;
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(15, 76, 129, 0.15);
}

/* ===== PAGE 2: MENU ===== */
.pedido-info {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #b8cfdb;
}

.pedido-badge, .cidade-badge {
  font-size: 13px;
  color: var(--primary);
  background: white;
  border-radius: 8px;
  padding: 5px 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.menu-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
}

.menu-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.menu-card {
  background: var(--white);
  border: 2px solid #d2e1e9;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  width: 100%;
  text-align: left;
}

.menu-card:active {
  transform: scale(0.98);
  border-color: var(--primary-mid);
  background: var(--primary-light);
}

.menu-icon-wrap {
  font-size: 24px;
  background: var(--primary-light);
  color: var(--primary);
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-label {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.menu-arrow {
  font-size: 22px;
  color: var(--gold);
  font-weight: 700;
}

/* ===== PAGE 3: CONFIRMAÇÃO ===== */
.confirmacao-content {
  justify-content: center;
}

.confirmacao-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 20px;
  box-shadow: var(--shadow);
  border: 1px solid #d2e1e9;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  text-align: center;
}

.confirmacao-icon-wrap {
  background: var(--primary-light);
  border-radius: 50%;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #b8cfdb;
}

.confirmacao-icon {
  font-size: 32px;
}

.confirmacao-titulo {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.confirmacao-opcao {
  font-size: 12px;
  color: #4a607a;
  background: var(--gray-light);
  border-radius: 20px;
  padding: 6px 14px;
  display: inline-block;
}

.confirmacao-mensagem {
  background: var(--gold-light);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  padding: 14px;
  width: 100%;
  text-align: left;
}

.confirmacao-mensagem p {
  font-size: 14px;
  color: #5a3e00;
  line-height: 1.5;
}

.email-box {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 14px;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  border: 1px solid #b8cfdb;
}

.email-icon {
  font-size: 20px;
}

.email-box p {
  font-size: 13px;
  color: var(--primary);
  line-height: 1.5;
}

.confirmacao-dica {
  background: #fff8e1;
  border-radius: 10px;
  padding: 12px;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  border: 1px solid #ffe082;
}

.confirmacao-dica span {
  font-size: 16px;
}

.confirmacao-dica p {
  font-size: 11px;
  color: #7a5800;
  line-height: 1.5;
}

.btn-voltar-menu {
  margin-top: 8px;
}

/* ===== PAGE 4: ERRO / ATUALIZAÇÃO ===== */
.erro-content {
  justify-content: center;
}

.erro-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px 24px;
  box-shadow: var(--shadow);
  border: 1px solid #d2e1e9;
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-items: center;
  text-align: center;
}

.erro-spinner-container {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.erro-spinner {
  width: 100%;
  height: 100%;
  border: 4px solid var(--primary-light);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
  position: absolute;
}

.erro-icon {
  font-size: 32px;
  animation: pulse 2s ease-in-out infinite;
}

.erro-titulo {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.erro-mensagem {
  font-size: 16px;
  font-weight: 700;
  color: #c23b22; /* Destaque em vermelho para chamar atenção */
  line-height: 1.4;
}

.erro-barra-progresso {
  width: 100%;
  height: 8px;
  background: var(--primary-light);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.erro-progresso-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-mid) 100%);
  width: 0%;
  border-radius: 4px;
  animation: progressLoad 4s ease-in-out infinite;
}

.erro-subtext {
  font-size: 13px;
  color: var(--gray-text);
  line-height: 1.6;
}

/* ===== ANIMATIONS ===== */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}

@keyframes progressLoad {
  0% { width: 0%; }
  20% { width: 15%; }
  50% { width: 45%; }
  80% { width: 85%; }
  100% { width: 100%; }
}

/* ===== FOOTER ===== */
.footer-brand {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: #8fa0b5;
  border-top: 1px solid #f0f4f8;
}

/* ===== DESKTOP FALLBACK ===== */
@media (min-width: 481px) {
  body {
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
  }

  .page {
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(15, 76, 129, 0.12);
    min-height: 750px;
  }
}
