/* Client menu — UI 2.0 (tokens en tokens.css) */

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

body.client-app {
  font-family: var(--font-sans);
  background: var(--brand-surface);
  color: var(--brand-text);
  line-height: var(--line-height-normal);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* —— Header sticky —— */
.client-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bar-gradient, var(--brand-gradient));
  color: var(--brand-text-inverse);
  box-shadow: var(--shadow-md);
}

.client-header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  text-align: left;
}

.header-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.15);
  padding: 4px;
  flex-shrink: 0;
}

.header-titles {
  min-width: 0;
}

.client-header h1 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-subtitle {
  font-size: var(--font-size-sm);
  opacity: 0.9;
  margin: 2px 0 0;
}

.guest-badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.2);
  font-size: var(--font-size-xs);
  font-weight: 600;
}

.client-main {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-4);
  padding-bottom: calc(160px + env(safe-area-inset-bottom, 0));
}

.promo-banner {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px solid #fdba74;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.12);
}

.promo-banner.registered {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #6ee7b7;
}

.promo-banner-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.promo-banner-compact .promo-banner-content strong {
  display: block;
  font-size: var(--font-size-sm);
  color: #9a3412;
}

.promo-banner-compact .promo-banner-content p {
  font-size: var(--font-size-xs);
  margin: 2px 0 0;
}

.promo-banner.registered h3 {
  color: #065f46;
}

.promo-banner p {
  font-size: 13px;
  color: #7c2d12;
  margin-bottom: 12px;
  line-height: 1.45;
}

.promo-banner.registered p {
  color: #047857;
}

.promo-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.promo-btn-primary {
  flex: 1;
  min-width: 140px;
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}

.promo-btn-secondary {
  background: #fff;
  color: #7c3aed;
  border: 1px solid #c4b5fd;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}

.session-closed-panel {
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin: 20px 0;
}

.session-closed-panel h2 {
  color: #b91c1c;
  margin-bottom: 8px;
}

.menu-toolbar {
  margin-bottom: var(--space-4);
}

.search-wrap {
  position: relative;
}

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

.product-search {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  background: var(--brand-surface-elevated);
  font-family: inherit;
}

.product-search:focus {
  outline: none;
  border-color: var(--bar-primary);
  box-shadow: 0 0 0 3px var(--bar-primary-soft);
}

.categories {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.categories::-webkit-scrollbar {
  display: none;
}

.categories-sticky {
  position: sticky;
  top: calc(56px + var(--space-2));
  z-index: 40;
  background: linear-gradient(var(--brand-surface) 70%, transparent);
  padding-top: var(--space-2);
  margin: 0 calc(-1 * var(--space-4));
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.category-btn {
  padding: 8px 16px;
  background: var(--brand-surface-elevated);
  color: var(--bar-primary);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--font-size-sm);
  white-space: nowrap;
  transition: all var(--transition-fast);
  scroll-snap-align: start;
  flex-shrink: 0;
}

.category-btn.active {
  background: var(--bar-primary);
  color: var(--brand-text-inverse);
  border-color: var(--bar-primary);
  box-shadow: var(--shadow-sm);
}

.category-btn:hover:not(.active) {
  border-color: var(--bar-primary);
  background: var(--bar-primary-soft);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.product-card {
  background: var(--brand-surface-elevated);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: var(--shadow-md);
}

@media (hover: hover) {
  .product-card:hover {
    transform: none;
  }
}

.product-image,
.product-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(145deg, var(--bar-primary-soft) 0%, var(--brand-surface-sunken) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bar-primary);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.product-image-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.guest-badge.registered-badge {
  background: rgba(5, 150, 105, 0.35);
}

.product-card.in-cart {
  border-color: var(--bar-primary);
  box-shadow: 0 0 0 1px var(--bar-primary-soft);
}

.product-info {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  flex: 1;
}

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

.product-price {
  color: var(--bar-primary);
  font-weight: 700;
  font-size: var(--font-size-lg);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.product-stepper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--brand-surface-sunken);
  border-radius: var(--radius-full);
  padding: 4px;
}

.qty-value {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
}

.stepper-add-btn {
  padding: 10px 16px;
  background: var(--bar-primary);
  color: var(--brand-text-inverse);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--font-size-sm);
  min-height: 40px;
  white-space: nowrap;
  transition: background var(--transition-fast);
}

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

.products-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-8);
  color: var(--brand-text-muted);
}

.product-extras {
  margin-bottom: var(--space-3);
}

.product-name {
  font-weight: 600;
  font-size: var(--font-size-base);
  margin-bottom: var(--space-1);
  line-height: var(--line-height-tight);
}

.product-desc {
  font-size: var(--font-size-xs);
  color: var(--brand-text-muted);
  margin-bottom: var(--space-3);
  min-height: 2.5em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--brand-border);
  background: var(--brand-surface-elevated);
  cursor: pointer;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: var(--font-size-lg);
  color: var(--bar-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--brand-surface-elevated);
  border-top: 1px solid var(--brand-border);
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -4px 24px rgba(26, 29, 38, 0.08);
  z-index: 100;
  max-width: 900px;
  margin: 0 auto;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.cart-footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--brand-border);
  margin-bottom: var(--space-3);
}

.cart-footer-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

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

.cart-count {
  font-size: var(--font-size-xs);
  color: var(--brand-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cart-total-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-top: 2px;
}

.cart-total-label {
  font-size: var(--font-size-sm);
  color: var(--brand-text-secondary);
}

.cart-total-amount {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--bar-primary);
  font-variant-numeric: tabular-nums;
}

