/* ============================================================
   VEN THOMAS POS — style.css (app)
   Diseño: etiqueta vintage café (navy + dorado + crema) — OKF
   ============================================================ */

:root {
  --navy: #001024;
  --navy-2: #00204a;
  --navy-3: #003366;
  --dorado: #c9a227;
  --dorado-2: #e0b93d;
  --dorado-oscuro: #7a5c11;
  --oro-viejo: #c0a474;
  --dorado-claro: #dcc08c;
  --crema: #f5ecd8;
  --crema-2: #efe3c8;
  --pergamino: #d4c098;
  --cafe: #241a10;
  --cafe-suave: #3a2a18;
  --cafe-2: #1a1208;
  --tinta: #1a1208;
  --blanco: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;

  --display: 'Playfair Display', Georgia, serif;
  --texto: 'Jost', 'Segoe UI', sans-serif;

  --sombra: 0 14px 44px rgba(0, 10, 24, 0.35);
  --sombra-dorada: 0 10px 30px rgba(201, 162, 39, 0.25);
  --radio: 14px;
  --radio-sm: 8px;
  --borde-dorado: 1px solid rgba(201, 162, 39, 0.45);
  --ring: 0 0 0 3px rgba(201, 162, 39, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--texto);
  background: var(--navy);
  color: var(--crema);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 74px; /* espacio para bottom-nav */
}
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

.container { width: min(1120px, 94%); margin: 0 auto; }

/* ===== BARRA SUPERIOR ===== */
.topbar {
  background: linear-gradient(90deg, var(--cafe), #2d1f12);
  color: var(--dorado-claro);
  text-align: center; font-size: 0.75rem; letter-spacing: 1px;
  padding: 6px 12px; position: relative; z-index: 101;
}

/* ===== HEADER APP ===== */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(0, 16, 36, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: var(--borde-dorado);
}
.app-header__inner { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; gap: 10px; }
.app-brand { font-family: var(--display); font-weight: 700; font-size: 1.05rem; color: var(--dorado-claro); letter-spacing: 1px; white-space: nowrap; }
.app-brand em { font-style: italic; color: var(--dorado); }
.app-brand small { display: block; font-family: var(--texto); font-size: 0.55rem; letter-spacing: 3px; color: var(--pergamino); }
.app-saldo {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,32,74,0.6); border: var(--borde-dorado); border-radius: 999px;
  padding: 6px 14px; font-weight: 600; font-size: 0.9rem; color: var(--dorado-claro);
  white-space: nowrap;
}
.app-saldo b { color: var(--dorado); font-size: 1.05rem; }
.app-saldo .ico-cr { font-size: 0.85rem; }
.app-user { text-align: right; line-height: 1.2; }
.app-user .name { font-size: 0.8rem; color: var(--crema); }
.app-user .rol { font-size: 0.68rem; letter-spacing: 1px; text-transform: uppercase; color: var(--dorado); }
.btn-logout { background: none; border: none; color: var(--dorado-claro); font-size: 0.72rem; text-decoration: underline; padding: 2px; }

/* ===== BOTONES ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: 0.92rem;
  border: 2px solid transparent; transition: transform .2s, box-shadow .2s, background .2s;
  min-height: 2.6rem;
}
.btn--solid { background: linear-gradient(135deg, var(--dorado), var(--dorado-2)); color: var(--navy); box-shadow: var(--sombra-dorada); }
.btn--solid:hover { transform: translateY(-2px); }
.btn--ghost { border: 1.5px solid rgba(220,192,140,0.55); color: var(--dorado-claro); background: transparent; }
.btn--ghost:hover { background: rgba(201,162,39,0.12); }
.btn--danger { background: rgba(220,38,38,0.15); color: #fca5a5; border-color: rgba(220,38,38,0.5); }
.btn--ok { background: rgba(22,163,74,0.15); color: #86efac; border-color: rgba(22,163,74,0.5); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn--sm { padding: 8px 14px; font-size: 0.8rem; min-height: 2.2rem; }
.btn--block { width: 100%; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* ===== VISTAS ===== */
.view { display: none; padding: 22px 0 30px; }
.view.activo { display: block; }
.view-title { text-align: center; margin-bottom: 24px; }
.view-title .etiqueta { color: var(--dorado); letter-spacing: 3px; text-transform: uppercase; font-size: 0.72rem; font-weight: 600; }
.view-title h2 { font-family: var(--display); font-size: 1.7rem; color: var(--blanco); margin-top: 4px; }
.view-title p { color: var(--pergamino); font-size: 0.9rem; margin-top: 6px; font-weight: 300; }

