/* ==========================================================
   POS Retail — Diseño Moderno y Responsivo
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --primary: #2d3282;
  --accent: #4f46e5;
  --accent-light: #eef2ff;
  --bg: #f8fafc;
  --white: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --sidebar-w: 260px;
  --cart-w: 380px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  overflow: hidden;
  line-height: 1.5;
}

/* ========== PÁGINA DE INICIO (INDEX.HTML) ========== */

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

h1 {
  font-size: 48px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.lead {
  font-size: 16px;
  color: var(--muted);
  max-width: 600px;
  line-height: 1.6;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  padding: 12px 16px;
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--border);
  width: fit-content;
}

.dot {
  width: 8px;
  height: 8px;
  background: var(--warning);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  border-color: var(--accent);
}

.card:hover::before {
  left: 100%;
}

.icon {
  width: 48px;
  height: 48px;
  background: var(--accent-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.info {
  flex: 1;
}

.info h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.info p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.arrow {
  margin-left: auto;
  color: var(--accent);
  transition: transform 0.3s;
}

.card:hover .arrow {
  transform: translateX(4px);
}

footer {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding-top: 30px;
  border-top: 1px solid var(--border);
}

footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

footer a:hover {
  text-decoration: underline;
}

/* ========== APLICACIÓN POS (APP.HTML) ========== */

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(135deg, var(--primary) 0%, #1e1b4b 100%);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 24px;
  flex-shrink: 0;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  z-index: 50;
}

.brand {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.02em;
}

.brand svg {
  width: 24px;
  height: 24px;
}

.nav-menu {
  flex: 1;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(4px);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.header {
  height: 80px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.search-box {
  flex: 1;
  max-width: 500px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 12px;
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: all 0.2s;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
}

.header-actions {
  display: flex;
  gap: 12px;
  margin-left: 20px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent);
  transition: all 0.2s;
}

.btn-icon:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: scale(1.05);
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cats {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.cats::-webkit-scrollbar {
  height: 6px;
}

.cats::-webkit-scrollbar-track {
  background: transparent;
}

.cats::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.cat-btn {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.2s;
}

.cat-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cat-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.08);
  border-color: var(--accent);
}

.card.out {
  opacity: 0.5;
  cursor: not-allowed;
}

.card-img {
  width: 100%;
  aspect-ratio: 1.1;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  color: white;
  font-size: 9px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  z-index: 10;
  font-family: 'IBM Plex Mono', monospace;
}

.card-info h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.card-info p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.card-price {
  font-weight: 800;
  color: var(--accent);
  font-size: 15px;
  font-family: 'IBM Plex Mono', monospace;
}

.card-add {
  width: 32px;
  height: 32px;
  background: var(--accent-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 800;
  font-size: 18px;
  transition: all 0.2s;
}

.card:hover .card-add {
  background: var(--accent);
  color: white;
  transform: scale(1.1);
}

/* ========== CARRITO ========== */

.cart {
  width: var(--cart-w);
  background: var(--white);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: -10px 0 30px rgba(0,0,0,0.02);
  z-index: 40;
}

.cart-head {
  padding: 32px 24px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.cart-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.cart-item-img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: var(--bg);
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-info h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
  word-break: break-word;
}

.cart-item-info p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.qty-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cart-item-price {
  font-weight: 700;
  font-size: 14px;
  text-align: right;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--accent);
}

.cart-foot {
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  background: var(--white);
}

.row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.row.total {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--border);
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  font-family: 'IBM Plex Mono', monospace;
}

.btn-pay {
  width: 100%;
  padding: 20px;
  background: linear-gradient(135deg, var(--accent) 0%, #4338ca 100%);
  color: white;
  border: none;
  border-radius: 16px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  margin-top: 20px;
  box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
  transition: all 0.2s;
}

.btn-pay:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(79, 70, 229, 0.4);
}

.btn-pay:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
}

/* ========== MODALES ========== */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--white);
  padding: 32px;
  border-radius: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}

.modal p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
  outline: none;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.input-group input:focus,
.input-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light);
}

/* ========== TOAST ========== */

#toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 14px 28px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 14px;
  z-index: 2000;
  transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ========== SCANNER ========== */

#scannerOverlay {
  background: #000 !important;
  flex-direction: column !important;
  padding: 0 !important;
}

#scannerViewport {
  width: 100%;
  height: 100%;
  position: relative;
}

/* ========== RESPONSIVE DESIGN ========== */

@media (max-width: 1200px) {
  .sidebar {
    width: 80px;
    padding: 20px 10px;
    align-items: center;
  }

  .brand span,
  .nav-item span {
    display: none;
  }

  .brand {
    justify-content: center;
    margin-bottom: 30px;
  }

  .cart {
    width: 320px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
  }

  .content-area {
    padding: 20px;
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  .wrap {
    padding: 30px 16px;
  }

  h1 {
    font-size: 32px;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 100%;
    height: 64px;
    flex-direction: row;
    padding: 0 16px;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    margin-bottom: 0;
    font-size: 16px;
  }

  .nav-menu {
    flex-direction: row;
    gap: 0;
  }

  .nav-item {
    padding: 8px 12px;
    font-size: 12px;
  }

  .nav-item span {
    display: inline;
  }

  .header {
    height: 70px;
    padding: 0 16px;
    flex-wrap: wrap;
  }

  .search-box {
    max-width: 100%;
    order: 3;
    flex-basis: 100%;
    margin-top: 10px;
  }

  .header-actions {
    margin-left: 0;
  }

  .content-area {
    padding: 16px;
    gap: 16px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }

  .card {
    padding: 12px;
    gap: 8px;
  }

  .card-img {
    font-size: 48px;
  }

  .card-info h3 {
    font-size: 12px;
  }

  .card-info p {
    font-size: 10px;
  }

  .cart {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70%;
    width: 100%;
    transform: translateY(100%);
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 32px 32px 0 0;
    z-index: 100;
  }

  .cart.open {
    transform: translateY(0);
  }

  .cart-head {
    padding: 24px 20px 16px;
    font-size: 18px;
  }

  .cart-items {
    padding: 16px 20px;
  }

  .cart-foot {
    padding: 20px;
  }

  .modal {
    max-width: 90%;
    padding: 24px;
  }

  .main {
    flex-direction: column;
  }

  .cats {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .wrap {
    padding: 20px 12px;
    gap: 20px;
  }

  h1 {
    font-size: 24px;
  }

  .lead {
    font-size: 14px;
  }

  .card {
    padding: 10px;
  }

  .card-img {
    font-size: 40px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }

  .header {
    height: 60px;
    padding: 0 12px;
  }

  .search-box input {
    padding: 10px 12px 10px 36px;
    font-size: 13px;
  }

  .btn-icon {
    width: 40px;
    height: 40px;
  }

  .content-area {
    padding: 12px;
  }

  .modal {
    max-width: 95%;
    padding: 20px;
  }

  .modal h3 {
    font-size: 18px;
  }

  .btn-pay {
    padding: 16px;
    font-size: 14px;
  }

  #toast {
    bottom: 16px;
    padding: 12px 20px;
    font-size: 12px;
  }
}

/* ========== ANIMACIONES ========== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeIn 0.3s ease-out;
}
