/* ─── GLOBALS & SELECTION CONTROL ─── */
* {
  -webkit-tap-highlight-color: transparent; /* Remove o brilho azul ao tocar em qualquer elemento */
  -webkit-touch-callout: none; /* Impede menus de contexto em imagens/links no mobile */
  outline: none !important;
  user-select: none; /* Bloqueia seleção global */
  -webkit-user-select: none;
}

#footer-address,
#footer-hours tr td {
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* ─── COMPONENTES ─── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer {
  background: linear-gradient(90deg, 
    var(--color-skeleton-bg) 0%, 
    var(--color-skeleton-shimmer) 50%, 
    var(--color-skeleton-bg) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
  border-radius: var(--radius-sm);
}

/* Skeleton de Imagem */
.image-skeleton-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--color-surface-alt);
  overflow: hidden;
}

.image-skeleton-wrapper .shimmer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  border-radius: 0;
}

.image-skeleton-wrapper img {
  opacity: 0;
  transition: opacity 0.4s ease;
  position: relative;
  z-index: 2;
}

.image-skeleton-wrapper.loaded img {
  opacity: 1;
}

.image-skeleton-wrapper.loaded .shimmer {
  display: none;
}

.skeleton-card {
  height: 122px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  pointer-events: none;
}

.skeleton-section {
  margin-bottom: var(--space-8);
  width: 100%;
}

/* Container Principal Mobile-First */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
  background-color: var(--color-bg);
  min-height: 100vh;
  box-shadow: 0 0 100px rgba(0,0,0,0.1); 
  user-select: none; /* Bloqueia seleção global para evitar "azul de fundo" */
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; /* Remove flash azul/cinza ao tocar em elementos */
  overscroll-behavior-y: contain; /* Impede que o scroll do site "vaze" para o fundo */
}

/* Área de Texto Selecionável - Restrito agora apenas ao Modal de Detalhes */
.item-modal-title, 
.item-modal-desc {
  user-select: text;
  -webkit-user-select: text;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge-mais-pedido {
  background-color: var(--color-primary);
  color: var(--color-text-on-primary);
}

.badge-novidade {
  background-color: var(--color-primary);
  color: var(--color-text-on-primary);
}

.badge-promocao {
  background-color: var(--color-accent);
  color: var(--color-surface);
}

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--transition-base);
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-text-on-primary);
  box-shadow: 0 4px 15px rgba(212, 160, 23, 0.3);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 160, 23, 0.4);
}

.btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background-color: var(--color-primary);
  color: var(--color-text-on-primary);
  transition: all var(--transition-base);
  border: none;
  cursor: pointer;
}

.btn-add:hover {
  transform: rotate(90deg) scale(1.1);
  background-color: var(--color-primary-dark);
}

/* Controlador de Quantidade Inline no Cardápio */
.item-control-container {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.quantity-selector-inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background-color: var(--color-surface-alt);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  animation: fadeInOut 0.2s ease;
}

.qty-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background-color: var(--color-surface);
  color: var(--color-primary);
  border: none;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.qty-btn:hover,
.qty-btn:active {
  background-color: var(--color-primary);
  color: var(--color-text-on-primary);
  border-color: var(--color-primary);
}

.qty-btn svg {
  display: block;
}

.qty-value-inline {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  color: var(--color-text-primary);
}