/* ===== LOGIN ===== */
.auth-wrap { max-width: 420px; margin: 8vh auto 0; }
.auth-card {
  background: var(--crema); color: var(--tinta); padding: 30px;
  border: 2px solid var(--oro-viejo); border-radius: var(--radio); box-shadow: var(--sombra);
}
.auth-card h2 { font-family: var(--display); color: var(--navy); font-size: 1.4rem; text-align: center; }
.auth-card .sub { text-align: center; color: var(--cafe-suave); font-size: 0.85rem; margin: 4px 0 18px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 500; font-size: 0.85rem; color: var(--cafe-suave); }
.field input, .field select, .field textarea {
  padding: 11px 13px; border: 1px solid rgba(26,18,8,0.25); border-radius: var(--radio-sm);
  background: var(--blanco); color: var(--tinta); width: 100%;
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: none; border-color: var(--dorado); box-shadow: var(--ring);
}
.auth-tabs { display: flex; margin-bottom: 18px; border-radius: 999px; overflow: hidden; border: 1px solid rgba(26,18,8,0.2); }
.auth-tabs button {
  flex: 1; padding: 10px; background: transparent; border: none; color: var(--cafe-suave);
  font-weight: 600; font-size: 0.88rem;
}
.auth-tabs button.activo { background: var(--navy); color: var(--dorado); }
.demo-users {
  margin-top: 16px; padding: 12px; background: rgba(0,32,74,0.08); border-radius: var(--radio-sm);
  font-size: 0.78rem; color: var(--cafe-suave); text-align: center; line-height: 1.8;
}
.demo-users code { background: rgba(0,32,74,0.1); padding: 2px 7px; border-radius: 6px; color: var(--navy-2); font-weight: 600; }
.form-msg { display: none; border-radius: var(--radio-sm); padding: 10px 12px; font-size: 0.85rem; margin-bottom: 12px; }
.form-msg.show { display: block; }
.form-msg.ok { background: rgba(22,163,74,0.12); color: #128a45; }
.form-msg.err { background: rgba(220,38,38,0.12); color: #b91c1c; }

/* ===== TIENDA ===== */
.shop-filters { display: flex; gap: 10px; justify-content: center; margin-bottom: 22px; flex-wrap: wrap; }
.chip {
  padding: 8px 18px; border-radius: 999px; border: var(--borde-dorado);
  background: transparent; color: var(--pergamino); font-size: 0.85rem; font-weight: 500;
}
.chip.activo { background: linear-gradient(135deg, var(--dorado), var(--dorado-2)); color: var(--navy); border-color: transparent; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.p-card {
  background: var(--crema); color: var(--tinta); border: 2px solid var(--oro-viejo);
  border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra);
  display: flex; flex-direction: column; transition: transform .25s;
}
.p-card:hover { transform: translateY(-4px); }
.p-card__img { height: 130px; overflow: hidden; background: var(--crema-2); }
.p-card__img img { width: 100%; height: 100%; object-fit: cover; }
.p-card__body { padding: 12px; display: flex; flex-direction: column; flex: 1; gap: 6px; }
.p-card__body h3 { font-family: var(--display); font-size: 1rem; color: var(--navy); line-height: 1.25; }
.p-card__body .desc { font-size: 0.74rem; color: var(--cafe-suave); flex: 1; }
.p-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.p-card__precio { font-weight: 700; color: var(--dorado-oscuro); font-size: 0.95rem; white-space: nowrap; }
.p-card__precio small { font-weight: 500; color: var(--cafe-suave); }

/* ===== CARRITO ===== */
.cart-layout { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 24px; align-items: start; }
.cart-list { display: flex; flex-direction: column; gap: 12px; }
.cart-item {
  display: flex; gap: 12px; align-items: center; background: rgba(0,16,36,0.5);
  border: var(--borde-dorado); border-radius: var(--radio); padding: 12px;
}
.cart-item img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radio-sm); border: 1px solid rgba(201,162,39,0.4); }
.cart-item .info { flex: 1; }
.cart-item .info h4 { font-family: var(--display); color: var(--dorado-claro); font-size: 1rem; }
.cart-item .info .price { color: var(--pergamino); font-size: 0.8rem; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 30px; height: 30px; border-radius: 50%; background: rgba(201,162,39,0.15);
  border: 1px solid rgba(201,162,39,0.5); color: var(--dorado-claro); font-weight: 700;
}
.qty span { min-width: 18px; text-align: center; font-weight: 600; }
.cart-empty { text-align: center; color: var(--pergamino); padding: 30px 0; font-size: 0.95rem; }
.cart-summary {
  background: var(--crema); color: var(--tinta); border-radius: var(--radio);
  border: 2px solid var(--oro-viejo); padding: 20px; box-shadow: var(--sombra); position: sticky; top: 70px;
}
.cart-summary h3 { font-family: var(--display); color: var(--navy); font-size: 1.2rem; margin-bottom: 10px; }
.cart-summary .row { display: flex; justify-content: space-between; font-size: 0.95rem; padding: 8px 0; border-bottom: 1px dashed rgba(26,18,8,0.2); }
.cart-summary .row.total { font-weight: 700; color: var(--navy); font-size: 1.05rem; border-bottom: none; }
.cart-summary .saldo { color: var(--cafe-suave); }
.cart-summary .saldo.insuf { color: var(--danger); }
.cart-summary textarea { width: 100%; margin: 10px 0; padding: 10px; border-radius: var(--radio-sm); border: 1px solid rgba(26,18,8,0.25); }
.cart-summary .btn { margin-top: 6px; }

