/* Reset e Base */
body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f4f6f8;
  color: #333;
  overflow: hidden;
}

/* Layout Principal */
#app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* Sidebar (Esquerda) */
#sidebar {
  width: 260px;
  background-color: #1a1a1a;
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  text-align: center;
  border-bottom: 1px solid #333;
  position: relative;
}

.sidebar-logo {
  max-width: 120px;
  height: auto;
  border-radius: 18px; /* combina bem com svg */
  background: #0b1220;
}

#category-nav {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.nav-item {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  text-align: left;
  background: none;
  border: none;
  color: #aaa;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid transparent;
}

.nav-item:hover {
  color: #fff;
  background-color: #2a2a2a;
}

.nav-item.active {
  color: #ffc107;
  background-color: #2a2a2a;
  border-left-color: #ffc107;
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid #333;
  font-size: 0.85rem;
}

.sidebar-footer a {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.whatsapp-icon {
  width: 20px;
  height: 20px;
  fill: #25D366;
}

/* Conteúdo Principal (Centro) */
#main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: #f4f6f8;
}

#mobile-menu-btn {
  display: none;
  padding: 1rem;
  background-color: #fff;
  border: none;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  font-weight: bold;
  font-size: 1.1rem;
  text-align: left;
  color: #1a1a1a;
  cursor: pointer;
}

#menu-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  align-content: flex-start;
}

.loading-container {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  font-size: 1.2rem;
  color: #666;
}

/* Itens do Menu */
.menu-item {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
}

.menu-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
  border-color: #ffc107;
}

.menu-item img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background-color: #eee;
}

.item-details {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.item-details h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: #1a1a1a;
}

.item-details .description {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.item-details .price-row {
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.item-details .price {
  font-weight: bold;
  color: #d92525;
  font-size: 1.2rem;
}

.add-btn {
  background: #ffc107;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font-weight: 800;
  color: #1a1a1a;
}

/* Carrinho Lateral (Direita) */
#cart-container {
  width: 320px;
  background: #fff;
  border-left: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  z-index: 200;
}

.cart-header {
  padding: 1.5rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#cart-items {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem;
}

.empty-cart-message {
  color:#666;
  text-align:center;
  padding: 1.5rem 0.5rem;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f0f0f0;
  gap: 10px;
}

.cart-item-info h4 { margin: 0 0 4px 0; font-size: 1rem; }
.cart-item-info span { font-size: 0.9rem; color: #666; display:block; }
.cart-item-info .extras { font-size: 0.85rem; color:#444; margin-top:6px; }

.remove-from-cart-btn {
  background: none; border: none; color: #ff4444;
  cursor: pointer; font-size: 1.2rem; margin-left: 8px;
}

.qty-controls{
  display:flex;
  align-items:center;
  gap: 6px;
  margin-top: 8px;
}
.qty-btn{
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
  cursor:pointer;
}
.qty-number{min-width: 18px; text-align:center; font-weight: 800; color:#111;}

.cart-footer {
  padding: 1.5rem;
  background: #f9f9f9;
  border-top: 1px solid #eee;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.delivery-info {
  font-size: 0.8rem;
  color: #888;
  text-align: center;
  margin-bottom: 1rem;
}

#checkout-button {
  width: 100%;
  padding: 1rem;
  background-color: #25D366;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}

#checkout-button:disabled { background-color: #ccc; cursor: not-allowed; }

/* Mobile */
.mobile-only { display: none; }

@media (max-width: 1024px) {
  #sidebar {
    position: absolute;
    height: 100%;
    transform: translateX(-100%);
  }

  #sidebar.active { transform: translateX(0); }
  #mobile-menu-btn { display: block; }
  .mobile-only { display: block; }

  #close-sidebar-btn {
    background: none; border: none; color: white;
    font-size: 2rem; cursor: pointer; position: absolute; top: 10px; right: 10px;
  }
}

@media (max-width: 768px) {
  #cart-container {
    position: fixed;
    right: 0; top: 0; height: 100%; width: 100%;
    transform: translateX(100%);
  }

  #cart-container.active { transform: translateX(0); }

  #mobile-cart-button {
    position: fixed; bottom: 20px; right: 20px;
    background-color: #ffc107; color: #000;
    border: none; border-radius: 50%; width: 60px; height: 60px;
    font-size: 1.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer; z-index: 500; display: flex;
    align-items: center; justify-content: center;
  }

  #mobile-cart-count {
    position: absolute; top: -5px; right: -5px;
    background: red; color: white; font-size: 0.8rem;
    padding: 4px 8px; border-radius: 12px;
  }

  #menu-container {
    padding: 1rem; padding-bottom: 90px;
    grid-template-columns: 1fr;
  }

  .menu-item { flex-direction: row; height: auto; }
  .menu-item img { width: 110px; height: 110px; aspect-ratio: 1/1; }
}

