/* styles.css - Estilos modernos y responsivos para Bodegón POS */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --success-hover: #15803d;
  --warning: #f59e0b;
  --danger: #dc2626;
  --bg-dark: #0f172a;
  --card-dark: #1e293b;
  --border-dark: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --radius: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 75px; /* Espacio para barra inferior */
  overflow-x: hidden;
}

/* HEADER */
header {
  background-color: var(--card-dark);
  border-bottom: 1px solid var(--border-dark);
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-circle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  overflow: hidden;
}

.brand-logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text h1 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.brand-text span {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}

.rate-badge {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 6px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.rate-badge .rate-label {
  font-size: 11px;
  color: var(--text-muted);
}

.rate-badge .rate-val {
  font-size: 14px;
  font-weight: 700;
  color: #38bdf8;
}

.role-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #334155;
  color: #cbd5e1;
  cursor: pointer;
}

.role-badge.admin {
  background: #065f46;
  color: #6ee7b7;
}

/* TABS CONTAINER */
.tab-content {
  display: none;
  padding: 14px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.tab-content.active {
  display: block;
}

/* BOTTOM NAVIGATION */
nav.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-dark);
  border-top: 1px solid var(--border-dark);
  display: flex;
  justify-content: space-around;
  padding: 6px 0;
  z-index: 50;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  gap: 3px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-item .nav-icon {
  font-size: 20px;
}

.nav-item.active {
  color: #38bdf8;
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

/* POS LAYOUT */
.pos-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 768px) {
  .pos-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.card {
  background: var(--card-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 14px;
}

/* SEARCH & SCANNER BAR */
.scanner-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input-wrap {
  flex: 1;
  position: relative;
}

.search-input-wrap input {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  color: white;
  padding: 10px 12px 10px 36px;
  font-size: 14px;
  outline: none;
}

.search-input-wrap input:focus {
  border-color: var(--primary);
}

.search-icon-left {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.btn-scan {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  color: white;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* QUICK BUTTONS GRID */
.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quick-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.btn-quick-item {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-quick-item:active {
  transform: scale(0.96);
  border-color: var(--accent);
}

.btn-quick-item .item-emoji {
  font-size: 26px;
  margin-bottom: 4px;
}

.btn-quick-item .item-name {
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.2;
  margin-bottom: 2px;
}

.btn-quick-item .item-price {
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
}

/* CART */
.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-dark);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.cart-items-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 120px;
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 30px 10px;
  font-size: 13px;
}

.cart-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #1e293b;
}

.cart-row-info {
  flex: 1;
}

.cart-row-title {
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
}

.cart-row-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.cart-row-qty {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 10px;
}

.qty-btn {
  background: #334155;
  color: white;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
}

.qty-val {
  font-size: 13px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

.cart-row-total {
  text-align: right;
  min-width: 55px;
}

.cart-row-price-usd {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
}

.cart-row-price-bs {
  font-size: 10px;
  color: var(--text-muted);
}

/* TOTALS BOX */
.totals-box {
  background: #0b1329;
  border: 1px solid #1d4ed8;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.totals-usd {
  font-size: 26px;
  font-weight: 800;
  color: #4ade80;
}

.totals-bs {
  font-size: 16px;
  font-weight: 700;
  color: #38bdf8;
}

/* ACTIONS */
.cart-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-primary:active {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-success:active {
  background: var(--success-hover);
}

.btn-fiao {
  background: #d97706;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-fiao:active {
  background: #b45309;
}

.btn-secondary {
  background: #334155;
  color: #f1f5f9;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--card-dark);
  border: 1px solid var(--border-dark);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-dark);
  padding-bottom: 8px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
}

/* FORMS */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-input, .form-select {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  padding: 10px 12px;
  color: white;
  font-size: 14px;
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent);
}

/* CLIENT CARDS */
.client-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.client-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.client-name {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
}

.client-details {
  font-size: 12px;
  color: var(--accent);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.client-balance-box {
  background: #0b1329;
  border: 1px solid #d97706;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.client-debt-usd {
  font-size: 18px;
  font-weight: 800;
  color: #fbbf24;
}

.client-debt-bs {
  font-size: 12px;
  color: #94a3b8;
}

.client-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-wa {
  background: #22c55e;
  color: white;
  border: none;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  text-decoration: none;
}

/* INVENTORY TABLE */
.product-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  margin-bottom: 6px;
}

.badge-low-stock {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
  border: 1px solid #dc2626;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

/* SCANNER MODAL */
#interactive-scanner-container {
  width: 100%;
  max-height: 280px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  margin-bottom: 12px;
}