/* ===== PEDIDOS ===== */
.order-card {
  background: rgba(0,16,36,0.5); border: var(--borde-dorado); border-radius: var(--radio);
  padding: 16px; margin-bottom: 14px; position: relative;
}
.order-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.order-card__head h4 { font-family: var(--display); color: var(--dorado-claro); font-size: 1.1rem; }
.order-card__head .fecha { font-size: 0.72rem; color: var(--oro-viejo); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
}
.badge--pendiente { background: rgba(217,119,6,0.18); color: #fbbf24; border: 1px solid rgba(217,119,6,0.5); }
.badge--preparando { background: rgba(0,51,102,0.35); color: #93c5fd; border: 1px solid rgba(147,197,253,0.5); }
.badge--listo { background: rgba(22,163,74,0.16); color: #86efac; border: 1px solid rgba(22,163,74,0.5); }
.badge--entregado { background: rgba(192,164,116,0.18); color: var(--dorado-claro); border: 1px solid rgba(192,164,116,0.5); }
.badge--cancelado { background: rgba(220,38,38,0.16); color: #fca5a5; border: 1px solid rgba(220,38,38,0.5); }
.order-card__items { margin: 12px 0; }
.order-item { display: flex; justify-content: space-between; font-size: 0.88rem; color: var(--pergamino); padding: 4px 0; }
.order-item b { color: var(--dorado-claro); }
.order-card__foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-card__total { font-weight: 700; color: var(--dorado); }
.order-card__nota { font-size: 0.78rem; color: var(--oro-viejo); font-style: italic; }
.order-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.timeline { display: flex; gap: 6px; margin-top: 10px; }
.timeline span { flex: 1; height: 4px; border-radius: 99px; background: rgba(201,162,39,0.15); }
.timeline span.on { background: var(--dorado); }

/* ===== ADMIN ===== */
.admin-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 22px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: rgba(0,16,36,0.5); border: var(--borde-dorado); border-radius: var(--radio);
  text-align: center; padding: 18px 10px;
}
.stat-card .num { font-family: var(--display); font-size: 1.7rem; color: var(--dorado); }
.stat-card .lbl { font-size: 0.72rem; letter-spacing: 1px; text-transform: uppercase; color: var(--pergamino); }
.table-wrap { overflow-x: auto; }
table.tbl {
  width: 100%; border-collapse: collapse; background: rgba(0,16,36,0.5);
  border: var(--borde-dorado); border-radius: var(--radio); overflow: hidden; font-size: 0.85rem;
}
.tbl th { text-align: left; padding: 12px; background: rgba(0,32,74,0.6); color: var(--dorado); letter-spacing: 1px; text-transform: uppercase; font-size: 0.68rem; }
.tbl td { padding: 11px 12px; color: var(--crema); border-top: 1px solid rgba(201,162,39,0.15); }
.tbl td .muted { color: var(--oro-viejo); font-size: 0.78rem; }
.tbl .ops { display: flex; gap: 6px; flex-wrap: wrap; }
.seg { border: 1px solid rgba(201,162,39,0.35); border-radius: 999px; background: transparent; color: var(--pergamino); padding: 5px 10px; font-size: 0.72rem; }
.seg.on { background: var(--dorado); color: var(--navy); font-weight: 700; }

/* ===== MÁQUINA DE CAFÉ ===== */
.machine-shell { max-width: 640px; margin: 0 auto; text-align: center; }
.machine {
  position: relative; background: linear-gradient(180deg, #0a1a33, var(--navy));
  border: 2px solid var(--dorado); border-radius: 22px; padding: 26px 20px 34px;
  box-shadow: var(--sombra), var(--sombra-dorada); overflow: hidden;
}
.machine::before { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(201,162,39,0.3); border-radius: 14px; pointer-events: none; }
.machine__name { font-family: var(--display); color: var(--dorado); letter-spacing: 2px; font-size: 1.1rem; }
.machine__brand { font-size: 0.6rem; letter-spacing: 4px; color: var(--pergamino); margin-bottom: 18px; }
.machine__panel { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.machine__gauge { width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #13355c, #001a3d); border: 3px solid var(--dorado); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--dorado); }
.machine__gauge b { font-family: var(--display); font-size: 1.6rem; line-height: 1; }
.machine__gauge small { font-size: 0.55rem; letter-spacing: 1px; color: var(--pergamino); }
.machine__leds { display: flex; gap: 12px; }
.led { width: 16px; height: 16px; border-radius: 50%; background: #1b2c3f; border: 1px solid rgba(201,162,39,0.4); transition: all .3s; }
.led--power.on { background: var(--dorado); box-shadow: 0 0 12px var(--dorado); }
.led--brew.on { background: var(--danger); box-shadow: 0 0 12px var(--danger); animation: blink 1s infinite; }
.led--ready.on { background: var(--ok); box-shadow: 0 0 12px var(--ok); }
@keyframes blink { 50% { opacity: 0.3; } }
.machine__screen {
  background: #071628; border: 1px solid rgba(201,162,39,0.4); border-radius: 10px;
  padding: 16px; margin-bottom: 16px; min-height: 90px; color: var(--crema); font-size: 0.85rem;
}
.machine__screen .st { font-family: var(--display); color: var(--dorado); font-size: 1.05rem; }
.machine__cup {
  width: 90px; height: 46px; margin: 6px auto 0; border-radius: 4px 4px 14px 14px;
  background: linear-gradient(180deg, var(--crema), var(--crema-2)); border: 2px solid var(--cafe);
  position: relative;
}
.machine__cup::before { content: ""; position: absolute; right: -22px; top: 4px; width: 26px; height: 26px; border: 2px solid var(--cafe); border-radius: 50%; background: var(--crema); }
.machine__cup .coffee { position: absolute; left: 6px; right: 6px; bottom: 5px; height: 34%; background: var(--cafe); border-radius: 3px; display: none; }
.machine.brewing .machine__cup .coffee { display: block; animation: fill 3.2s ease-in-out forwards; }
.machine.ready .machine__cup .coffee { display: block; height: 34%; }
@keyframes fill { from { height: 0; } to { height: 34%; } }
.machine__spout { width: 8px; height: 26px; background: linear-gradient(180deg, #2a3a4d, #0f1d2e); margin: 0 auto 6px; border-radius: 4px; }
.machine__steam { display: flex; gap: 10px; justify-content: center; height: 30px; margin-bottom: 4px; }
.machine__steam span { width: 7px; border-radius: 99px; background: linear-gradient(180deg, transparent, rgba(236,232,220,0.7)); opacity: 0; }
.machine.brewing .machine__steam span { opacity: 1; animation: steam 1.6s ease-in-out infinite; }
.machine__steam span:nth-child(2) { animation-delay: .3s; }
.machine__steam span:nth-child(3) { animation-delay: .6s; }
.machine__steam span:nth-child(1) { height: 26px; }
.machine__steam span:nth-child(2) { height: 30px; }
.machine__steam span:nth-child(3) { height: 22px; }
@keyframes steam { 0%,100% { transform: translateY(0); opacity: 0; } 50% { transform: translateY(-8px); opacity: 1; } }
.machine__drip { display: flex; gap: 26px; justify-content: center; margin-top: -4px; }
.machine__drip span { width: 3px; height: 0; background: var(--cafe); border-radius: 2px; }
.machine.brewing .machine__drip span { animation: drip 0.7s infinite; }
.machine__drip span:nth-child(2) { animation-delay: .2s; }
.machine__drip span:nth-child(3) { animation-delay: .4s; }
@keyframes drip { 0% { height: 0; } 100% { height: 12px; opacity: 0; } }
.machine__tray { height: 10px; border-radius: 99px; background: #0a1a33; border: 1px solid rgba(201,162,39,0.35); margin-top: 8px; }
.machine__status { margin-top: 18px; font-size: 0.85rem; color: var(--pergamino); }
.machine__status b { color: var(--dorado-claro); }
.machine-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

.star { color: rgba(217,180,74,0.28); transition: transform .15s, color .15s; }
.star.on { color: #d9b44a; transform: scale(1.15); }

/* ===== BOTTOM NAV (móvil) ===== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 110;
  background: rgba(0, 10, 20, 0.97); border-top: var(--borde-dorado);
  display: flex; justify-content: space-around; padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--oro-viejo); font-size: 0.66rem; letter-spacing: 0.4px; position: relative; padding: 2px 8px;
}
.bottom-nav a.activo { color: var(--dorado); }
.bottom-nav .ic { display: block; width: 24px; height: 24px; }
.bottom-nav .ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav .badge-n { position: absolute; top: -4px; right: 2px; background: var(--danger); color: #fff; font-size: 0.6rem; font-weight: 700; padding: 1px 5px; border-radius: 99px; min-width: 16px; text-align: center; }

/* ===== RESPONSIVE ===== */
@media (max-width: 820px) {
  .cart-layout { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
  .admin-grid { grid-template-columns: 1fr; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
}
@media (min-width: 820px) {
  body { padding-bottom: 68px; }
  .app-header__inner { padding: 14px 0; }
}

/* Skeleton / alerts */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1000;
  background: var(--cafe); color: var(--crema); border: 1px solid var(--dorado);
  padding: 12px 22px; border-radius: 999px; font-size: 0.88rem; box-shadow: var(--sombra);
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(4px); }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }

.modal {
  display: none; position: fixed; inset: 0; z-index: 900; background: rgba(0,10,24,0.8);
  align-items: center; justify-content: center; padding: 18px;
}
.modal.activo { display: flex; }
.modal__box {
  background: var(--crema); color: var(--tinta); border: 2px solid var(--dorado);
  border-radius: var(--radio); max-width: 460px; width: 100%; max-height: 86vh; overflow-y: auto; padding: 24px;
}
.modal__box h3 { font-family: var(--display); color: var(--navy); margin-bottom: 14px; }
.modal__box .btn { margin-top: 8px; }
