/* ═══════════════ POS v2.0 ═══════════════ */

#section-pos { padding: 0 !important; overflow: hidden !important; }
#section-pos.active { display: flex !important; flex-direction: row !important; }

.pos-layout { display: flex; flex: 1; overflow: hidden; }

.pos-products-panel {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; padding: 1.25rem; min-width: 0;
}

.pos-filters-bar { display: flex; gap: 0.75rem; margin-bottom: 0.75rem; flex-shrink: 0; }
.pos-search-wrap {
  display: flex; align-items: center; gap: 0.5rem; flex: 1;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 24px; padding: 0 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.pos-search-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,53,0.08); }
.pos-search-wrap input { flex: 1; background: none; border: none; padding: 0.5rem 0; font-size: 0.9rem; color: var(--text); }
.pos-search-wrap input::placeholder { color: var(--text-light); }

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.75rem; overflow-y: auto; padding-right: 4px;
  flex: 1; align-content: start;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.products-grid::-webkit-scrollbar { width: 5px; }
.products-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.product-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 0.9rem 0.75rem; cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 0.45rem;
  text-align: center;
}
.product-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.product-card:active { transform: scale(0.97); }
.product-card-img {
  width: 76px; height: 76px; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; flex-shrink: 0; border: 1px solid var(--border);
}
.product-card-img img { width: 76px; height: 76px; border-radius: var(--radius-sm); object-fit: cover; }
.product-card-name { font-size: 0.8rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.product-card-price { font-size: 0.9rem; font-weight: 800; color: var(--primary); }
.product-card-stock { font-size: 0.7rem; color: var(--text-muted); }
.product-card.kg-product .product-card-price::after { content: '/kg'; font-size: 0.65rem; font-weight: 400; }
.product-card.out-of-stock { opacity: 0.45; pointer-events: none; }
.product-card.low-stock { border: 1.5px solid #f59e0b; }
.product-card.low-stock .product-card-stock { color: #d97706; font-weight: 600; }

/* Ticket panel */
.pos-ticket-panel {
  width: 320px; min-width: 300px; background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}

.ticket-header {
  padding: 0.9rem 1rem; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.6rem; flex-shrink: 0;
}
.ticket-customer { display: flex; align-items: center; gap: 0.5rem; }
.ticket-select {
  flex: 1; padding: 0.4rem 0.65rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.825rem; background: var(--bg); color: var(--text);
  transition: border-color var(--transition);
}
.ticket-select:focus { border-color: var(--primary); }
.ticket-select-sm {
  flex: 1; padding: 0.3rem 0.5rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.78rem; background: var(--bg); color: var(--text);
}
.ticket-meta { display: flex; gap: 0.5rem; }
.ticket-meta-item { flex: 1 1 0; min-width: 0; }
.ticket-meta-item label { display: block; font-size: 0.7rem; color: var(--text-muted); font-weight: 600; margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-meta-item > select { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.ticket-order-type { display: flex; gap: 0.35rem; }
.order-type-btn {
  flex: 1; padding: 0.3rem; font-size: 0.75rem; font-weight: 600;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted); transition: all var(--transition);
}
.order-type-btn.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

.ticket-items { flex: 1; overflow-y: auto; padding: 0.75rem; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.ticket-items::-webkit-scrollbar { width: 4px; }
.ticket-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.ticket-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); text-align: center; gap: 0.4rem; }
.ticket-empty span { font-size: 2.5rem; opacity: 0.3; }
.ticket-empty p { font-weight: 600; font-size: 0.9rem; }
.ticket-empty small { font-size: 0.78rem; opacity: 0.7; }

.ticket-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border-light); animation: fadeInItem 0.15s ease; }
.ticket-item:last-child { border-bottom: none; }
@keyframes fadeInItem { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
.ticket-item-img { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; overflow: hidden; border: 1px solid var(--border); }
.ticket-item-img img { width: 36px; height: 36px; object-fit: cover; border-radius: var(--radius-sm); }
.ticket-item-info { flex: 1; min-width: 0; }
.ticket-item-name { font-size: 0.8rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-item-sub { font-size: 0.71rem; color: var(--text-muted); }
.ticket-item-price { font-size: 0.875rem; font-weight: 700; color: var(--text); flex-shrink: 0; }
.ticket-item-qty { display: flex; align-items: center; gap: 0.3rem; }
.qty-btn {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--border);
  font-size: 0.8rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition); flex-shrink: 0;
}
.qty-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.qty-value { font-size: 0.825rem; font-weight: 600; min-width: 22px; text-align: center; }
.ticket-item-remove { background: none; border: none; color: var(--red); font-size: 0.85rem; cursor: pointer; padding: 2px; opacity: 0.5; flex-shrink: 0; transition: opacity var(--transition); }
.ticket-item-remove:hover { opacity: 1; }

.ticket-footer { padding: 0.85rem 1rem; border-top: 1px solid var(--border); flex-shrink: 0; background: var(--bg); }
.ticket-summary { margin-bottom: 0.75rem; }
.summary-row { display: flex; justify-content: space-between; font-size: 0.825rem; padding: 0.2rem 0; color: var(--text-muted); }
.summary-row.total { font-size: 1.05rem; font-weight: 800; color: var(--text); border-top: 1.5px solid var(--border); margin-top: 0.4rem; padding-top: 0.5rem; }
.ticket-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.ticket-actions .btn-primary.wide { grid-column: span 2; }

/* Payment */
.payment-total-display { text-align: center; padding: 1.1rem; background: var(--bg); border-radius: var(--radius); margin-bottom: 1.25rem; border: 1px solid var(--border); }
.payment-total-display span { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.payment-total-display strong { font-size: 2rem; font-weight: 800; color: var(--primary); }
.payment-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.payment-method-btn {
  padding: 0.9rem 0.75rem; background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 0.855rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  color: var(--text-muted); transition: all var(--transition);
}
.payment-method-btn span { font-size: 1.4rem; }
.payment-method-btn.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.payment-method-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.cash-change-section { background: var(--bg); border-radius: var(--radius); padding: 1rem; border: 1px solid var(--border); }
.cash-change-section label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.cash-change-section input { width: 100%; padding: 0.6rem 0.85rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 1rem; background: var(--surface); color: var(--text); margin-bottom: 0.75rem; }
.change-display { display: flex; justify-content: space-between; align-items: center; }
.change-display span { font-size: 0.875rem; color: var(--text-muted); }
.change-display strong { font-size: 1.15rem; color: var(--green); font-weight: 700; }

/* Card subtype */
.payment-sub-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin: 0 0 0.5rem; }
.card-subtype-btns { display: flex; gap: 0.75rem; }
.card-sub-btn {
  flex: 1; padding: 0.7rem 0.5rem; background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 0.855rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  color: var(--text-muted); transition: all var(--transition);
}
.card-sub-btn span { font-size: 1.2rem; }
.card-sub-btn.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.card-sub-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* Split payment */
#split-section { background: var(--bg); border-radius: var(--radius); padding: 1rem; border: 1px solid var(--border); margin-top: 0.5rem; }
.split-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; gap: 0.5rem; }
.split-mode-btns { display: flex; gap: 0.35rem; }
.split-mode-btn {
  padding: 0.3rem 0.7rem; font-size: 0.74rem; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 99px;
  color: var(--text-muted); transition: all var(--transition); white-space: nowrap;
}
.split-mode-btn.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.split-mode-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

