/* ================================
   Irano Order Tracker — Optimized CSS
   (Compatible with results.php)
   ================================ */

/* Root variables */
:root{
  --primary: #0073aa;
  --primary-600: #0b6aa8;
  --accent: #3b82f6;
  --bg: #f6f8fb;
  --card: #ffffff;
  --muted: #7b8794;
  --text: #1f2937;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow-lg: 0 12px 32px rgba(16,24,40,0.06);
  --shadow-sm: 0 6px 18px rgba(16,24,40,0.04);
  --transition: 0.28s cubic-bezier(.2,.9,.2,1);
}

/* Base */
html, body {
  height:100%;
  margin:0;
  padding:0;
  background:var(--bg);
  color:var(--text);
  direction: rtl;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  line-height:1.45;
}

/* Container */
.tracking-results-container {
  max-width:1100px;
  margin:48px auto;
  background:var(--card);
  padding:36px;
  border-radius:28px;
  box-shadow:var(--shadow-lg);
  box-sizing:border-box;
}

/* Title (if exists) */
.tracking-title {
  font-size:28px;
  font-weight:700;
  text-align:center;
  margin-bottom:22px;
  color:var(--text);
}

/* -------------------------
   Progress / Steps
   ------------------------- */
.progress-bar-container {
  position:relative;
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:8px;
  padding-bottom:36px;
  margin-bottom:32px;
}

/* base track */
.progress-bar-container::before{
  content:"";
  position:absolute;
  bottom: 16px; /* Adjusted for thicker line */
  inset-inline: 5%; /* Add some margin to the line */
  height:10px;
  background:#e9eef4;
  border-radius:5px;
  z-index:1;
}

/* active fill using CSS variable (set inline: --progress-width: 60%) */
.progress-bar-container::after{
  content:"";
  position:absolute;
  bottom: 16px; /* Adjusted for thicker line */
  inset-inline-start: 5%; /* Match the start position */
  height:10px;
  width:var(--progress-width, 0%);
  /* New gradient background for the flowing effect */
  background: linear-gradient( 
    -45deg, 
    var(--primary) 25%, 
    var(--accent) 50%, 
    var(--primary) 75%
  );
  background-size: 200% 200%;
  border-radius:5px;
  z-index:2;
  /* Two animations: one to fill, one to flow continuously */ 
  animation: iot-fill-progress 1.2s cubic-bezier(0.25, 1, 0.5, 1) 0.2s forwards, iot-flow-water 2s linear infinite 1.4s;
}
/* step */
.progress-step{
  position:relative;
  z-index:3;
  flex:1 1 0;
  text-align:center;
  padding:0 6px;
  display: flex; flex-direction: column; align-items: center;
}

/* label */
.step-label{
  display:inline-block;
  font-size:13px;
  color:var(--muted);
  background-color: #f0f4f8;
  border: 1px solid #e2e8f0; 
  padding: 10px 16px;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  white-space:nowrap;
  position: relative;
  z-index: 5; /* Ensure label is above the progress line */
}

/* New styles for step image */
.step-image-wrapper {
  position: relative;
  z-index: 4;
  margin-bottom: 12px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition);
}

.step-image-bg {
  position: absolute;
  inset: 0;
  background-color: #f0f4f8;
  border: 1px solid #e2e8f0; 
  border-radius: 18px; /* "very rounded" corners */
  transition: all var(--transition);
}

.step-image {
  width: 36px;
  height: 36px;
  object-fit: contain;
  position: relative;
  z-index: 2;
  filter: grayscale(100%) opacity(0.6);
  transition: filter var(--transition);
}

/* End of new styles */



/* circle */
.step-icon{
  display: none; /* We don't need the icon anymore */
}

/* active states */
.progress-step.active .step-label,
.progress-step.current .step-label{
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary-600);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(11, 106, 168, 0.15);
}

/* highlight last active step style like badge */
.progress-step.current .step-label{
  box-shadow: 0 8px 20px rgba(11, 106, 168, 0.2);
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  animation: fadeInCurrentStep 0.5s ease-out 0.6s forwards;
}

/* Active state for new image styles */
.progress-step.active .step-image-wrapper,
.progress-step.current .step-image-wrapper {
  transform: translateY(-4px);
}

.progress-step.active .step-image-bg,
.progress-step.current .step-image-bg {
  background-color: var(--primary);
  border-color: var(--primary-600); 
  box-shadow: 0 6px 16px rgba(11, 106, 168, 0.2);
  border-radius: 30%; /* Important for circular glow */
}

.progress-step.current .step-image-bg {
  animation: pulse-glow 2.5s ease-in-out infinite;
}

