/* caja.css - Checkout view styles */

#view-caja {
  overflow: hidden;
}

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

.split-left {
  flex: 0 0 62%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px;
}

.split-right {
  flex: 0 0 38%;
  background: var(--bg-dark);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  flex: 1;
  align-content: start;
}

.product-card {
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid transparent;
  touch-action: manipulation;
}

.product-card:active,
.product-card.tap-active {
  transform: scale(0.95);
}

.product-card.has-items {
  border-color: var(--bg-dark);
}

.product-card[data-size="30"] { background: var(--color-30); }
.product-card[data-size="50"] { background: var(--color-50); }
.product-card[data-size="70"] { background: var(--color-70); }
.product-card[data-size="90"] { background: var(--color-90); }
.product-card[data-size="100"] {
  background: var(--color-100);
  grid-column: span 2;
}

.product-card .size-number {
  font-size: 48px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.product-card .size-unit {
  font-size: 18px;
  font-weight: 500;
  color: rgba(26,26,26,0.5);
  margin-top: 2px;
}

.product-card .product-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-top: 8px;
}

.product-card .product-desc {
  font-size: 13px;
  color: rgba(26,26,26,0.45);
  margin-top: 4px;
}

.product-card .add-hint {
  font-size: 12px;
  color: rgba(26,26,26,0.3);
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.product-card:hover .add-hint { opacity: 1; }

.product-card .qty-badge {
  position: absolute;
  top: -8px; right: -8px;
  background: var(--bg-dark);
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badge-pop 0.25s ease;
}

@keyframes badge-pop {
  0% { transform: scale(0.5); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Order Panel (Right side) */
.ticket-header {
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 20px 24px 16px;
  color: var(--text-light);
}

.ticket-items {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 0;
}
.ticket-items::-webkit-scrollbar { display: none; }

.ticket-empty {
  text-align: center;
  color: rgba(255,255,255,0.35);
  font-size: 15px;
  padding: 40px 24px;
}

.ticket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 48px;
  font-size: 16px;
  border-bottom: 1px dotted rgba(255,255,255,0.12);
  animation: slide-in-left 0.2s ease;
}

@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.ticket-item .item-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ticket-item .item-desc {
  font-weight: 500;
  color: var(--text-light);
}

.ticket-item .item-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ticket-item .item-subtotal {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-light);
}

.ticket-item .item-remove {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.5);
  width: 28px; height: 28px;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.ticket-item .item-remove:active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* Ticket bottom (sticky) */
.ticket-bottom {
  flex-shrink: 0;
  padding: 0 24px 24px;
}

.ticket-separator {
  height: 1px;
  background: rgba(255,255,255,0.2);
  margin-bottom: 16px;
}

.ticket-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.total-label {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.6);
}

.total-amount {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-light);
}

/* COBRAR Button */
.btn-cobrar {
  display: block;
  width: 100%;
  height: 64px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-cobrar:active:not(:disabled) {
  transform: scale(0.98);
}
.btn-cobrar:disabled {
  background: #555;
  color: #888;
  opacity: 0.4;
  cursor: not-allowed;
}

/* Payment Modal */
.payment-modal {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 40px;
  max-width: 560px;
  width: 90%;
  color: var(--text);
}

.payment-modal-title {
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
}

.payment-modal-total {
  font-size: 48px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 32px;
}

.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.payment-card {
  height: 120px;
  border-radius: var(--radius);
  border: 3px solid transparent;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 20px;
}
.payment-card:active { transform: scale(0.97); }

.payment-card-icon { font-size: 32px; }
.payment-card-label { font-size: 16px; font-weight: 600; }

.payment-card[data-method="card"].selected {
  border-color: var(--blue);
  background: rgba(59,130,246,0.08);
}
.payment-card[data-method="cash"].selected {
  border-color: var(--cash-green);
  background: rgba(34,197,94,0.08);
}
.payment-card[data-method="gift_card"].selected {
  border-color: var(--purple);
  background: rgba(168,85,247,0.08);
}
.payment-card[data-method="online"].selected {
  border-color: var(--orange);
  background: rgba(245,158,11,0.08);
}

.btn-confirm-pay {
  width: 100%;
  height: 56px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 12px;
}
.btn-confirm-pay:active:not(:disabled) { transform: scale(0.98); }
.btn-confirm-pay:disabled {
  background: #ccc;
  color: #999;
  cursor: not-allowed;
}

.btn-cancel-pay {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px;
  text-align: center;
}
.btn-cancel-pay:hover { color: var(--text); }

/* Success Overlay */
.success-content {
  text-align: center;
  color: #fff;
  padding: 40px;
}

.success-checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
}

.checkmark-svg {
  width: 80px;
  height: 80px;
}

.checkmark-circle {
  stroke: var(--green);
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: circle-draw 0.6s ease-in-out forwards;
}

.checkmark-check {
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: check-draw 0.3s 0.4s ease-in-out forwards;
}

@keyframes circle-draw {
  to { stroke-dashoffset: 0; }
}
@keyframes check-draw {
  to { stroke-dashoffset: 0; }
}

.success-record-id {
  font-size: 20px;
  font-weight: 700;
  font-family: 'SF Mono', 'Menlo', monospace;
  margin-bottom: 8px;
  color: var(--green);
}

.success-msg {
  font-size: 15px;
  color: #999;
  margin-bottom: 32px;
}

.success-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.btn-new-sale {
  padding: 16px 36px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-new-sale:active { transform: scale(0.97); }

.btn-reprint {
  padding: 16px 28px;
  background: transparent;
  color: #ccc;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-reprint:active { background: rgba(255,255,255,0.1); }

/* Responsive */
@media (max-width: 1023px) {
  .split-layout {
    flex-direction: column;
    overflow-y: auto;
  }
  .split-left {
    flex: none;
    overflow: visible;
    padding: 16px;
  }
  .split-right {
    flex: none;
    min-height: 400px;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .product-card { min-height: 140px; }
  .product-card .size-number { font-size: 36px; }
  .product-card .size-unit { font-size: 15px; }
  .product-card .product-price { font-size: 18px; }
}

@media (max-width: 480px) {
  .split-left { padding: 12px; }
  .product-grid { gap: 10px; }
  .product-card {
    min-height: 120px;
    padding: 14px 10px;
  }
  .product-card .size-number { font-size: 32px; }
  .product-card .product-price { font-size: 16px; }
  .product-card .product-desc { font-size: 11px; }
  .ticket-bottom { padding: 0 16px 16px; }
  .ticket-header { padding: 16px 16px 12px; }
  .ticket-item { padding: 0 16px; }
  .total-amount { font-size: 28px; }
  .btn-cobrar { height: 56px; font-size: 18px; }
}

@media (min-width: 1024px) {
  .split-left { flex: 0 0 62%; }
  .split-right { flex: 0 0 38%; }
  .product-grid {
    max-width: 640px;
    align-content: center;
    flex: 1;
  }
}