@keyframes fadeInOut {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Drawer Cart Header & Clear Button */
.cart-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.cart-drawer-title {
  font-family: var(--font-header);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.btn-clear-cart {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.btn-clear-cart:hover {
  background-color: #fee2e2;
  color: #ef4444;
}

.btn-clear-cart svg {
  opacity: 0.7;
}

.btn-add svg {
  display: block;
  color: inherit;
}

.btn-add:hover {
  background-color: var(--color-primary);
  color: var(--color-text-on-primary);
  border-color: var(--color-primary);
}

.btn-whatsapp {
  background-color: #25D366; /* Verde do WhatsApp padrão (hardcode permitido aqui caso o cliente mude o primary) */
  color: #FFF;
  width: 100%;
  padding: var(--space-3);
  font-size: var(--text-base);
  border-radius: var(--radius-md);
}

.btn-whatsapp:hover {
  background-color: #1EBE5D;
}

.btn-outline {
  border: 1px solid var(--color-border);
  background-color: transparent;
  color: var(--color-text-primary);
}

.btn-icon {
  background: none;
  border: none;
  font-size: var(--text-xl);
  color: var(--color-text-primary);
  cursor: pointer;
  padding: var(--space-1);
}

/* Loading States para Botões (Reticências Animadas) */
.btn-loading {
  position: relative !important;
  pointer-events: none;
  opacity: 0.8;
  color: transparent !important; /* Esconde o texto original sem mudar o tamanho */
}

.btn-loading::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  text-align: center;
  color: white; /* Cor padrão para botões primários */
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2px;
  animation: dotsPulse 1.4s infinite steps(4);
}

/* Garante que o ponto continue legível em botões claros */
.btn-outline.btn-loading::after {
  color: var(--color-text-primary);
}

@keyframes dotsPulse {
  0% { content: ''; }
  25% { content: '●'; }
  50% { content: '●●'; }
  75%, 100% { content: '●●●'; }
}

/* Mensagens de Feedback */
.error-message {
  background-color: #fee2e2;
  color: #b91c1c;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  border-left: 4px solid #ef4444;
  display: none; /* Escondido por padrão */
  animation: fadeInUp 0.3s ease;
}

.error-message.active {
  display: block;
}

/* Container do Cardápio */
#menu-container {
  min-height: 100vh;
}

/* Cards de Itens */
.item-card {
  display: flex;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  transition: all var(--transition-base);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  position: relative;
  /* overflow: hidden removido para permitir que os selos (badges) fiquem sobrepostos no topo */
}

.item-card.has-badge {
  border: 2px solid var(--color-primary);
}

.item-card.is-promo {
  border: 2px solid var(--color-accent) !important;
}

.item-badges-container {
  position: absolute;
  top: -12px;
  left: 12px;
  z-index: 20;
}

.item-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.item-card-image {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-md);
  background-color: var(--color-surface-alt);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.02);
}

.item-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  pointer-events: none; /* Impede arraste da imagem */
  -webkit-touch-callout: none; /* Impede menu de "Salvar Imagem" no mobile */
}

.item-card:hover .item-card-image img {
  transform: scale(1.1);
}

.item-card-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-1);
}

.item-card-title {
  font-family: var(--font-display); /* Fraunces */
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.item-card-desc {
  font-family: var(--font-body); /* Outfit */
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
  margin-bottom: var(--space-2);
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.item-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-card-price-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.price-old-label {
  font-size: 0.8rem;
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  opacity: 0.7;
}

.price-original {
  text-decoration: line-through;
}

.item-card-price {
  font-family: var(--font-ui);
  font-weight: 800;
  color: var(--color-text-primary); /* Preço padrão em preto */
  font-size: var(--text-base);
  white-space: nowrap; /* Garante que R$ e valor fiquem na mesma linha */
}

.promotional-amount {
  color: var(--color-promotion); /* Somente o valor numérico em verde novamente */
}

/* No modal o preço atual tbm deve ser destacado */
.price-current {
  font-family: var(--font-ui);
  font-weight: 800;
  color: var(--color-text-primary);
  font-size: var(--text-xl);
  white-space: nowrap; /* Garante que R$ e valor fiquem na mesma linha no modal */
}

/* Removido seletor antigo que pintava o texto todo */

/* Badges sobrepostas removidas - Novo sistema flutuante acima */

/* Modais e Drawers */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.4); /* Overlay mais suave */
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  backdrop-filter: blur(8px); /* Blur mais elegante */
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Drawer do Carrinho */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 400px;
  height: 100vh;
  height: 100dvh; /* Altura dinâmica para lidar com barras de navegadores mobile */
  background-color: var(--color-surface);
  z-index: 101;
  box-shadow: -10px 0 50px rgba(0,0,0,0.1);
  transition: right var(--transition-base);
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}

.cart-drawer.active {
  right: 0;
}

.cart-drawer-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-drawer-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.cart-drawer-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.cart-drawer-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface);
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px dashed var(--color-border);
}

.cart-item-info {
  flex-grow: 1;
}

.cart-item-title {
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}

.cart-item-price-wrapper {
  display: flex;
  flex-direction: column;
}

.cart-item-info .price-original {
  font-size: 0.75rem;
}

.cart-item-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.cart-item-price.promotional {
  color: var(--color-promotion);
}