/* Modais */
.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 2000; display: none; justify-content: center; align-items: center;
}
.modal.visible { display: flex; }
#modal-backdrop {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); z-index: 1500; display: none;
}
#modal-backdrop.visible { display: block; }

.modal-content {
  background: #fff; width: 90%; max-width: 520px; max-height: 90vh;
  border-radius: 12px; overflow-y: auto; position: relative;
  padding: 1.5rem; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.close-btn {
  position: absolute; top: 10px; right: 15px;
  background: none; border: none; font-size: 2rem; cursor: pointer;
}

.modal-header h2{margin:0 0 6px 0; color:#111;}
.modal-header p{margin:0 0 10px 0; color:#666;}

/* Extras (adicionais/molhos) */
.extras-box{
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 12px;
  background: #fafafa;
  margin-top: 8px;
}
.extras-box h3{
  margin: 0 0 10px 0;
  font-size: 1rem;
  color:#111;
}
.extra-line{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.extra-line:last-child{border-bottom:none;}
.extra-left{display:flex; flex-direction:column; gap:2px;}
.extra-left strong{color:#111;}
.extra-left span{color:#666; font-size: 0.85rem;}
.extra-right{display:flex; align-items:center; gap:8px;}
.extra-right button{
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  cursor:pointer;
}
.extra-right b{min-width:18px; text-align:center; display:inline-block; color:#111;}

/* Quantidade no modal */
.quantity-control{
  display:flex;
  align-items:center;
  gap: 10px;
}
.quantity-btn{
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #fff;
  cursor:pointer;
  font-size: 1.2rem;
}
#modal-add-to-cart-btn{
  flex: 1;
  margin-left: 12px;
  padding: 1rem;
  background: #ffc107;
  color: #1a1a1a;
  border: none;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.modal-footer{
  display:flex;
  align-items:center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 10px;
}

/* Formulários */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-weight: 600; color:#111; }
.form-group input, .form-group select {
  width: 100%; padding: 0.8rem; border: 1px solid #ddd;
  border-radius: 6px; box-sizing: border-box;
}
.delivery-type-group{display:flex; gap: 14px; padding: 6px 0 10px;}
.delivery-type-group label{font-weight: 700; color:#111;}
.confirm-btn {
  width: 100%; padding: 1rem; background: #25D366;
  color: white; border: none; border-radius: 8px;
  font-weight: bold; font-size: 1.1rem; cursor: pointer;
}

/* Resumo do checkout */
.summary-box{
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 12px;
  background: #fafafa;
  margin-top: 10px;
}
.summary-row{
  display:flex;
  justify-content: space-between;
  align-items:center;
  padding: 6px 0;
  color:#111;
}
.summary-row.total{
  border-top: 1px solid #eaeaea;
  margin-top: 6px;
  padding-top: 10px;
  font-size: 1.05rem;
}
.checkout-status{
  margin: 10px 0 0;
  color:#111;
  font-weight: 700;
}

/* ===== Status da Loja (Cliente) ===== */
.store-status-bar{
  margin: 16px 2rem 0;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.store-status-left{
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.store-status-text{
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.store-status-title{
  font-weight: 900;
  letter-spacing: .2px;
  color: #111;
}

.store-status-sub{
  font-size: .92rem;
  color: #6b7280;
  line-height: 1.2;
  word-break: break-word;
}

.store-status-right{
  display: flex;
  align-items: center;
  gap: 10px;
}

.store-status-dot{
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #9ca3af;
  box-shadow: 0 0 0 4px rgba(156,163,175,.18);
  flex: 0 0 auto;
}

.store-hours-pill{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.10);
  background: #f3f4f6;
  font-weight: 900;
  color: #111;
  white-space: nowrap;
}

/* Cores por estado */
.store-status-bar[data-state="open"] .store-status-dot{
  background: #25D366;
  box-shadow: 0 0 0 4px rgba(37,211,102,.20);
}
.store-status-bar[data-state="preorder"] .store-status-dot{
  background: #ffc107;
  box-shadow: 0 0 0 4px rgba(255,193,7,.22);
}
.store-status-bar[data-state="closed"] .store-status-dot{
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,.18);
}

@media (max-width: 768px){
  .store-status-bar{
    margin: 12px 1rem 0;
    padding: 10px 12px;
  }
  #menu-container{
    padding-top: 1rem; /* mantém o respiro no mobile */
  }
}

@media (max-width: 420px){
  .store-status-bar{
    flex-direction: column;
    align-items: stretch;
  }
  .store-status-right{
    justify-content: flex-start;
    width: 100%;
  }
}

/* ===== Fade ao mudar de categoria ===== */
#menu-container.fade-swap{
  transition: opacity 180ms ease, transform 180ms ease;
  will-change: opacity, transform;
}

#menu-container.fade-swap.fade-out{
  opacity: 0;
  transform: translateY(6px);
}

#menu-container.fade-swap.fade-in{
  opacity: 1;
  transform: translateY(0);
}

/* ===== Status da loja na Sidebar ===== */
.store-status-sidebar{
  margin: 14px 14px 10px;
  padding: 10px 12px;
}
.store-status-sidebar .store-status-right{
  justify-content: flex-start;
}
.store-status-sidebar .store-hours-pill{
  padding: 6px 10px;
  font-size: .95rem;
}

/* Nav extra (Acompanhar pedido) */
.sidebar-extra{
  padding: 0 10px 10px;
}
.nav-item.nav-special{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
}
.nav-special-icon{
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
}

/* ===== Acompanhar Pedido (Cliente) ===== */
.track-view{
  padding: 18px 2rem 0;
}
.track-header{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.track-header h2{
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: .2px;
}
.track-back-btn{
  border: 0;
  background: transparent;
  color: #6b7280;
  font-weight: 800;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
}
.track-back-btn:hover{ background: rgba(0,0,0,.05); }

.track-card{
  margin-top: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  padding: 14px;
}
.track-help{
  margin: 0 0 12px;
  color: #6b7280;
  line-height: 1.35;
}
.track-form{
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}
.track-field{
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 800;
  color: #111;
  font-size: .92rem;
}
.track-field input{
  height: 44px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 0 12px;
  outline: none;
}
.track-field input:focus{
  border-color: #ffc107;
  box-shadow: 0 0 0 4px rgba(255,193,7,.18);
}
.track-search-btn{
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: #111;
  color: #fff;
  font-weight: 900;
  padding: 0 14px;
  cursor: pointer;
}
.track-search-btn:disabled{
  opacity: .55;
  cursor: not-allowed;
}
.track-error{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(239,68,68,.35);
  background: rgba(239,68,68,.08);
  color: #b91c1c;
  font-weight: 800;
}

.track-summary{
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.track-badges{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.track-status-pill{
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 900;
  border: 1px solid rgba(0,0,0,.12);
  background: #f3f4f6;
}
.track-status-pill[data-state="pending"]{ background: rgba(255,193,7,.16); border-color: rgba(255,193,7,.35); }
.track-status-pill[data-state="scheduled"]{ background: rgba(234,179,8,.18); border-color: rgba(234,179,8,.35); }
.track-status-pill[data-state="preparing"]{ background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.25); }
.track-status-pill[data-state="delivering"]{ background: rgba(168,85,247,.12); border-color: rgba(168,85,247,.25); }
.track-status-pill[data-state="completed"]{ background: rgba(37,211,102,.14); border-color: rgba(37,211,102,.30); }
.track-status-pill[data-state="cancelled"]{ background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.25); }

.track-meta{
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 900;
  border: 1px solid rgba(0,0,0,.10);
  background: #fff;
  color: #111;
}
.track-tip{
  color: #6b7280;
  font-weight: 800;
  line-height: 1.35;
}

/* Timeline */
.track-timeline{
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.track-step{
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
}
.track-dot{
  width: 14px;
  height: 14px;
  border-radius: 999px;
  margin-top: 4px;
  background: #d1d5db;
  box-shadow: 0 0 0 4px rgba(209,213,219,.35);
}
.track-step.done .track-dot{
  background: #25D366;
  box-shadow: 0 0 0 4px rgba(37,211,102,.18);
}
.track-step.active .track-dot{
  background: #ffc107;
  box-shadow: 0 0 0 4px rgba(255,193,7,.22);
}
.track-step-title{
  font-weight: 900;
  color: #111;
}
.track-step-desc{
  color: #6b7280;
  font-weight: 700;
  margin-top: 2px;
  line-height: 1.3;
}

@media (max-width: 900px){
  .track-form{
    grid-template-columns: 1fr;
  }
  .track-view{
    padding: 14px 1rem 0;
  }
}
