/* =========================================================
   Intratecbol — Punto de Venta (DEMO)
   ========================================================= */
:root {
  --bg: #060b1a;
  --side: #0a1126;
  --card: rgba(17, 27, 53, 0.72);
  --card-2: rgba(20, 31, 60, 0.6);
  --border: rgba(96, 130, 210, 0.16);
  --border-soft: rgba(255, 255, 255, 0.07);
  --text: #eaf0fb;
  --muted: #8fa0c4;
  --muted-2: #5d6b8c;
  --blue: #38bdf8;
  --blue-2: #2563eb;
  --violet: #7c3aed;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 600px at 80% -10%, rgba(37, 99, 235, 0.16), transparent 60%),
    radial-gradient(900px 500px at 5% 110%, rgba(124, 58, 237, 0.12), transparent 60%),
    linear-gradient(160deg, #0a1430, #070d1f 60%, var(--bg));
  -webkit-font-smoothing: antialiased;
}

.pos { display: flex; flex-direction: column; height: 100vh; }

/* Topbar */
.pos-top {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: rgba(10, 17, 38, 0.7); backdrop-filter: blur(10px);
}
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: .88rem; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; }
.back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back:hover { color: var(--text); background: rgba(56, 189, 248, 0.08); }
.pos-logo { height: 28px; }
.pos-title { font-family: "Sora", sans-serif; font-weight: 700; font-size: 1.1rem; }
.pos-cashier { margin-left: auto; text-align: right; display: flex; flex-direction: column; line-height: 1.25; }
.pos-cashier span { color: var(--muted); font-size: .82rem; }
.pos-cashier b { font-family: "Sora", sans-serif; color: var(--blue); font-size: 1rem; }

/* Body */
.pos-body { flex: 1; display: grid; grid-template-columns: 1fr 380px; gap: 0; min-height: 0; }