.cart-drawer-savings {
  margin: var(--space-4) 0;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--color-promotion);
  border: 1px dashed rgba(39, 174, 96, 0.2);
}

.savings-amount {
  font-weight: 800;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding-right: var(--space-2);
}

.cart-item-qty {
  font-weight: 600;
  font-family: var(--font-ui);
  text-align: center;
  min-width: 16px;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  font-weight: 700;
  font-size: var(--text-lg);
  font-family: var(--font-ui);
}

/* Modal Detalhe de Item */
.item-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 440px;
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  z-index: 102;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.item-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.item-modal-image {
  width: 100%;
  height: 250px;
  background-color: var(--color-surface-alt);
  position: relative;
}

.item-modal-image img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Preenchimento total no modal */
  background-color: var(--color-bg);
  pointer-events: none;
  -webkit-touch-callout: none;
}

.btn-close-modal {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  background-color: var(--color-glass);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  z-index: 2;
  transition: var(--transition-theme);
}

.item-modal-content {
  padding: var(--space-4);
  overflow-y: auto;
}

.item-modal-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.item-modal-desc {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
}

.item-modal-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.item-modal-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background-color: var(--color-surface-alt);
  padding: var(--space-1);
  border-radius: var(--radius-full);
}

/* Botão de Alternância de Tema */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  font-size: 20px;
  cursor: pointer;
  z-index: 90;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

/* No Menu (index.html), ele fica fixo no topo esquerdo oposto ao carrinho */
.app-header .theme-toggle-btn {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
}

.theme-toggle-btn:hover {
  background-color: var(--color-surface-alt);
  transform: translateY(-2px);
}

/* Admin Collapsible Sections */
.admin-collapsible-section {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-8);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.admin-section-header {
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background-color: var(--color-surface);
  transition: background-color var(--transition-fast);
}

.admin-section-header:hover {
  background-color: var(--color-surface-alt);
}

.admin-section-header h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.toggle-icon {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.admin-collapsible-content {
  padding: var(--space-6);
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.4s ease-out, padding 0.4s ease-out, opacity 0.3s ease;
  opacity: 1;
}

/* Admin Collapsible Sections ... (existing lines) ... */
.admin-collapsible-content.collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  border-top: none;
}
/* Força altura automática quando expandido para evitar cortes */
.admin-collapsible-content:not(.collapsed) {
  max-height: 5000px; /* Valor seguro bem alto */
}

/* Ajustes finos de responsividade para itens */
@media (max-width: 380px) {
  .item-card {
    padding: var(--space-3);
    gap: var(--space-3);
  }
  .item-card-image {
    width: 75px;
    height: 75px;
  }
  .item-card-title {
    font-size: 0.95rem;
  }
}

/* Badge de Status (Aberto/Fechado) no Header */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 4px;
}

.status-badge.open {
  background-color: rgba(34, 197, 94, 0.1);
  color: var(--color-status-open);
}

.status-badge.closed {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-status-closed);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Admin Schedule Components */
.admin-status-control {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--color-surface-alt);
  margin-top: var(--space-4);
  margin-bottom: var(--space-8);
}

.switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--color-status-closed);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.schedule-grid {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-4);
}

.schedule-grid {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-4);
}

.schedule-day-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.schedule-day-row:last-child {
  border-bottom: none;
}

.day-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.schedule-time-inputs {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  justify-content: center;
}

.time-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.time-field small {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  letter-spacing: 0.5px;
  display: block;
}

.schedule-time-inputs input[type="time"] {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  width: 130px;
}

.schedule-closed-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  min-width: 90px;
  justify-content: flex-end;
}

/* Estado Fechado */
.schedule-day-row.day-closed {
  opacity: 0.4;
}
.schedule-day-row.day-closed .schedule-time-inputs {
  pointer-events: none;
}

/* Responsivo para celular */
@media (max-width: 600px) {
  .schedule-day-row {
    grid-template-columns: 1fr auto;
    padding: var(--space-4) 0;
  }
  .schedule-time-inputs {
    grid-column: span 2;
    justify-content: flex-start;
    gap: var(--space-3);
  }
  .schedule-time-inputs input[type="time"] {
    flex: 1;
    width: auto;
  }
}

/* Ajuste para ícone do time input - apenas quando o tema DARK do app estiver ativo */
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
