/**
 * NHM Shop - Order Tracking & Order Status Styling
 * Matches Dokani Reference & Responsive Design for all devices
 */

/* Main page container */
.track-page-wrap {
  background-color: #f9fafb;
  min-height: calc(100vh - 200px);
  padding: 40px 16px 80px;
}

.track-page-container {
  max-width: 820px;
  margin: 0 auto;
}

/* ========================================================
   1. SEARCH FORM CARD (Image 2)
   ======================================================== */
.track-form-card {
  max-width: 600px;
  margin: 20px auto 40px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 36px 32px;
}

.track-header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.track-header-icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: #f3f4f6;
  color: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.track-header-icon-circle svg {
  width: 26px;
  height: 26px;
  display: block;
}

.track-header-headings {
  flex: 1;
  min-width: 0;
}

.track-header-title {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px 0;
  line-height: 1.25;
  letter-spacing: -0.3px;
}

.track-header-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
  line-height: 1.4;
}

.track-order-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.track-input-group {
  position: relative;
  width: 100%;
}

.track-order-input {
  width: 100%;
  height: 50px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 15px;
  color: #111827;
  background-color: #ffffff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: inherit;
  box-sizing: border-box;
}

.track-order-input:focus {
  border-color: #111827;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.track-order-input::placeholder {
  text-transform: none;
  letter-spacing: normal;
  color: #9ca3af;
}

.track-form-error {
  padding: 12px 14px;
  background-color: #fef2f2;
  border: 1px solid #fee2e2;
  color: #991b1b;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.45;
  display: flex;
  align-items: center;
  gap: 8px;
}

.track-submit-btn {
  width: 100%;
  height: 48px;
  background-color: #111827;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.track-submit-btn:hover:not(:disabled) {
  background-color: #000000;
}

.track-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Steps footer inside form card */
.track-card-steps {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.track-card-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4b5563;
  font-weight: 500;
  white-space: nowrap;
}

.track-card-step .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: #f3f4f6;
  color: #1f2937;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.track-step-divider {
  flex: 1;
  height: 1px;
  background-color: #e5e7eb;
  margin: 0 10px;
  min-width: 16px;
}

/* ========================================================
   2. TRACKED ORDER DETAILS VIEW (Image 5)
   ======================================================== */
.track-result-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Top celebration / status header */
.track-hero {
  text-align: center;
  padding: 4px 0 16px;
}

.track-badge-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #22c55e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 22px;
  box-shadow: 0 3px 10px rgba(34, 197, 94, 0.2);
}

.track-badge-icon.cancelled {
  background-color: #ef4444;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.2);
}

.track-badge-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.5;
}

.track-hero-title {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 5px;
  letter-spacing: -0.3px;
  line-height: 1.25;
}

.track-hero-sub {
  font-size: 13px;
  color: #4b5563;
  margin: 0 0 4px;
  line-height: 1.4;
}

.track-hero-sub strong {
  color: #111827;
  font-weight: 600;
}

.track-hero-hint {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
  line-height: 1.35;
}

/* Standard Box Card */
.track-box-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.track-box-card.no-padding {
  padding: 0;
  overflow: hidden;
}

.track-box-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.track-box-card.no-padding .track-box-card-header {
  padding: 18px 24px;
  margin-bottom: 0;
  border-bottom: 1px solid #e5e7eb;
}

.track-card-heading {
  font-size: 17.5px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

/* Status Pill */
.track-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  background-color: #111827;
  color: #ffffff;
  text-transform: capitalize;
}

.track-status-pill.status-delivered {
  background-color: #15803d;
  color: #ffffff;
}

.track-status-pill.status-cancelled,
.track-status-pill.status-refunded,
.track-status-pill.status-spam {
  background-color: #dc2626;
  color: #ffffff;
}

.track-status-pill.status-shipped {
  background-color: #0284c7;
  color: #ffffff;
}

.track-status-pill.status-processing {
  background-color: #d97706;
  color: #ffffff;
}

/* Progress Timeline (Desktop Horizontal) */
.track-timeline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  padding: 10px 0;
  margin: 0;
  list-style: none;
}

.track-timeline-step {
  flex: 1 1 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

/* Connecting line to the next step */
.track-timeline-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 15px;
  height: 2px;
  left: calc(50% + 20px);
  right: calc(-50% + 20px);
  background-color: #e5e7eb;
  z-index: 1;
}

.track-timeline-step.line-done:not(:last-child)::after {
  background-color: #22c55e;
}

.track-step-dot {
  position: relative;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  border: 2px solid #d1d5db;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.track-timeline-step.done .track-step-dot {
  background-color: #22c55e;
  border-color: #22c55e;
  color: #ffffff;
}

.track-timeline-step.current .track-step-dot {
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.18);
}

.track-step-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.track-step-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #111827;
}

.track-timeline-step:not(.done) .track-step-title {
  color: #6b7280;
}

.track-step-meta {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.35;
  max-width: 140px;
}

/* Cancelled Alert Box */
.track-cancelled-alert {
  padding: 16px 20px;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Order Summary Items */
.track-items-list {
  display: flex;
  flex-direction: column;
}

.track-item-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid #f3f4f6;
}

.track-item-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background-color: #f9fafb;
  border: 1px solid #f3f4f6;
  object-fit: contain;
  flex-shrink: 0;
  padding: 4px;
}

.track-item-info {
  flex: 1;
  min-width: 0;
}

