/* Estilos para P013 Cesta Inteligente Multi-Super */
:root {
  --bg-main: #0b0f19;
  --bg-card: #151d30;
  --bg-card-hover: #1c263e;
  --bg-input: #0e1424;
  --border: #232f4b;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --accent: #8b5cf6;
}

* {
  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-main);
  color: var(--text-main);
  line-height: 1.5;
  padding: 20px;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* TOP BAR */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

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

.logo {
  font-size: 32px;
}

.brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.mode-selector {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  gap: 4px;
}

.mode-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
  margin-right: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.btn-mode {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-mode.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* GRID */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.col-left,
.col-right {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.card-highlight {
  border-color: #3b82f666;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.card-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}

/* BADGES */
.badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #374151;
  color: #d1d5db;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* STORES TABLE */
.stores-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.store-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  gap: 12px;
}

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

.store-name {
  font-size: 13px;
  font-weight: 600;
}

.store-thresholds {
  display: flex;
  align-items: center;
  gap: 8px;
}

.threshold-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.input-number {
  width: 70px;
  background: #1e293b;
  border: 1px solid var(--border);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  text-align: right;
  font-weight: 600;
}

.input-number:focus {
  outline: none;
  border-color: var(--primary);
}

/* SHOPPING LIST */
.input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

input[type="text"] {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 6px;
  color: var(--text-main);
  font-size: 13px;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}

.shopping-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 14px;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

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

.item-qty {
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #60a5fa;
}

.item-name {
  font-size: 13px;
}

.item-delete {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 14px;
}

.item-delete:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.list-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* BUTTONS */
button {
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
}

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

.btn-secondary {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
}

.btn-secondary:hover {
  background: #334155;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-lg {
  padding: 10px 18px;
  font-size: 14px;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

/* COMPARISON GRID */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.store-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.store-card.best {
  border-color: #10b981;
  background: #064e3b15;
}

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

.store-card-title {
  font-size: 14px;
  font-weight: 700;
}

.store-card-subtotal {
  font-size: 20px;
  font-weight: 800;
  color: #f8fafc;
}

.threshold-alert {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.threshold-alert.ok {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.threshold-alert.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.smart-fill-tip {
  font-size: 11px;
  background: #1e293b;
  padding: 8px;
  border-radius: 6px;
  border-left: 3px solid #3b82f6;
  color: #cbd5e1;
}

.btn-fill-cart {
  width: 100%;
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.btn-fill-cart:hover {
  background: #1d4ed8;
}

/* SPLIT CART BOX */
.split-cart-box {
  background: #1e1b4b33;
  border: 1px solid #4338ca;
  border-radius: 8px;
  padding: 14px;
}

.split-title {
  font-size: 14px;
  font-weight: 700;
  color: #a5b4fc;
  margin-bottom: 6px;
}

.split-desc {
  font-size: 13px;
  color: #c7d2fe;
  margin-bottom: 10px;
}

/* MAPPINGS */
.keyboard-hints {
  display: flex;
  gap: 8px;
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.mappings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mapping-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.mapping-card.selected {
  border-color: var(--primary);
  background: #1e293b;
  box-shadow: 0 0 0 1px var(--primary);
}

.mapping-compare {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.map-source,
.map-target {
  flex: 1;
}

.map-store {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
}

.map-name {
  font-size: 13px;
  font-weight: 600;
}

.map-arrow {
  color: #64748b;
  font-size: 16px;
}

.mapping-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-approve {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #10b98144;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.btn-approve:hover {
  background: #10b981;
  color: #fff;
}

.btn-reject {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid #ef444444;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.btn-reject:hover {
  background: #ef4444;
  color: #fff;
}

/* KBD SHORTCUTS */
.kbd {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: monospace;
  color: #cbd5e1;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  width: 500px;
  max-width: 90%;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

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

.modal-close {
  font-size: 22px;
  cursor: pointer;
  color: #64748b;
}

.modal-close:hover {
  color: #fff;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.modal-input {
  width: 100%;
  margin-bottom: 16px;
  font-size: 15px;
  padding: 12px 14px;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-tip {
  font-size: 11px;
  color: #64748b;
}

/* NAVIGATION TABS */
.nav-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.tab-view {
  display: none;
}

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

/* PANTRY & FAVORITES TOOLBAR */
.pantry-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  background: var(--bg-card);
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  flex: 1;
  min-width: 240px;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 14px;
  width: 100%;
}

.category-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cat-pill {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cat-pill:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.cat-pill.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  color: #60a5fa;
}

/* FAVORITES GRID */
.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.favorite-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.favorite-card:hover {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.card-cat-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-badges {
  display: flex;
  gap: 4px;
}

.badge-bio {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-staple {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.favorite-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
}

.card-brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* PRECIOS COMPARADOS EN TARJETA */
.store-prices-table {
  background: var(--bg-input);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.store-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.store-price-row.is-best {
  font-weight: 700;
  color: #34d399;
}

.store-name-dot {
  display: flex;
  align-items: center;
  gap: 6px;
}

.equiv-suggestion-box {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  color: #c084fc;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* STEPPER DE CANTIDAD */
.card-bottom-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.card-qty-stepper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.btn-stepper {
  background: transparent;
  border: none;
  color: var(--text-main);
  width: 36px;
  height: 36px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-stepper:hover {
  background: var(--bg-card-hover);
  color: var(--primary);
}

.qty-val {
  min-width: 32px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-add-cesta {
  background: var(--primary);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* MOBILE BOTTOM NAV */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0f172a;
  border-top: 1px solid var(--border);
  padding: 6px 12px 14px;
  z-index: 999;
  justify-content: space-around;
}

.mobile-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  min-width: 54px;
  min-height: 48px;
  justify-content: center;
}

.mobile-nav-btn.active {
  color: #60a5fa;
}

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

@media (max-width: 768px) {
  body {
    padding: 12px 12px 70px;
  }
  .nav-tabs {
    display: none;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .favorites-grid {
    grid-template-columns: 1fr;
  }
  .header-controls {
    width: 100%;
    justify-content: space-between;
  }
}
