/**
 * Client Base Styles - Estilos específicos del template base
 * NO duplicar estilos que ya están en main-ux.css, design-system.css, etc.
 */

/* ============================================
   Z-Index Scale (Single source of truth)
   ============================================ */
:root {
  --z-header: 100;
  --z-sticky: 200;
  --z-view-tabs: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-sticky-cart: 600;
  --z-mini-tracker: 550;
  --z-undo-snackbar: 650;
  --z-toast: 700;
  --z-loading-overlay: 800;
  --z-debug: 900;
}

/* ============================================
   Mini Tracker (Order Progress)
   ============================================ */
.mini-tracker {
  position: fixed;
  left: 50%;
  bottom: 5.9rem;
  transform: translateX(-50%) translateY(10px);
  z-index: var(--z-mini-tracker);
  width: min(96vw, 560px);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.22);
  padding: 0.65rem 0.7rem;
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.mini-tracker.visible {
  display: block;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.mini-tracker-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 999px;
  color: #475569;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mini-tracker-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-right: 1.65rem;
}

.mini-tracker-left {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.mini-tracker-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #fff7ed;
  color: #f97316;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.mini-tracker-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-tracker-title {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 700;
  line-height: 1.2;
}

.mini-tracker-status {
  font-size: 0.86rem;
  color: #0f172a;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.mini-tracker-right {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.mini-tracker-order-select {
  display: none;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  color: #64748b;
}

.mini-tracker-order-select label {
  font-weight: 700;
  color: #64748b;
}

.mini-tracker-order-select select {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 8px;
  color: #0f172a;
  font-size: 0.76rem;
  padding: 0.2rem 0.35rem;
  max-width: 150px;
  min-height: 44px;
}

.mini-tracker-progress-container {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 115px;
}

.mini-tracker-progress-bar {
  width: 76px;
  height: 7px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.mini-tracker-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fb923c, #f97316);
  transition: width 0.25s ease;
}

.mini-tracker-percentage {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  min-width: 28px;
  text-align: right;
}

.mini-tracker-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.6rem 0.8rem;
  min-height: 44px;
  cursor: pointer;
  white-space: nowrap;
}