.progress-step.active .step-image,
.progress-step.current .step-image {
  filter: grayscale(0%) opacity(1) drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
/* -------------------------
   Main layout: two columns
   ------------------------- */
.results-content {
  display:grid;
  grid-template-columns: 1fr 1.4fr;
  gap:34px;
  align-items:start;
}

/* headers within columns */
.results-content h3 {
  margin:0 0 18px 0;
  font-size:16px;
  font-weight:700;
  color:var(--text);
}

/* Left column (order info) */
.order-info-column {
  display:block;
}

/* info list */
.order-info-column ul {
  list-style:none;
  padding: 0;
  margin:0;
  border-radius: var(--radius-lg);
  overflow:hidden;
  box-shadow:var(--shadow-sm);
  background:linear-gradient(180deg, #ffffff, #fbfdff);
  border:1px solid rgba(15,23,42,0.03);
}

/* each row */
.order-info-column li {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 14px 18px;
  font-size:14px;
  border-bottom:1px solid #f2f5f8;
}

.order-info-column li:last-child{ border-bottom:none; }

/* labels & values */
.info-label { color:var(--muted); font-weight:600; }
.info-value { color:var(--text); }

/* tracking code badge (looks like button) */
.tracking-code-badge {
  display: inline-block;
  padding: 0;
  background: none;
  box-shadow: none;
  font-weight:700;
  direction:ltr; /* keep code LTR */
  text-decoration:none;
}

.tracking-code-badge:hover { transform: none; }

/* Custom styles for tracking code row and link */
.order-info-column li.tracking-code-row {
  background-color: #cfd5e1;
}

.tracking-code-badge a {
  color: #5474d7;
  text-decoration: none;
}

/* fallback neutral badge if no code */
.tracking-code-badge.neutral {
  background:#f3f6f8;
  color:var(--muted);
  box-shadow:none;
}

/* Right column (products) */
.order-products-column {
  display:block;
}

/* product card */
.product-card {
  display:flex;
  gap:14px;
  align-items:center;
  background:linear-gradient(180deg,#ffffff,#fbfdff);
  padding:12px;
  border-radius:14px;
  box-shadow:var(--shadow-sm);
  border:1px solid rgba(15,23,42,0.03);
  margin-bottom:14px;
}

/* image wrapper */
.product-image {
  min-width:72px;
  width:72px;
  height:72px;
  border-radius:12px;
  overflow:hidden;
  background:#f3f6f8;
  display:flex;
  align-items:center;
  justify-content:center;
}

.product-image img { width:100%; height:100%; object-fit:cover; display:block; }

/* product details */
.product-details { flex:1 1 auto; min-width:0; }

.product-name {
  font-size:15px;
  font-weight:700;
  margin:0 0 4px 0;
  color:var(--text);
}

.product-meta {
  font-size:13px;
  color:var(--muted);
  margin:0;
  line-height:1.3;
}

/* price area */
.product-price {
  margin-inline-start: 12px;
  font-weight:800;
  font-size:14px;
  color:var(--text);
  white-space:nowrap;
}

/* small helpers */
.small-muted { color:var(--muted); font-size:13px; }

/* Empty state */
.tracking-empty {
  text-align:center;
  padding:46px 12px;
  color:var(--muted);
  background:linear-gradient(180deg,#fff,#fbfdff);
  border-radius:14px;
  box-shadow:var(--shadow-sm);
}

/* Utilities */
.row-gap { margin-bottom:14px; }
.flex { display:flex; gap:12px; align-items:center; }

/* Responsive */
@media (max-width: 980px) {
  .progress-bar-container {
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px 10px; /* Vertical and horizontal gap */
    padding-bottom: 10px;
  }
  .progress-step {
    margin-top: 10px; /* Add vertical margin to prevent overlap when wrapping */
  }
  .tracking-results-container { padding:28px; margin:32px 14px; }
  .results-content { grid-template-columns:1fr; gap:20px; }
}
/* smaller screens */
@media (max-width: 520px) {
  .tracking-results-container { padding:18px; border-radius:14px; }
  .product-image { width:56px; height:56px; min-width:56px; }
  .product-price { font-size:13px; }
  .tracking-title { font-size:20px; }
}

/* Responsive controls for step icons */
.elementor-widget-iot-tracking-form .progress-bar-container.hide-icons-desktop .progress-step .step-image-wrapper { display: none; }

@media (max-width: 1024px) and (min-width: 768px) {
	.elementor-widget-iot-tracking-form .progress-bar-container.hide-icons-tablet .progress-step .step-image-wrapper {
		display: none;
	}
}

@media (max-width: 767px) {
	.elementor-widget-iot-tracking-form .progress-bar-container.hide-icons-mobile .progress-step .step-image-wrapper {
		display: none;
	}
	.progress-bar-container {
		overflow-x: auto; /* Allow horizontal scroll for the bar itself */
		overflow-y: hidden;
		padding-bottom: 50px; /* Space for scrollbar */
		margin-bottom: 20px;
    margin-top: 20px;
	}
	.step-label {
		font-size: 12px;
		padding: 8px 12px;
	}
}

/* Accessibility focus states */
.tracking-code-badge:focus, .tracking-code-badge a:focus {
  outline:3px solid rgba(59,130,246,0.18);
  outline-offset:3px;
  border-radius:12px;
}

@keyframes iot-fill-progress {
  from {
    width: 0%;
  }
  to {
    width: var(--progress-width, 0%);
  }
}

@keyframes iot-flow-water {
  from {
    background-position: 200% 50%;
  }
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 122, 255, 0.5); /* Blue color with opacity */
  }
  70% {
    box-shadow: 0 0 0 12px rgba(74, 122, 255, 0); /* Large, fading halo */
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 122, 255, 0);
  }
}

@keyframes fadeInCurrentStep {
  to {
    opacity: 1;
    transform: translateY(-6px); /* Move up slightly */
  }
}

/* Legacy compatibility: ensure classes used by older CSS still work */
.tracking-results-container .tracking-code-badge,
.tracking-results-container .tracking-code {
  display:inline-block;
}

/* ======================================== */
/* == Simple Order Details Progress Bar  == */
/* ======================================== */
.iot-order-details-simple-progress {
    border: 1px solid #e0e0e2;
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
    background-color: #fff;
}

.iot-order-details-simple-progress .status-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 8px;
}