.checkout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 14px 24px;
  background: var(--bar-primary);
  color: var(--brand-text-inverse);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-weight: 700;
  font-size: var(--font-size-base);
  min-height: 48px;
  min-width: 120px;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

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

.checkout-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.footer-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.footer-user-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--bar-primary);
}

.footer-logout-btn {
  background: transparent;
  border: 1px solid var(--brand-border);
  color: var(--brand-text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  cursor: pointer;
}

.footer-logout-btn:hover {
  border-color: var(--brand-danger);
  color: var(--brand-danger);
}

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 14px;
  background: transparent;
  color: var(--bar-primary);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 600;
  min-height: 40px;
}

.account-btn:hover {
  background: var(--bar-primary-soft);
  border-color: var(--bar-primary);
}

.message {
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-lg);
  border-left: 4px solid;
}

.message.error {
  background: var(--color-error-light);
  color: var(--color-error);
  border-left-color: var(--color-error);
}

.loading {
  text-align: center;
  padding: var(--space-8);
  font-size: var(--font-size-base);
  color: var(--brand-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.loading-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--brand-border);
  border-top-color: var(--bar-primary);
  border-radius: 50%;
  animation: client-spin 0.7s linear infinite;
}

@keyframes client-spin {
  to { transform: rotate(360deg); }
}

.session-closed-icon {
  font-size: 2rem;
  color: var(--brand-danger);
  margin-bottom: var(--space-3);
}

.text-center { text-align: center; }
.text-tertiary { color: var(--color-text-tertiary); }

/* Modales cliente */
.client-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.client-modal-panel {
  background: #fff;
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-height: 90vh;
  overflow-y: auto;
}

.client-modal-panel-wide {
  max-width: 520px;
}

.client-modal-subtitle {
  color: var(--color-text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.client-modal-btn-full {
  width: 100%;
  margin-top: 10px;
}

.guest-entry-btn {
  background: #7c3aed;
  color: #fff;
}

.identity-other-btn {
  background: #fff;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.form-input {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 14px;
}

.account-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: var(--spacing-sm);
}

.account-header h2 {
  color: var(--color-primary);
  margin: 0;
  font-size: 20px;
}

.close-account-btn {
  background: var(--color-danger);
  color: var(--color-text-light);
  border: none;
  border-radius: var(--radius-full);
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--color-bg-quaternary);
  border-radius: var(--radius-md);
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.summary-label {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.summary-value {
  font-size: 18px;
  font-weight: bold;
}

.summary-value.pending { color: var(--color-warning); }
.summary-value.served { color: var(--color-success); }

.orders-list {
  max-height: 320px;
  overflow-y: auto;
}

.order-item {
  background: var(--color-bg-quaternary);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  border-left: 4px solid var(--color-primary);
}

.order-item.served { border-left-color: var(--color-success); }
.order-item.pending { border-left-color: var(--color-warning); }
.order-item.in_progress { border-left-color: var(--color-info); }

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.order-status {
  padding: 4px 12px;
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-light);
}

.order-status.pending { background: var(--color-warning); }
.order-status.in_progress { background: var(--color-info); }
.order-status.served { background: var(--color-success); }

.order-items-list { margin: var(--spacing-sm) 0; font-size: 14px; }

.order-item-row {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-xs) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.order-total {
  font-weight: bold;
  margin-top: var(--spacing-sm);
  padding-top: var(--spacing-sm);
  border-top: 2px solid var(--color-border);
}

.register-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-light);
}

.register-block h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.register-block p {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.register-hint {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-bottom: 10px;
}

.register-done {
  color: #0a7;
  font-size: 14px;
  text-align: center;
}

.active-offers-panel {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.offers-title {
  font-size: 18px;
  color: #92400e;
  margin-bottom: 12px;
}

.offer-card {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.offer-card:last-child {
  margin-bottom: 0;
}

.offer-card h3 {
  font-size: 16px;
  color: #78350f;
  margin-bottom: 6px;
}

.offer-card p {
  font-size: 14px;
  color: #92400e;
  margin-bottom: 4px;
  line-height: 1.45;
}

.offer-products {
  font-size: 13px;
}

.cart-promo-hint {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--bar-primary);
  margin-top: var(--space-1);
  font-weight: 600;
}

.cart-total-before {
  font-size: var(--font-size-xs);
  color: var(--brand-text-muted);
  text-decoration: line-through;
  margin-left: var(--space-2);
  font-weight: 400;
}

/* —— Confirmación de pedido —— */
.order-success-panel {
  text-align: center;
}

.order-success-icon {
  font-size: 3rem;
  color: var(--brand-success);
  margin-bottom: var(--space-3);
  line-height: 1;
}

.order-success-panel h3 {
  margin-bottom: var(--space-2);
  font-size: var(--font-size-xl);
}

.order-success-message {
  color: var(--brand-text-secondary);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-4);
}

.order-success-summary {
  background: var(--brand-surface-sunken);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  text-align: left;
  font-size: var(--font-size-sm);
}

.order-success-summary dt {
  color: var(--brand-text-muted);
  font-weight: 500;
  margin-top: var(--space-2);
}

.order-success-summary dt:first-child {
  margin-top: 0;
}

.order-success-summary dd {
  margin: 2px 0 0;
  font-weight: 600;
  color: var(--brand-text);
}

@media (max-width: 600px) {
  .client-main {
    padding-bottom: calc(200px + env(safe-area-inset-bottom, 0));
  }

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

  .cart-footer-main {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-user {
    justify-content: center;
    width: 100%;
  }

  .checkout-btn,
  .account-btn,
  .stepper-add-btn,
  .stepper-btn {
    width: 100%;
    min-height: 44px;
  }

  .client-header-inner {
    padding: var(--space-3);
  }
}