.mini-tracker-btn--primary {
  border-color: var(--client-primary, #ff6b35);
  background: var(--client-primary, #ff6b35);
  color: #fff;
}

/* ============================================
   Global Loading Overlay
   ============================================ */
.global-loading-overlay {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 64px;
  height: 64px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: var(--z-loading-overlay);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
}

.global-loading-overlay.visible {
  opacity: 1;
  transform: translateY(0);
}

.global-loading-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: global-loading-spin 0.8s linear infinite;
}

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

/* ============================================
   View Tabs Navigation
   ============================================ */
.view-tabs {
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: var(--z-view-tabs);
  display: block;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.view-tabs.visible {
  display: block;
}

.view-tabs-container {
  width: 100%;
  padding: 0 1.25rem;
  display: flex;
  gap: 0;
}

.view-tab {
  padding: 1rem 2rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  color: var(--client-muted, #64748b);
  transition: all 0.3s;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 52px;
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  white-space: nowrap;
  transition:
    max-width 0.28s ease,
    padding 0.28s ease,
    margin 0.28s ease,
    opacity 0.22s ease,
    transform 0.28s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    background-color 0.2s ease;
}

.view-tab--collapsed {
  flex: 0 0 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border-width: 0 !important;
  opacity: 0;
  transform: translateX(0.35rem) scale(0.98);
  pointer-events: none;
}

.view-tab--collapsed .view-tab__icon,
.view-tab--collapsed .view-tab__text,
.view-tab--collapsed .badge {
  opacity: 0;
}

.view-tab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.view-tab:hover:not(:disabled) {
  color: var(--client-primary, #ff6b35);
  background: var(--client-bg, #f1f5f9);
}

.view-tab.active {
  color: var(--client-primary, #ff6b35);
  border-bottom-color: var(--client-primary, #ff6b35);
}

.view-tab .badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--client-primary, #ff6b35);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  width: 100%;
  border-top: 1px solid #e2e8f0;
  padding: 1.25rem 1rem;
  background: rgba(15, 23, 42, 0.04);
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.footer-main {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 1rem;
  width: 100%;
}

.footer-hours-actions {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
}

.footer-copyright {
  grid-column: 2;
  margin: 0;
  color: var(--client-muted, #64748b);
  text-align: center;
  line-height: 1.45;
}

.footer-hours-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.25rem;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.footer-hours-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

/* ============================================
   Active Orders Section
   ============================================ */
.active-orders-section {
  background: white;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 52px;
  z-index: 85;
}

.active-order-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.3s;
}

.active-order-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.active-order-card--highlight {
  border-color: var(--client-primary, #ff6b35);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.active-order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.active-order-status {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-requested { background: #fef3c7; color: #92400e; }
.status-waiter_accepted { background: #dbeafe; color: #1e40af; }
.status-kitchen_in_progress { background: #fed7aa; color: #9a3412; }
.status-ready_for_delivery { background: #d1fae5; color: #065f46; }
.status-delivered { background: #d1fae5; color: #065f46; }

.active-order-items {
  margin-top: 0.5rem;
}

.active-order-item {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.9rem;
  color: var(--client-text, #0f172a);
}

.active-order-total {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  color: var(--client-primary, #ff6b35);
}

.active-order-actions {
  display: flex;
  gap: 8px;
  margin-top: 0.75rem;
}

.active-order-action {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

.active-order-action--edit {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.active-order-action--cancel {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

.active-orders-headline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.active-orders-headline span {
  font-size: 0.9rem;
  color: var(--client-muted, #64748b);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ============================================
   Order Tracker Timeline
   ============================================ */
.single-order-tracker {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.tracker-timeline {
  display: flex;
  justify-content: space-between;
  margin: 2rem 0;
  position: relative;
}

.tracker-timeline::before {
  content: '';
  position: absolute;
  top: 30px;
  left: 60px;
  right: 60px;
  height: 4px;
  background: #e2e8f0;
  z-index: 0;
}

.tracker-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  position: relative;
  z-index: 1;
}

.tracker-step-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: white;
  border: 4px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.3s;
}

.tracker-step.completed .tracker-step-icon {
  background: var(--client-primary, #ff6b35);
  border-color: var(--client-primary, #ff6b35);
  color: white;
}

.tracker-step.active .tracker-step-icon {
  border-color: var(--client-primary, #ff6b35);
  animation: tracker-pulse 2s infinite;
}

.tracker-step-label {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--client-muted, #64748b);
}

.tracker-step.completed .tracker-step-label,
.tracker-step.active .tracker-step-label {
  color: var(--client-primary, #ff6b35);
}

@keyframes tracker-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ============================================
   Support Modal
   ============================================ */
.support-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: 1rem;
}

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

.support-modal-content {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  max-width: 640px;
  width: min(100%, 640px);
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  padding: 1.25rem;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.28);
  position: relative;
  max-height: min(90vh, 860px);
  overflow-y: auto;
}

.support-modal-content h2 {
  margin: 0 2.5rem 0.4rem 0;
  color: #0f172a;
  font-size: 1.75rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.support-modal-content > p {
  margin: 0 0 1rem 0;
  color: #475569;
  font-size: 1.04rem;
  line-height: 1.45;
}

.support-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.support-modal-close:hover {
  border-color: #94a3b8;
  background: #eef2f7;
  color: #0f172a;
}

.support-link {
  background: none;
  border: none;
  color: var(--client-primary, #ff6b35);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-left: 0.5rem;
}

.support-link:hover {
  text-decoration: underline;
}

/* Support Form */
.support-modal #support-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.support-modal .form-group {
  margin-bottom: 0;
}

.support-modal .form-group label {
  display: block;
  margin-bottom: 0.42rem;
  color: #334155;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

.support-modal .form-group input,
.support-modal .form-group select,
.support-modal .form-group textarea {
  width: 100%;
  display: block;
  border: 1.5px solid #94a3b8;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  font-size: 1.02rem;
  line-height: 1.4;
  padding: 0.78rem 0.9rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 44px;
}

.support-modal .form-group select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 12px) 19px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}

.support-modal .form-group textarea {
  min-height: 132px;
  resize: vertical;
}

.support-modal .form-group input::placeholder,
.support-modal .form-group textarea::placeholder {
  color: #64748b;
  opacity: 1;
}

.support-modal .form-group input:focus-visible,
.support-modal .form-group select:focus-visible,
.support-modal .form-group textarea:focus-visible {
  border-color: var(--client-primary, #ff6b35);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.18);
}

.support-feedback {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  display: none;
}

.support-feedback.success { color: #0f766e; display: block; }
.support-feedback.error { color: #b91c1c; display: block; }

/* File Upload */
.file-upload-wrapper {
  position: relative;
  border: 2px dashed #64748b;
  border-radius: 12px;
  padding: 1.2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8fafc;
}

.file-upload-wrapper:hover {
  border-color: var(--client-primary, #ff6b35);
  background: rgba(255, 107, 53, 0.05);
}

.file-upload-wrapper input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--client-muted, #64748b);
}

.file-upload-placeholder svg {
  width: 32px;
  height: 32px;
}

.file-upload-placeholder span {
  font-size: 0.875rem;
}

.file-upload-preview {
  position: relative;
  display: none;
}

.file-upload-preview.show {
  display: block;
}

.file-upload-preview img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 8px;
}

.remove-image {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 32px;
  height: 32px;
  min-width: 44px;
  min-height: 44px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

/* Support Success */
.support-success {
  text-align: center;
  padding: 1rem 0;
  display: none;
}

.support-success.show {
  display: block;
}

.support-success-icon {
  width: 64px;
  height: 64px;
  background: #d1fae5;
  color: #10b981;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1rem;
}

.support-success h3 {
  margin: 0 0 0.5rem 0;
  color: var(--client-text, #0f172a);
}

.support-success p {
  color: var(--client-muted, #64748b);
  margin: 0 0 1rem 0;
}

.support-success strong {
  color: var(--client-primary, #ff6b35);
  font-size: 1.25rem;
}

/* ============================================
   Checkout Section
   ============================================ */
#request-check-btn {
  min-height: 44px;
}

#request-check-btn:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
}

#request-check-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Checkout Accordion */
.checkout-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 2rem;
}

.checkout-accordion {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.checkout-accordion.collapsed .accordion-content {
  display: none;
}

.checkout-accordion-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: #ffffff;
}

.checkout-accordion:not(.collapsed) .checkout-accordion-header {
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.accordion-title {
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #111827;
}

.accordion-icon {
  font-size: 1.2rem;
}

.accordion-chevron {
  transition: transform 0.3s ease;
  color: #9ca3af;
}

.checkout-accordion:not(.collapsed) .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-content {
  padding: 1.25rem;
  background: #ffffff;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-status {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
  .footer-main {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
  }

  .footer-copyright {
    width: 100%;
  }

  .footer-hours-actions {
    justify-self: center;
  }

  .view-tab {
    flex: 1;
    justify-content: center;
    padding: 0.75rem 0.5rem;
  }

  .view-tab--collapsed {
    flex: 0 0 0 !important;
    padding: 0 !important;
  }

  .view-tab__text {
    font-size: 0.85rem;
  }

  .mini-tracker {
    width: calc(100vw - 1rem);
    bottom: 5.3rem;
    padding: 0.55rem 0.6rem;
  }

  .mini-tracker-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding-right: 1.45rem;
  }

  .mini-tracker-right {
    width: 100%;
    justify-content: space-between;
  }

  .mini-tracker-status {
    max-width: 100%;
  }

  .support-modal {
    padding: 0.6rem;
  }

  .support-modal-content {
    width: 100%;
    border-radius: 16px;
    padding: 1rem;
    max-height: 92vh;
  }

  .support-modal-content h2 {
    font-size: 1.42rem;
  }

  .support-modal-content > p {
    font-size: 0.98rem;
  }
}

@media (max-width: 640px) {
  .view-tab {
    padding: 0.75rem 0.5rem;
  }

  .view-tab__text {
    font-size: 0.85rem;
  }
}
