/* ================================================================
   order-tracker.css — Jama App  v2
   Diseño profesional estilo Uber Eats
   ================================================================ */

/* ── MODAL OVERRIDES — garantizan que styles.css no interfiera ── */
#order-confirm-modal .modal-sheet {
  padding: 0 !important;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0 !important;
  max-height: 94vh !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Ocultar el drag handle original — el tracker tiene el suyo */
#order-confirm-modal .modal-drag-handle {
  display: none !important;
}

#order-confirm-content {
  padding: 0 !important;
  text-align: left !important;
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

/* ── CLOSE BTN ── */
.tracker-close-x {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.07);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  color: #444;
  transition: background 0.15s;
  z-index: 10;
}
.tracker-close-x:hover { background: rgba(0,0,0,0.13); }

/* ── SCROLL WRAPPER ── */
.tracker-scroll {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── HANDLE ── */
.tracker-handle {
  width: 40px;
  height: 4px;
  background: #e0e0e0;
  border-radius: 99px;
  margin: 0.75rem auto 0;
  flex-shrink: 0;
}

/* ================================================================
   TOP — TIEMPO ESTIMADO
   ================================================================ */
.tracker-eta-section {
  padding: 1rem 1.5rem 0.5rem;
  position: relative;
}

.tracker-eta-label {
  font-size: 0.78rem;
  color: #888;
  font-weight: 500;
  margin-bottom: 2px;
}

.tracker-eta-time {
  font-family: var(--font-display, sans-serif);
  font-size: 1.9rem;
  color: #1a1a1a;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

/* ================================================================
   STATUS CARD — pill expandible
   ================================================================ */
.tracker-status-card {
  margin: 0.75rem 1rem;
  background: #fff;
  border: 1.5px solid #ececec;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 1px 2px rgba(25,19,15,.04), 0 2px 6px rgba(25,19,15,.06);
  cursor: pointer;
  transition: box-shadow .28s cubic-bezier(0.16,1,0.3,1), transform .28s cubic-bezier(0.16,1,0.3,1);
}
.tracker-status-card:hover { box-shadow: 0 4px 8px rgba(25,19,15,.05), 0 16px 36px rgba(25,19,15,.10); transform: translateY(-2px); }

/* Dot pulsante */
.tracker-status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--color-red, #FF3D2E);
  box-shadow: 0 0 0 0 rgba(255,61,46,0.4);
  animation: dotPulse 1.6s ease-in-out infinite;
}
.tracker-status-dot.done {
  background: #22c55e;
  box-shadow: none;
  animation: none;
}

@keyframes dotPulse {
  0%   { box-shadow: 0 0 0 0   rgba(255,61,46,0.45); }
  70%  { box-shadow: 0 0 0 9px rgba(255,61,46,0);    }
  100% { box-shadow: 0 0 0 0   rgba(255,61,46,0);    }
}

.tracker-status-text {
  flex: 1;
}

.tracker-status-main {
  font-weight: 800;
  font-size: 0.95rem;
  color: #1a1a1a;
}

.tracker-status-sub {
  font-size: 0.78rem;
  color: #888;
  margin-top: 1px;
}

.tracker-chevron {
  color: #bbb;
  font-size: 1rem;
  transition: transform 0.25s;
}
.tracker-chevron.open { transform: rotate(180deg); }

/* ── TIMELINE EXPANDIBLE ── */
.tracker-timeline-collapse {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease;
}
.tracker-timeline-collapse.open {
  max-height: 320px;
}

.tracker-timeline {
  padding: 0.25rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tracker-step {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  position: relative;
  padding-bottom: 1rem;
}
.tracker-step:last-child { padding-bottom: 0; }

/* Línea vertical */
.tracker-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: #e5e5e5;
  transition: background 0.4s;
}
.tracker-step.done:not(:last-child)::after { background: #22c55e; }
.tracker-step.active:not(:last-child)::after {
  background: linear-gradient(to bottom, var(--color-red, #FF3D2E) 0%, #e5e5e5 100%);
}

/* Dot del step */
.tracker-step-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: transparent;
  transition: all 0.35s;
  margin-top: 1px;
  z-index: 1;
}
.tracker-step.done .tracker-step-dot {
  border-color: #22c55e;
  background: #22c55e;
  color: #fff;
  font-size: 0.7rem;
}
.tracker-step.active .tracker-step-dot {
  border-color: var(--color-red, #FF3D2E);
  background: var(--color-red, #FF3D2E);
  box-shadow: 0 0 0 4px rgba(255,61,46,0.15);
}

.tracker-step-info { flex: 1; }

.tracker-step-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #bbb;
  transition: color 0.3s;
}
.tracker-step.done .tracker-step-label,
.tracker-step.active .tracker-step-label { color: #1a1a1a; }

.tracker-step-desc {
  font-size: 0.72rem;
  color: #bbb;
  margin-top: 1px;
  transition: color 0.3s;
}
.tracker-step.active .tracker-step-desc { color: #888; }
.tracker-step.done  .tracker-step-desc  { color: #aaa; }

/* ================================================================
   ILUSTRACIÓN CENTRAL — cambia por estado
   ================================================================ */
.tracker-illustration {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #fafafa;
  margin: 0.25rem 0;
  flex-shrink: 0;
}

.tracker-illustration-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Círculo de fondo decorativo */
.tracker-illustration-circle {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  position: absolute;
  opacity: 0.13;
}

.tracker-illustration-emoji {
  font-size: 7rem;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.12));
  animation: illustFloat 3s ease-in-out infinite;
  user-select: none;
}

@keyframes illustFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-10px) rotate(2deg); }
}

/* Estado: recibido — azul suave */
.tracker-illustration.state-recibido   { background: #f0f7ff; }
.tracker-illustration.state-recibido   .tracker-illustration-circle { background: #3b82f6; }
.tracker-illustration.state-recibido   .tracker-illustration-emoji  { animation-duration: 2s; }

/* Estado: preparando — amarillo cálido */
.tracker-illustration.state-preparando { background: #fffbeb; }
.tracker-illustration.state-preparando .tracker-illustration-circle { background: #f59e0b; }

/* Estado: en-camino — rojo Jama */
.tracker-illustration.state-en-camino  { background: #fff5f5; }
.tracker-illustration.state-en-camino  .tracker-illustration-circle { background: #FF3D2E; }
.tracker-illustration.state-en-camino  .tracker-illustration-emoji  {
  animation: riderMove 1.2s ease-in-out infinite;
}

@keyframes riderMove {
  0%   { transform: translateX(-6px) rotate(-3deg); }
  50%  { transform: translateX(6px) rotate(3deg); }
  100% { transform: translateX(-6px) rotate(-3deg); }
}

/* Estado: entregado — verde */
.tracker-illustration.state-entregado  { background: #f0fdf4; }
.tracker-illustration.state-entregado  .tracker-illustration-circle { background: #22c55e; }
.tracker-illustration.state-entregado  .tracker-illustration-emoji  {
  animation: deliveredPop 0.6s cubic-bezier(0.34,1.56,0.64,1) forwards,
             illustFloat 3s 0.6s ease-in-out infinite;
}

@keyframes deliveredPop {
  0%   { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ================================================================
   ORDER DETAILS
   ================================================================ */
.tracker-details {
  padding: 0 1rem;
  margin-top: 0.25rem;
}

.tracker-details-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #1a1a1a;
  margin-bottom: 0.6rem;
}

.tracker-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  color: #555;
}

.tracker-detail-icon { font-size: 0.95rem; flex-shrink: 0; margin-top: 1px; }

/* Items del pedido */
.tracker-items {
  background: #f8f8f8;
  border-radius: 12px;
  padding: 0.75rem;
  margin: 0.5rem 0;
}

.tracker-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #555;
  padding: 0.2rem 0;
}

.tracker-item-row.total {
  font-weight: 800;
  color: #1a1a1a;
  border-top: 1px solid #e5e5e5;
  margin-top: 0.35rem;
  padding-top: 0.5rem;
}

/* ================================================================
   ACCIONES
   ================================================================ */
.tracker-actions {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

.tracker-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1rem;
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 99px;
  font-family: var(--font-body, sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
  box-shadow: 0 4px 18px rgba(37,211,102,0.35);
}
.tracker-wa-btn:hover { background: #1da851; transform: scale(1.02); }

.tracker-dismiss-btn {
  width: 100%;
  padding: 0.85rem;
  background: transparent;
  border: 1.5px solid #e5e5e5;
  border-radius: 99px;
  font-family: var(--font-body, sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  color: #717171;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.tracker-dismiss-btn:hover { background: #f5f5f5; border-color: #ccc; }

/* Review btn (solo en estado entregado) */
.tracker-review-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1rem;
  background: var(--color-red, #FF3D2E);
  color: #fff;
  border: none;
  border-radius: 99px;
  font-family: var(--font-body, sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  box-shadow: 0 4px 18px rgba(255,61,46,0.3);
}
.tracker-review-btn:hover { background: #e02a1c; transform: scale(1.02); }

/* ================================================================
   DASHBOARD RESTAURANTE — PEDIDOS
   ================================================================ */
.orders-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.orders-column {
  background: #f5f5f5;
  border-radius: 16px;
  padding: 1rem;
  min-height: 180px;
}

.orders-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid #e0e0e0;
}

.orders-column-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 800;
  font-size: 0.85rem;
  color: #1a1a1a;
}

.orders-column-count {
  background: #e0e0e0;
  color: #555;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
}

.order-card {
  background: #fff;
  border-radius: 12px;
  padding: 0.9rem;
  margin-bottom: 0.7rem;
  border: 1.5px solid #F0ECE7;
  box-shadow: 0 1px 2px rgba(25,19,15,.04), 0 2px 6px rgba(25,19,15,.06);
  transition: box-shadow .28s cubic-bezier(0.16,1,0.3,1), transform .28s cubic-bezier(0.16,1,0.3,1);
}
.order-card:hover { box-shadow: 0 4px 8px rgba(25,19,15,.05), 0 16px 36px rgba(25,19,15,.10); transform: translateY(-3px); }
.order-card.order-card--push-target {
  outline: 3px solid rgba(255, 61, 46, .28);
  box-shadow: 0 0 0 6px rgba(255, 61, 46, .08), 0 16px 36px rgba(25,19,15,.12);
}
.order-card:last-child { margin-bottom: 0; }

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.4rem;
}

.order-card-id    { font-size: 10px; font-weight: 700; color: #bbb; text-transform: uppercase; letter-spacing: 0.4px; }
.order-card-time  { font-size: 10px; color: #bbb; font-weight: 600; }
.order-card-customer { font-weight: 700; font-size: 0.88rem; color: #1a1a1a; margin-bottom: 2px; }
.order-card-address  { font-size: 0.76rem; color: #888; margin-bottom: 0.4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-card-items    { font-size: 0.76rem; color: #555; line-height: 1.5; margin-bottom: 0.7rem; padding: 0.45rem 0.6rem; background: #f8f8f8; border-radius: 8px; }
.order-card-footer   { display: flex; align-items: center; justify-content: space-between; }
.order-card-total    { font-weight: 800; font-size: 1rem; color: #1a1a1a; }
.order-card-payment  { font-size: 10px; color: #888; font-weight: 600; }

.btn-advance-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.85rem;
  border: none;
  border-radius: 99px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  white-space: nowrap;
}
.btn-advance-status:hover              { transform: scale(1.04); }
.btn-advance-status.next-preparando   { background: #fef9c3; color: #854d0e; }
.btn-advance-status.next-preparando:hover { background: #fde68a; }
.btn-advance-status.next-en-camino    { background: #dbeafe; color: #1e40af; }
.btn-advance-status.next-en-camino:hover  { background: #bfdbfe; }
.btn-advance-status.next-entregado    { background: #dcfce7; color: #15803d; }
.btn-advance-status.next-entregado:hover  { background: #bbf7d0; }

.order-status-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.order-status-pill.recibido   { background: #fef9c3; color: #854d0e; }
.order-status-pill.preparando { background: #dbeafe; color: #1e40af; }
.order-status-pill.en-camino  { background: #e0f2fe; color: #0369a1; }
.order-status-pill.entregado  { background: #dcfce7; color: #15803d; }
.order-status-pill.cancelado  { background: #f3f4f6; color: #6b7280; }

/* T-07 · solicitud de cancelación del cliente */
.tk-cancel-request {
  width: 100%; min-height: 44px; border: 1.5px solid #dc2626; border-radius: 14px;
  background: #fff; color: #b91c1c; font: 700 14px/1.2 inherit; cursor: pointer;
}
.tk-cancel-request:focus-visible, .tk-cancel-submit:focus-visible,
.tk-cancel-close:focus-visible, .tk-cancel-dialog select:focus-visible,
.tk-cancel-dialog textarea:focus-visible { outline: 3px solid rgba(255,61,46,.25); outline-offset: 2px; }
.tk-cancel-state {
  display: grid; gap: 4px; padding: 12px 14px; border-radius: 14px;
  background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12; text-align: left;
}
.tk-cancel-state span { font-size: 12px; line-height: 1.45; }
.tk-cancel-state--rejected { background: #f8fafc; border-color: #cbd5e1; color: #334155; }
.tk-cancel-overlay {
  position: fixed; inset: 0; z-index: 10050; display: grid; align-items: end;
  padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background: rgba(15,23,42,.55); backdrop-filter: blur(3px);
}
.tk-cancel-dialog {
  width: min(100%, 480px); max-height: min(82dvh, 680px); overflow: auto;
  margin: 0 auto; padding: 22px; border-radius: 24px; background: #fff;
  box-shadow: 0 24px 60px rgba(15,23,42,.28); color: #1f2937;
}
.tk-cancel-dialog h3 { margin: 0 40px 6px 0; font-size: 20px; }
.tk-cancel-dialog p { margin: 0 0 18px; color: #64748b; font-size: 13px; line-height: 1.45; }
.tk-cancel-dialog label { display: block; margin: 12px 0 6px; font-size: 13px; font-weight: 750; }
.tk-cancel-dialog select, .tk-cancel-dialog textarea {
  width: 100%; min-height: 44px; padding: 11px 12px; border: 1px solid #cbd5e1;
  border-radius: 12px; background: #fff; color: #111827; font: 14px/1.4 inherit;
}
.tk-cancel-dialog textarea { resize: vertical; }
.tk-cancel-close {
  float: right; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: #f1f5f9; color: #334155; cursor: pointer;
}
.tk-cancel-payment-note { margin-top: 14px; padding: 11px 12px; border-radius: 12px; background: #f8fafc; color: #475569; font-size: 12px; line-height: 1.45; }
.tk-cancel-error { margin-top: 10px; color: #b91c1c; font-size: 13px; font-weight: 650; }
.tk-cancel-submit {
  width: 100%; min-height: 48px; margin-top: 16px; border: 0; border-radius: 14px;
  background: #dc2626; color: #fff; font: 750 14px/1.2 inherit; cursor: pointer;
}
.tk-cancel-submit:disabled { opacity: .6; cursor: wait; }
@media (min-width: 640px) { .tk-cancel-overlay { align-items: center; } }

.order-cancel-request { display:grid; gap:6px; margin:10px 0; padding:11px; border:1px solid #fdba74; border-radius:12px; background:#fff7ed; color:#7c2d12; }
.order-cancel-request span { font-size:12px; font-weight:700; }
.order-cancel-request small { font-size:11px; line-height:1.4; }
.order-cancel-request-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:4px; }
.order-cancel-request-actions button { min-height:40px; border:1px solid #cbd5e1; border-radius:10px; background:#fff; color:#334155; font:700 11px/1.2 inherit; cursor:pointer; }
.order-cancel-request-actions button.danger { border-color:#dc2626; background:#dc2626; color:#fff; }
.order-cancel-request-actions button:disabled { opacity:.55; cursor:wait; }
.order-card-actions { display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap; }
.btn-cancel-order { border:0;background:transparent;color:#6b7280;font:inherit;font-size:.76rem;font-weight:700;padding:.4rem .55rem;cursor:pointer; }
.btn-cancel-order:hover { color:#b42318;text-decoration:underline; }
.order-card-cancel-reason { margin:.4rem 0 .65rem;padding:.55rem .65rem;border-radius:8px;background:#fef2f2;color:#7f1d1d;font-size:.76rem;line-height:1.4; }

.orders-empty { text-align: center; padding: 2rem 1rem; color: #bbb; font-size: 0.85rem; }
.orders-empty-icon { font-size: 1.8rem; margin-bottom: 0.4rem; }

.orders-filter-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.orders-filter-btn { padding: 0.35rem 0.85rem; border-radius: 99px; border: 1.5px solid #e5e5e5; background: #fff; font-family: inherit; font-size: 0.8rem; font-weight: 600; color: #888; cursor: pointer; transition: all 0.15s; }
.orders-filter-btn.active,
.orders-filter-btn:hover { border-color: #FF3D2E; color: #FF3D2E; background: rgba(255,61,46,0.05); }

.nav-item .orders-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; background: #FF3D2E; color: #fff; font-size: 10px; font-weight: 800; border-radius: 99px; padding: 0 5px; margin-left: auto; animation: badgePop 0.3s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes badgePop { from { transform: scale(0); } to { transform: scale(1); } }

.orders-new-toast { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%) translateY(-80px); background: #1a1a1a; color: #fff; padding: 0.75rem 1.5rem; border-radius: 99px; font-weight: 700; font-size: 0.88rem; z-index: 9999; box-shadow: 0 8px 28px rgba(0,0,0,0.2); transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1); white-space: nowrap; }
.orders-new-toast.show { transform: translateX(-50%) translateY(0); }