/* Catálogo */
.catalog { padding: 18px 20px; overflow-y: auto; min-height: 0; }
.catalog-head { position: sticky; top: 0; z-index: 2; padding-bottom: 14px; }
.search { position: relative; margin-bottom: 14px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--muted-2); stroke-width: 2; stroke-linecap: round; }
.search input {
  width: 100%; padding: 13px 14px 13px 42px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border); color: var(--text); font-size: .95rem;
}
.search input:focus { outline: none; border-color: var(--blue); }
.cats { display: flex; gap: 8px; flex-wrap: wrap; }
.cat {
  padding: 8px 16px; border-radius: 20px; background: var(--card); border: 1px solid var(--border);
  color: var(--muted); font-size: .85rem; cursor: pointer; white-space: nowrap; transition: all .2s;
}
.cat:hover { color: var(--text); }
.cat.active { background: linear-gradient(100deg, rgba(56, 189, 248, 0.25), rgba(37, 99, 235, 0.3)); color: #fff; border-color: rgba(56, 189, 248, 0.5); }

.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.product {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 12px; cursor: pointer; text-align: left; color: inherit;
  transition: transform .18s, border-color .18s, background .18s;
  display: flex; flex-direction: column; gap: 6px;
}
.product:hover { transform: translateY(-3px); border-color: rgba(56, 189, 248, 0.45); background: var(--card-2); }
.product:active { transform: scale(.97); }
.product .emoji { font-size: 1.7rem; }
.product .p-name { font-size: .86rem; font-weight: 500; line-height: 1.25; }
.product .p-price { font-family: "Sora", sans-serif; font-weight: 700; color: var(--blue); margin-top: auto; }

/* Ticket */
.ticket {
  background: rgba(9, 14, 30, 0.85); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px; min-height: 0;
}
.ticket-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ticket-head h2 { font-family: "Sora", sans-serif; font-size: 1.15rem; }
.ticket-head span { color: var(--muted-2); font-weight: 600; }
.link-btn { background: none; border: 0; color: var(--red); cursor: pointer; font-size: .85rem; }
.link-btn:hover { text-decoration: underline; }

.ticket-items { flex: 1; overflow-y: auto; min-height: 80px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ticket-items .empty { color: var(--muted-2); text-align: center; margin: auto; font-size: .9rem; }
.line {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
  background: var(--card); border: 1px solid var(--border-soft); border-radius: 11px; padding: 10px 12px;
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.line .l-name { font-size: .88rem; font-weight: 500; }
.line .l-total { font-family: "Sora", sans-serif; font-weight: 700; text-align: right; }
.line .l-controls { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--border); background: var(--card-2); color: var(--text); cursor: pointer; font-size: 1rem; line-height: 1; display: grid; place-items: center; }
.qty-btn:hover { border-color: var(--blue); color: var(--blue); }
.line .qty { min-width: 22px; text-align: center; font-weight: 600; }
.line .l-unit { color: var(--muted-2); font-size: .76rem; }
.l-remove { background: none; border: 0; color: var(--muted-2); cursor: pointer; font-size: .9rem; }
.l-remove:hover { color: var(--red); }

.ticket-totals { border-top: 1px solid var(--border-soft); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.ticket-totals div { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; }
.ticket-totals .total { color: var(--text); font-size: 1rem; margin-top: 4px; }
.ticket-totals .total b { font-family: "Sora", sans-serif; font-size: 1.5rem; color: var(--text); }

.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 12px; }
.pay-methods button {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 11px 6px; border-radius: 12px; cursor: pointer; font-size: .8rem; font-weight: 600;
  background: var(--card); border: 1px solid var(--border); color: var(--muted); transition: all .2s;
}
.pay-methods button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pay-methods button:hover { color: var(--text); }
.pay-methods button.active { background: linear-gradient(100deg, rgba(56, 189, 248, 0.22), rgba(37, 99, 235, 0.28)); color: #fff; border-color: rgba(56, 189, 248, 0.5); }

/* QR */
.qr-panel { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.qr-box { width: 110px; height: 110px; border-radius: 10px; background: #fff; padding: 7px; flex-shrink: 0; display: grid; place-items: center; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-info p { color: var(--muted); font-size: .82rem; }
.qr-info b { font-family: "Sora", sans-serif; font-size: 1.5rem; display: block; margin: 2px 0 6px; }
.qr-status { color: var(--amber); font-size: .78rem; font-weight: 600; }

.cash-panel { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.cash-panel label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); }
.cash-panel input { padding: 11px 12px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--border); color: var(--text); font-size: 1.1rem; font-family: "Sora", sans-serif; }
.cash-panel input:focus { outline: none; border-color: var(--blue); }
.change { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: var(--muted); }
.change b { font-family: "Sora", sans-serif; font-size: 1.3rem; color: var(--green); }

.card-panel { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px 14px; margin-bottom: 12px; text-align: center; color: var(--muted); font-size: .9rem; }

.cobrar {
  width: 100%; padding: 15px; border-radius: 13px; border: 0; cursor: pointer;
  font-family: "Sora", sans-serif; font-size: 1.05rem; font-weight: 700; color: #fff;
  background: linear-gradient(100deg, #38bdf8, #2563eb); box-shadow: 0 14px 30px -12px rgba(37, 99, 235, 0.9);
  transition: transform .15s, filter .2s;
}
.cobrar:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
.cobrar:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* Overlay éxito */
.success { position: fixed; inset: 0; background: rgba(4, 8, 20, 0.78); backdrop-filter: blur(6px); display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: 28px 16px; z-index: 50; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.success-card { position: relative; margin: auto; background: linear-gradient(160deg, #0d1730, #0a1228); border: 1px solid var(--border); border-radius: 22px; padding: 32px 34px; text-align: center; max-width: 360px; width: 100%; box-shadow: 0 40px 80px -30px #000; }
.success-close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 9px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border); color: var(--muted); font-size: 1rem; cursor: pointer; transition: background .2s, color .2s; }
.success-close:hover { background: rgba(239, 68, 68, 0.15); color: #fff; }
.check { width: 78px; height: 78px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; background: radial-gradient(circle, rgba(34, 197, 94, 0.25), transparent 70%); }
.check svg { width: 46px; height: 46px; fill: none; stroke: var(--green); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s .15s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.success-card h3 { font-family: "Sora", sans-serif; font-size: 1.5rem; margin-bottom: 6px; }
.success-card > p { color: var(--muted); margin-bottom: 18px; }
.success-card .cobrar { background: rgba(255, 255, 255, 0.08); box-shadow: none; }

.success-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.success-actions .cobrar { grid-column: 1 / -1; }
.btn-sec {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 15px 16px; border-radius: 13px; cursor: pointer; font-weight: 600; font-size: .95rem;
  background: rgba(56, 189, 248, 0.12); border: 1px solid rgba(56, 189, 248, 0.4); color: #cbeafe;
  transition: background .2s;
}
.btn-sec:hover { background: rgba(56, 189, 248, 0.22); }
.btn-sec svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Recibo (misma línea gráfica Intratecbol) ===== */
.receipt {
  width: 300px; max-width: 100%; margin: 0 auto;
  background: #fff; color: #0a1126; border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6); text-align: left;
  font-size: .82rem;
}
.r-header {
  background: linear-gradient(125deg, #0a1052, #00033c 70%);
  padding: 16px 18px 14px; text-align: center;
}
.r-header img { height: 30px; width: auto; }
.r-header p { color: rgba(255, 255, 255, 0.9); font-size: .68rem; margin-top: 6px; }
.r-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 18px; border-bottom: 1px dashed #c7d2e0; }
.r-meta div { display: flex; justify-content: space-between; gap: 6px; }
.r-meta span { color: #6b7896; font-size: .72rem; }
.r-meta b { font-weight: 700; font-size: .76rem; }
.r-items { width: 100%; border-collapse: collapse; padding: 0; }
.r-items td { padding: 5px 18px; vertical-align: top; }
.r-items .ri-name { color: #0a1126; }
.r-items .ri-q { color: #6b7896; font-size: .74rem; }
.r-items .ri-total { text-align: right; font-weight: 700; white-space: nowrap; }
.r-items tr:first-child td { padding-top: 12px; }
.r-totals { padding: 10px 18px 4px; border-top: 1px dashed #c7d2e0; }
.r-totals div { display: flex; justify-content: space-between; padding: 3px 0; color: #34405c; }
.r-totals .r-total { font-family: "Sora", sans-serif; font-size: 1.05rem; color: #0a1126; font-weight: 800; border-top: 1px solid #e2e8f0; margin-top: 4px; padding-top: 8px; }
.r-qr { display: grid; place-items: center; padding: 12px; }
.r-qr svg { width: 96px; height: 96px; }
.r-thanks { text-align: center; font-weight: 700; color: #00033c; padding: 2px 18px 4px; }
.r-foot { text-align: center; color: #6b7896; font-size: .68rem; padding: 0 18px 16px; }

/* ===== Impresión: solo el recibo ===== */
@media print {
  body { background: #fff; }
  body * { visibility: hidden; }
  #receipt, #receipt * { visibility: visible; }
  #receipt {
    position: absolute; left: 0; top: 0; width: 80mm; margin: 0;
    box-shadow: none; border-radius: 0;
  }
  #receipt .r-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .check svg { stroke-dashoffset: 0; }
}

/* Responsive */
@media (max-width: 900px) {
  .pos-body { grid-template-columns: 1fr; }
  .ticket { border-left: 0; border-top: 1px solid var(--border); }
  .pos { height: auto; min-height: 100vh; }
}
