:root {
  --primary: #0b3d63;
  --primary-light: #12588f;
  --primary-hover: #082d4a;
  --accent-green: #1e8a5f;
  --accent-green-hover: #166948;
  --accent-red: #d32f2f;
  --accent-orange: #e65100;
  --bg-page: #f4f7fa;
  --bg-card: #ffffff;
  --bg-surface: #eef3f8;
  --border-color: #dbe3eb;
  --border-focus: #12588f;
  --text-main: #1a2734;
  --text-muted: #5e7184;
  --text-light: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 90px;
}

/* Header */
.top-sticky {
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

header {
  background: linear-gradient(135deg, var(--primary) 0%, #0d4b7a 100%);
  color: var(--text-light);
  padding: 10px 16px;
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-box {
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.logo-box img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.header-titles h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  margin: 0;
}

.header-titles p {
  font-size: 0.82rem;
  opacity: 0.9;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-header-wa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #25d366;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 20px;
  transition: transform 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn-header-wa:hover {
  background: #20ba5a;
  transform: translateY(-1px);
}

.btn-bancos-header {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-bancos-header:hover {
  background: rgba(255,255,255,0.25);
}

/* Announcement Bar */
.announcement-bar {
  background: #fff8e1;
  color: #8d6e00;
  text-align: center;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-bottom: 1px solid #ffe082;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Search and Filters */
.search-filter-panel {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px;
}

.search-container {
  max-width: 1300px;
  margin: 0 auto;
}

.search-input-wrapper {
  position: relative;
  margin-bottom: 10px;
}

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

#searchInput {
  width: 100%;
  padding: 11px 40px 11px 42px;
  font-size: 1rem;
  border: 2px solid #b8d2eb;
  background-color: #f6faff;
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

#searchInput:focus {
  border-color: var(--primary-light);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(18, 88, 143, 0.15);
}

#clearSearchBtn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: #e2e8f0;
  border: none;
  color: #475569;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

/* Chips / Categories */
.filter-chips-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  background: #e2ecf7;
  color: var(--primary-light);
  border-color: #b8d2eb;
}

.filter-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.filter-chip.chip-oferta {
  color: var(--accent-red);
  background: #ffebee;
  border-color: #ffcdd2;
}

.filter-chip.chip-oferta.active {
  background: var(--accent-red);
  color: #ffffff;
  border-color: var(--accent-red);
}

.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Product Grid */
.main-wrapper {
  max-width: 1300px;
  margin: 16px auto;
  padding: 0 16px;
}

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

/* Product Card */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.product-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #b0c6dc;
}

.product-card.in-cart {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 2px rgba(30, 138, 95, 0.25);
}

.product-badge-container {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 12px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.badge-oferta {
  background: linear-gradient(135deg, #e53935, #c62828);
  color: #ffffff;
}

.badge-nuevo {
  background: linear-gradient(135deg, #1e8a5f, #0f5c3c);
  color: #ffffff;
}

.badge-iva {
  background: #0288d1;
  color: #ffffff;
}

.card-img-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
  border-bottom: 1px solid #edf2f7;
}

.card-img-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}

.card-img-box:hover img {
  transform: scale(1.05);
}

.zoom-hint {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.card-img-box:hover .zoom-hint {
  opacity: 1;
}

/* Card Body */
.card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.card-brand {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.card-code {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  min-height: 38px;
}

.card-presentation {
  font-size: 0.76rem;
  color: #4a5d6e;
  background: #f1f5f9;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

/* Price Box */
.card-price-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin-top: 2px;
}

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

.price-label-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.price-value-unit {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--primary);
}

.price-row-bulto {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 2px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 2px;
}

/* Add to Order Controls */
.card-action-row {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
}

.qty-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  overflow: hidden;
  width: 90px;
}

.qty-btn {
  background: #f1f5f9;
  border: none;
  color: var(--text-main);
  width: 26px;
  height: 34px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background 0.15s ease;
}

.qty-btn:hover {
  background: #e2e8f0;
}

.qty-input {
  width: 38px;
  height: 34px;
  border: none;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  outline: none;
  -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn-add-cart {
  flex: 1;
  background: var(--primary-light);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  transition: background 0.15s ease, transform 0.1s ease;
}

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

.btn-add-cart:active {
  transform: scale(0.97);
}

.btn-add-cart.added {
  background: var(--accent-green);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  color: #94a3b8;
}

/* Bottom Floating Order Bar */
.floating-order-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--primary);
  color: #ffffff;
  padding: 12px 20px;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: space-between;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.floating-summary {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.floating-units {
  font-size: 0.9rem;
  opacity: 0.9;
}

.floating-total {
  font-size: 1.25rem;
  font-weight: 800;
  color: #69f0ae;
}

.floating-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-view-order {
  background: var(--accent-green);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: background 0.15s ease;
}

.btn-view-order:hover {
  background: var(--accent-green-hover);
}

.btn-clear-cart {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-clear-cart:hover {
  background: rgba(255,255,255,0.15);
  border-color: #ffffff;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 41, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

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

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  background: var(--primary);
  color: #ffffff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  padding: 4px;
}

.btn-close-modal:hover {
  opacity: 1;
}

.modal-body {
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Cart items list */
.cart-items-table {
  width: 100%;
  border-collapse: collapse;
}

.cart-item-row {
  border-bottom: 1px solid var(--border-color);
  padding: 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cart-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.cart-item-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  object-fit: contain;
  background: #f8fafc;
  flex-shrink: 0;
}

.cart-item-text {
  min-width: 0;
}

.cart-item-name {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cart-item-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cart-item-subtotal {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
  min-width: 60px;
  text-align: right;
}

.btn-remove-item {
  background: transparent;
  border: none;
  color: #dc2626;
  cursor: pointer;
  padding: 6px;
  font-size: 1.1rem;
  border-radius: 4px;
}

.btn-remove-item:hover {
  background: #fee2e2;
}

/* Customer Inputs */
.customer-fields-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.customer-fields-box h3 {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

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

.input-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
}

.input-group input,
.input-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  background: #ffffff;
}

.input-group input:focus,
.input-group textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(18, 88, 143, 0.15);
}

/* Order Totals Box */
.order-totals-box {
  background: #f1f5f9;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-totals-box .label {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
}

.order-totals-box .amount {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent-green);
}

.order-notes-disclaimer {
  font-size: 0.78rem;
  color: #64748b;
  text-align: center;
  font-style: italic;
}

/* Modal Footer */
.modal-footer {
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  padding: 14px 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-action {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
}

.btn-send-whatsapp {
  background: #25d366;
  color: #ffffff;
  flex: 1;
  min-width: 200px;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.btn-send-whatsapp:hover {
  background: #20ba5a;
}

.btn-export-txt {
  background: #ffffff;
  color: var(--primary-light);
  border: 1px solid var(--primary-light);
}

.btn-export-txt:hover {
  background: #eef6fd;
}

/* Bank Accounts Modal */
.bank-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bank-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bank-card-header {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bank-acc-num {
  font-family: monospace;
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: 0.5px;
  background: #ffffff;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-copy {
  background: transparent;
  border: none;
  color: var(--primary-light);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
}

.btn-copy:hover {
  text-decoration: underline;
}

/* Zoom Lightbox */
.zoom-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(5px);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.zoom-content-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 16px;
  max-width: 500px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  text-align: center;
}

.zoom-close-btn {
  position: absolute;
  top: -14px;
  right: -14px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.zoom-content-box img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.zoom-product-info {
  margin-top: 12px;
  text-align: left;
}

.zoom-product-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.zoom-product-price {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--primary);
  margin-top: 4px;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .card-body {
    padding: 8px 10px;
  }
  .card-title {
    font-size: 0.8rem;
    min-height: 34px;
  }
  .price-value-unit {
    font-size: 1rem;
  }
  .qty-control {
    width: 75px;
  }
  .qty-btn {
    width: 22px;
    height: 30px;
  }
  .qty-input {
    width: 31px;
    height: 30px;
    font-size: 0.85rem;
  }
  .btn-add-cart {
    font-size: 0.75rem;
  }
  .bank-cards-grid {
    grid-template-columns: 1fr;
  }
  .header-actions .btn-header-wa span {
    display: none;
  }
  .header-actions .btn-header-wa {
    padding: 8px;
    border-radius: 50%;
  }
  .floating-order-bar {
    padding: 10px 14px;
  }
  .floating-total {
    font-size: 1.1rem;
  }
  .btn-view-order {
    padding: 9px 14px;
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .logo-box img {
    height: 36px;
  }
  .header-titles h1 {
    font-size: 1.05rem;
  }
  .header-titles p {
    font-size: 0.72rem;
  }
}
