/* ===============================
   Punto de Venta Walfort - CSS Local
   Sin dependencias externas
   =============================== */

:root{
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --black: #000000;
  --danger: #b00020;
  --success: #15803d;
  --warning: #b45309;
  --info: #1d4ed8;
}

*{ box-sizing: border-box; }

body{
  margin:0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ===============================
   HEADER
   =============================== */
.header{
  background: var(--black);
  color:#fff;
  padding: 14px 16px;
}

.header-inner{
  max-width: 1100px;
  margin: 0 auto;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}

.badge{
  display:inline-block;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  font-size: 12px;
  color:#fff;
  background: rgba(255,255,255,.06);
}

/* ===============================
   LAYOUT
   =============================== */
.container{
  max-width: 1100px;
  margin: 18px auto;
  padding: 0 12px;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  padding: 14px;
  margin-bottom: 16px;
}

.card-title{
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.row{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}

.label{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

/* ===============================
   INPUTS Y BOTONES
   =============================== */
.input{
  padding: 10px 12px;
  font-size: 14px;
  border:1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background:#fff;
}

.input:focus{
  border-color: #cbd5e1;
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

.btn{
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}

.btn:hover{
  background: #f3f4f6;
}

.btn:disabled{
  opacity: .5;
  cursor: not-allowed;
}

.btn-danger{
  border-color: rgba(176,0,32,.25);
}

.btn-danger:hover{
  background: rgba(176,0,32,.06);
}

.btn-primary{
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.btn-primary:hover{
  background: #1f2937;
  border-color: #1f2937;
}

/* Botón ✕ eliminar línea */
.btn-remove{
  background: none;
  border: none;
  cursor: pointer;
  color: #ef4444;
  font-size: 18px;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.15s;
}

.btn-remove:hover{
  background: #fee2e2;
}

/* ===============================
   MENSAJES
   =============================== */
.msg{
  font-size: 12px;
  color: var(--muted);
}

.msg.error{
  color: var(--danger);
}

.msg.success{
  color: var(--success);
}

/* ===============================
   TABLA CARRITO
   =============================== */
.table-wrap{
  overflow:auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 12px;
}

table{
  width:100%;
  border-collapse: collapse;
  min-width: 820px;
  background:#fff;
}

th, td{
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

th{
  background: #f9fafb;
  text-align:left;
  color: #111827;
  position: sticky;
  top: 0;
  z-index: 1;
}

td.num, th.num{
  text-align:right;
  font-variant-numeric: tabular-nums;
}

.w-240{ width: 240px; }
.w-140{ width: 140px; }
.w-110{ width: 110px; }

.totals{
  margin-top: 12px;
  display:flex;
  gap: 18px;
  justify-content: flex-end;
  font-size: 16px;
}

.totals b{
  font-variant-numeric: tabular-nums;
}

.small{
  font-size: 12px;
  color: var(--muted);
}

/* ===============================
   BÚSQUEDA POR NOMBRE
   =============================== */
.search-results{
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 360px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  z-index: 100;
  max-height: 260px;
  overflow-y: auto;
}

.search-results-wrap{
  position: relative;
}

.search-result-item{
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.search-result-item:last-child{
  border-bottom: none;
}

.search-result-item:hover{
  background: #f3f4f6;
}

.search-result-name{
  font-weight: 600;
  color: var(--text);
}

.search-result-meta{
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.search-result-price{
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.search-empty{
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ===============================
   HISTORIAL DE VENTAS DEL DÍA
   =============================== */
.history-table-wrap{
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 10px;
}

.history-table{
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
  background: #fff;
  font-size: 13px;
}

.history-table th{
  background: #f9fafb;
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.history-table td{
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.history-table tr:last-child td{
  border-bottom: none;
}

.history-table .num{
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.history-empty{
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.link-reprint{
  font-size: 12px;
  color: var(--info);
  text-decoration: none;
  cursor: pointer;
}

.link-reprint:hover{
  text-decoration: underline;
}

/* ===============================
   REPORTE DE CIERRE DEL DÍA
   =============================== */
.report-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.report-box{
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
}

.report-box-label{
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.report-box-value{
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.report-box-value.green{
  color: var(--success);
}

.report-breakdown{
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.report-breakdown-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.report-breakdown-row:last-child{
  border-bottom: none;
}

.report-breakdown-row span:last-child{
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ===============================
   RELOAD INVENTARIO - badge estado
   =============================== */
.reload-status{
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
}

.reload-status.ok{
  background: #dcfce7;
  color: var(--success);
}

.reload-status.error{
  background: #fee2e2;
  color: var(--danger);
}