.track-item-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #111827;
  text-decoration: none;
  display: block;
  margin-bottom: 3px;
  line-height: 1.35;
}

.track-item-title:hover {
  text-decoration: underline;
}

.track-item-details {
  font-size: 12.5px;
  color: #6b7280;
  margin-bottom: 2px;
}

.track-item-qty {
  font-size: 13px;
  color: #4b5563;
}

.track-item-total {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  text-align: right;
}

/* Order Totals Box */
.track-totals-box {
  padding: 18px 24px;
  max-width: 360px;
  margin-left: auto;
  box-sizing: border-box;
}

.track-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 14px;
  color: #4b5563;
}

.track-total-row.discount {
  color: #15803d;
}

.track-total-row.grand-total {
  font-size: 16.5px;
  font-weight: 700;
  color: #111827;
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
  margin-top: 8px;
}

/* 2-Column Info Grid */
.track-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.track-field-group {
  margin-bottom: 14px;
}

.track-field-group:last-child {
  margin-bottom: 0;
}

.track-field-label {
  font-size: 12.5px;
  color: #6b7280;
  margin-bottom: 3px;
  text-transform: capitalize;
}

.track-field-value {
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  word-break: break-word;
  line-height: 1.45;
}

.track-payment-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  margin-left: 8px;
  background-color: #f3f4f6;
  color: #4b5563;
}

.track-payment-badge.paid {
  background-color: #dcfce7;
  color: #15803d;
}

/* Bottom Action Buttons */
.track-actions-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.track-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #111827;
  color: #ffffff;
  padding: 13px 32px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease;
  min-height: 46px;
  border: none;
  cursor: pointer;
  box-sizing: border-box;
}

.track-btn-primary:hover {
  background-color: #000000;
  color: #ffffff;
}

.track-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  color: #111827;
  border: 1px solid #d1d5db;
  padding: 13px 28px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  min-height: 46px;
  cursor: pointer;
  box-sizing: border-box;
}

.track-btn-secondary:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
  color: #111827;
}

/* Order Not Found Box */
.track-not-found-card {
  max-width: 580px;
  margin: 30px auto;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 40px 24px;
  text-align: center;
}

.track-not-found-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #fee2e2;
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
}

/* Checkout Instant Success Modal / Overlay */
.order-instant-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.order-instant-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 36px 28px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalScaleUp {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.order-instant-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: #22c55e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  font-size: 32px;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

.order-instant-title {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px;
}

.order-instant-text {
  font-size: 14.5px;
  color: #4b5563;
  margin: 0 0 18px;
  line-height: 1.5;
}

.order-instant-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6b7280;
}

.order-instant-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top-color: #111827;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========================================================
   RESPONSIVENESS FOR SMALL SCREENS / PHONES (<= 640px)
   ======================================================== */
@media (max-width: 640px) {
  .track-page-wrap {
    padding: 24px 12px 60px;
  }

  .track-form-card {
    padding: 24px 18px;
    margin: 10px auto 30px;
  }

  .track-header-row {
    gap: 12px;
    margin-bottom: 20px;
  }

  .track-header-icon-circle {
    width: 44px;
    height: 44px;
  }

  .track-header-icon-circle svg {
    width: 22px;
    height: 22px;
  }

  .track-header-title {
    font-size: 20px;
  }

  .track-header-subtitle {
    font-size: 13px;
  }

  /* Vertical Timeline on Mobile (Prevents Cramping) */
  .track-timeline {
    flex-direction: column;
    gap: 20px;
    padding: 8px 4px 8px 12px;
  }

  .track-timeline-step {
    flex-direction: row;
    align-items: flex-start;
    text-align: left;
    gap: 14px;
    width: 100%;
  }

  .track-timeline-step:not(:last-child)::after {
    top: 32px;
    bottom: -18px;
    left: 15px;
    right: auto;
    width: 2px;
    height: auto;
  }

  .track-step-dot {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .track-step-text {
    align-items: flex-start;
  }

  .track-step-meta {
    max-width: none;
  }

  /* Single Column Info Grid on Mobile */
  .track-info-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .track-box-card {
    padding: 18px 16px;
  }

  .track-box-card.no-padding .track-box-card-header {
    padding: 14px 16px;
  }

  .track-item-row {
    padding: 14px 16px;
    gap: 12px;
  }

  .track-item-thumb {
    width: 52px;
    height: 52px;
  }

  .track-item-title {
    font-size: 13.5px;
  }

  .track-item-total {
    font-size: 14px;
  }

  .track-totals-box {
    padding: 14px 16px;
    max-width: none;
  }

  .track-actions-row {
    flex-direction: column;
    width: 100%;
  }

  .track-btn-primary,
  .track-btn-secondary {
    width: 100%;
  }
}

/* Very Small Phones (<= 380px) */
@media (max-width: 380px) {
  .track-header-title {
    font-size: 18px;
  }

  .track-hero {
    padding: 2px 0 12px;
  }
  .track-badge-icon {
    width: 42px;
    height: 42px;
    margin-bottom: 10px;
    font-size: 20px;
  }
  .track-badge-icon svg {
    width: 20px;
    height: 20px;
  }
  .track-hero-title {
    font-size: 19px;
  }
  .track-hero-sub {
    font-size: 12.5px;
  }
  .track-hero-hint {
    font-size: 11.5px;
  }

  .track-card-step {
    font-size: 12px;
  }
}