.iot-order-details-simple-progress .current-status-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #00a049; /* Green color */
}

.iot-order-details-simple-progress .next-status-title {
    font-size: 0.85rem;
    color: #7b8794; /* Muted color */
}

.iot-order-details-simple-progress .progress-line-container {
    width: 100%;
    height: 8px;
    background-color: #e9eef4;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.iot-order-details-simple-progress .progress-line-fg {
    height: 100%;
    background-color: #00a049; /* Green color */
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Order details page title style override */
.woocommerce-order-details .woocommerce-tracking-details__title {
    box-shadow: none;
}

/* اطمینان از اینکه تمام بخش‌های جزئیات سفارش از فونت قالب ارث‌بری می‌کنند */
.woocommerce-tracking-details * {
    font-family: inherit !important;
}


/* Inherit theme font for status titles */
.iot-order-details-simple-progress .current-status-title,
.iot-order-details-simple-progress .next-status-title {
    font-family: inherit;
}

/* Extra info below progress bar */
.iot-order-details-extra-info {
    border: 1px solid #e0e0e2;
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    background-color: #f8f9fa;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.iot-order-details-extra-info .info-item {
    font-size: 0.9rem;
    line-height: 1.5;
}

.iot-order-details-extra-info .info-label {
    color: #7b8794;
    display: block;
    margin-bottom: 4px;
}

.iot-order-details-extra-info .info-value {
    font-weight: 600;
    color: #1f2937;
}

.iot-order-details-extra-info .info-value a {
    text-decoration: none;
    color: #0073aa;
}

/* Ensure Elementor widget inherits theme fonts by default */
.elementor-widget-iot-order-details .iot-order-details-simple-progress *,
.elementor-widget-iot-order-details .iot-order-details-extra-info * {
    font-family: inherit;
}


/* Hide the complex progress bar in order details */
.woocommerce-order-details .iot-order-details-progress {
    display: none;
}

/* Ensure the new simple one is displayed */
.woocommerce-order-details .iot-order-details-simple-progress {
    display: block;
}

/* ============================
   Tracking Form - Final UI
   Matches tracking results design
   ============================ */

.iot-tracking-form-wrapper h1 {
  text-align: center;
  color: #343a46;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 24px;
}

.iot-tracking-form {
  max-width: 700px;
  margin: 60px auto;
  padding: 40px 50px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
  direction: rtl;
  position: relative;
  overflow: hidden;
}

.iot-tracking-form .form-row {
  position: relative;
  z-index: 1;
}

.iot-tracking-form .input-wrapper {
  display: flex;
  align-items: stretch;
  width: 100%;
  background: var(--bg);
  border-radius: var(--radius-md);
  border: 1.5px solid #e5e7eb;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.iot-tracking-form .input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(11, 106, 168, 0.1);
  background: var(--card);
}

.iot-tracking-form input.input-text {
  flex: 1;
  border: none;
  background: transparent;
  padding: 14px 18px;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  text-align: right;
}

.iot-tracking-form input.input-text::placeholder {
  color: var(--muted);
}

.iot-tracking-form button.button {
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  padding: 0 32px;
  cursor: pointer;
  transition: background-color 0.25s ease;
}

.iot-tracking-form button.button:hover {
  background: var(--primary-600);
}

@media (max-width: 600px) {
  .iot-tracking-form {
    padding: 30px 25px;
  }
  .iot-tracking-form .input-wrapper {
    flex-direction: column;
    gap: 10px;
  }
  .iot-tracking-form button.button {
    padding: 14px;
    width: 100%;
  }
}

/* Optional override: if you want left-aligned prices in LTR templates */
.results-content.is-ltr { direction:ltr; }

/* END OF FILE */
