/* ============================================================
   Estilos propios de El Oasis
   Mobile first: tamaños táctiles, safe-area y sin zoom en iOS
   ============================================================ */

:root {
  color-scheme: dark;
}

html {
  height: 100%;
}

html, body {
  margin: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* dvh evita el salto de la barra del navegador en mobile */
html, body {
  min-height: 100%;
  min-height: 100dvh;
}

* {
  box-sizing: border-box;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button, a, label, select, input, textarea {
  touch-action: manipulation;
}

/* Contenedor principal con scroll propio */
#app {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.font-display { font-family: 'Playfair Display', serif; }
.font-body { font-family: 'DM Sans', sans-serif; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(20px); } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes dialogIn { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.anim-fade { animation: fadeUp 0.5s ease both; }
.anim-slide { animation: slideIn 0.3s ease both; }

.card-item { transition: all 0.25s ease; }
.qty-btn { transition: all 0.15s ease; }

@media (hover: hover) and (pointer: fine) {
  .card-item:hover { transform: translateY(-2px); }
  .qty-btn:hover { transform: scale(1.08); }
}

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

.order-item-enter { animation: slideIn 0.3s ease both; }

/* Diálogo centrado (confirmaciones) */
.dialog-card { animation: dialogIn 0.22s cubic-bezier(0.22, 0.61, 0.36, 1) both; }

/* ---------- Inputs ---------- */

input[type="text"], input[type="number"], input[type="search"], select, textarea {
  font-family: 'DM Sans', sans-serif;
}

/* 16px mínimo: evita el zoom automático de iOS al enfocar un campo */
input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  font-size: 16px;
}

/* Buscador de productos */
#productSearch {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}

#productSearch::-webkit-search-cancel-button,
#productSearch::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search-clear {
  display: none;
}

.search-clear.visible {
  display: flex;
}

#customOptions select {
  position: relative;
  z-index: 1000;
}

/* ---------- Barra de categorías sticky ---------- */

.category-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(26, 20, 16, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(200, 150, 122, 0.12);
  padding-bottom: 6px;
}

#categoryTabs {
  padding-top: 6px;
}

#categoryTabs::-webkit-scrollbar { display: none; }

/* ---------- Sheets (modales de abajo) ---------- */

.sheet {
  animation: sheetUp 0.28s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  overscroll-behavior: contain;
}

#customModal > .sheet {
  max-height: 90vh;
  max-height: 90dvh;
}

#orderModal > .sheet {
  max-height: 85vh;
  max-height: 85dvh;
}

/* ---------- Toasts ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  max-width: min(320px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  color: #fff;
  background: #c8967a;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

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

.toast[data-type="warning"] {
  background: #d64545;
}

/* ---------- Accesibilidad ---------- */

:focus-visible {
  outline: 2px solid #c8967a;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Safe areas y scrollbars ---------- */

#orderModal > .sheet > :last-child,
#customModal > .sheet > :last-child {
  padding-bottom: max(1.5rem, calc(1.5rem + env(safe-area-inset-bottom)));
}

#orderBar .order-bar-container {
  padding-bottom: max(1rem, calc(1rem + env(safe-area-inset-bottom)));
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8967a; border-radius: 3px; }

/* ---------- Movimiento reducido ---------- */

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .dialog-card,
  .anim-fade,
  .anim-slide,
  .order-item-enter {
    animation: none !important;
  }
  * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