.split-row { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.5rem; }
.split-row label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; min-width: 52px; }
.split-row .split-amt { flex: 1; padding: 0.48rem 0.65rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.88rem; background: var(--surface); color: var(--text); }
.split-row .split-amt[readonly] { opacity: 0.55; cursor: not-allowed; }
.split-row .split-mth { flex: 1.5; padding: 0.48rem 0.55rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.78rem; background: var(--surface); color: var(--text); }
.split-remove-btn {
  width: 1.6rem; height: 1.6rem; flex-shrink: 0;
  background: none; border: 1.5px solid var(--border); border-radius: 50%;
  font-size: 0.7rem; color: var(--text-muted); transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.split-remove-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.split-remove-placeholder { width: 1.6rem; height: 1.6rem; flex-shrink: 0; }

.split-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 0.6rem; }
.split-add-btn {
  font-size: 0.78rem; font-weight: 600; color: var(--primary); background: var(--primary-light);
  border: 1.5px solid var(--primary); border-radius: var(--radius-sm);
  padding: 0.3rem 0.75rem; transition: all var(--transition);
}
.split-add-btn:hover { background: var(--primary); color: #fff; }
.split-remainder-wrap { font-size: 0.78rem; color: var(--text-muted); }
.split-remainder-wrap strong { font-weight: 700; }

#card-subtype-section { padding: 0.75rem 0 0.25rem; }

/* KG modal */
.kg-display { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 1rem; }
.kg-input { font-size: 1.5rem; font-weight: 700; width: 120px; text-align: center; padding: 0.5rem; border: 2px solid var(--primary); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
.kg-display span { font-size: 1rem; color: var(--text-muted); }
.kg-quick-btns { display: flex; gap: 0.5rem; justify-content: center; }
.kg-quick-btns button { padding: 0.4rem 0.85rem; background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 600; color: var(--text); transition: all var(--transition); }
.kg-quick-btns button:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Comanda: separador y sección "en cocina" en el ticket ── */
.ticket-section-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 3px 10px; border-radius: 6px;
  margin: 6px 0 3px; display: block;
}
.ticket-section-cocina { background: rgba(251,191,36,0.13); color: #b45309; }
.ticket-item-sent { opacity: 0.55; }
.qty-sent-badge {
  font-size: 0.78rem; font-weight: 600; color: #b45309;
  background: rgba(251,191,36,0.15); border-radius: 20px;
  padding: 2px 9px; white-space: nowrap;
}
.ticket-comanda-separator {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--primary);
  border-top: 1.5px dashed var(--primary);
  padding: 5px 0 3px; margin: 4px 0; text-align: center;
}
.ticket-all-sent-msg {
  font-size: 0.8rem; color: var(--text-muted);
  text-align: center; padding: 8px 0; font-style: italic;
}

/* ══════════════════════════════════════════════════════════════
   RESTAURANT FEATURES: MESA MAP, AREA HEADERS, MODIFIERS
══════════════════════════════════════════════════════════════ */

/* Mesa map modal ─────────────────────────────────────────────── */
.mesa-map-legend {
  display: flex; gap: 16px; margin-bottom: 14px;
}
.mesa-legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.82rem; color: var(--text-muted);
}
.mesa-dot {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block;
}
.mesa-dot.libre   { background: #22c55e; }
.mesa-dot.ocupada { background: #f59e0b; }
.mesa-dot.cuenta  { background: #ef4444; }

.mesa-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
}
.mesa-map-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 14px 8px; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent; transition: transform .15s, box-shadow .15s;
  min-height: 80px;
}
.mesa-map-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.mesa-map-card.mesa-libre   { background: rgba(34,197,94,.12);  border-color: #22c55e; color: #15803d; }
.mesa-map-card.mesa-ocupada { background: rgba(245,158,11,.12); border-color: #f59e0b; color: #b45309; }
.mesa-map-card.mesa-cuenta  { background: rgba(239,68,68,.12);  border-color: #ef4444; color: #b91c1c; }
.mesa-map-card.mesa-current { box-shadow: 0 0 0 3px var(--primary); }
.mesa-card-num    { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.mesa-card-status { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }

/* Mapa button next to mesa select ───────────────────────────── */
.ticket-meta-item > div { min-width: 0; }
.ticket-meta-item > div .ticket-select-sm { flex: 1 1 0; min-width: 0; max-width: 100%; box-sizing: border-box; }
.btn-mesa-map {
  flex-shrink: 0;
  background: var(--primary-light, rgba(255,107,53,.1));
  border: 1.5px solid var(--primary, #FF6B35);
  color: var(--primary, #FF6B35);
  border-radius: var(--radius-sm, 6px);
  padding: 2px 7px; font-size: 0.9rem; cursor: pointer;
  transition: background .15s;
}
.btn-mesa-map:hover { background: var(--primary, #FF6B35); color: #fff; }

/* Solicitar cuenta button active state ──────────────────────── */
.btn-cuenta-activa {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
}

/* Area headers in ticket ─────────────────────────────────────── */
.ticket-area-header {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 0 2px 4px; margin: 6px 0 2px;
  color: var(--text-muted);
  border-left: 3px solid var(--border);
}

/* Modifier/note labels inside ticket item ───────────────────── */
.item-mods {
  display: block; font-size: 0.72rem; color: #7c3aed;
  font-weight: 500; margin-top: 1px;
}
.item-note {
  display: block; font-size: 0.72rem; color: var(--text-muted);
  font-style: italic; margin-top: 1px;
}

/* Modifier modal groups ──────────────────────────────────────── */
.mod-group { margin-bottom: 14px; }
.mod-group-title {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted);
  margin-bottom: 6px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.mod-option-label {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px; cursor: pointer;
  font-size: 0.88rem; transition: background .1s;
}
.mod-option-label:hover { background: var(--bg-alt, #f8f9fa); }
.mod-option-label input[type=checkbox] { accent-color: var(--primary, #FF6B35); }

/* Comanda card area badge ─────────────────────────────────────── */
.comanda-area-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  margin-left: 4px;
}
.comanda-area-badge.area-cocina { background: rgba(245,158,11,.15); color: #b45309; }
.comanda-area-badge.area-bar    { background: rgba(99,102,241,.15);  color: #4338ca; }

/* Notas inline in comanda items ─────────────────────────────── */
.comanda-item-notas {
  font-size: 0.78rem; color: var(--text-muted);
  font-style: italic;
}
