/* ========================================
   ELS Logistics - World Class Tracking UI
   Modern, Sleek & Professional Design
   ======================================== */

:root {
  --primary-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
  --success-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --warning-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  --danger-gradient: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 35px 60px -12px rgba(0, 0, 0, 0.3);
}

/* Enhanced Tracking Section with Glass Morphism */
.tracking-section {
  background: 
  linear-gradient(rgba(30, 48, 109, 0.85), rgba(0, 58, 247, 0.9)),
  url(/assets/img/logistics_c67a1148-f8b0-4d03-b977-7ff3f6665c00.webp);
  color: #fff;
  padding: 4rem 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 50vh;
}

.tracking-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(3, 3, 43, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(46, 12, 240, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(31, 29, 107, 0.2) 0%, transparent 50%);
  animation: float 6s ease-in-out infinite;
}

.tracking-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" opacity="0.1"><path d="M500 50L520 70L480 70Z" fill="white"/><circle cx="200" cy="30" r="8" fill="white"/><circle cx="800" cy="70" r="5" fill="white"/></svg>');
  animation: float 20s infinite linear;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33% { transform: translateY(-10px) rotate(120deg); }
  66% { transform: translateY(10px) rotate(240deg); }
}

.tracking-container {
  max-width: 1000px;
  width: 100%;
  position: relative;
  z-index: 2;
}

.tracking-text h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, #fff 30%, #e0e7ff 70%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.tracking-text p {
  font-size: 1rem;
  margin-bottom: 2rem;
  color: #e0e7ff;
  font-weight: 300;
  line-height: 1.6;
}

/* Enhanced Glass Form with Better Contrast */
.tracking-form .input-group {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  animation: slideInUp 0.8s ease-out 0.4s both;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tracking-form input {
  flex: 1;
  padding: 1.25rem 2rem;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  font-size: 1.1rem;
  outline: none;
  color: white;
  min-width: 350px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-weight: 400;
}

.tracking-form input::placeholder {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 200;
  transition: all 0.3s ease;
}

.tracking-form input:hover::placeholder {
  color: rgba(255, 255, 255, 0.9);
}

.tracking-form input:focus {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 0 3px rgba(255, 255, 255, 0.1);
  outline: none;
}

/* Enhanced Track Button with Better Visibility */
.track-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 1.25rem 2.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 12px 35px rgba(37, 99, 235, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: 0.5px;
  min-width: 180px;
  justify-content: center;
}

.track-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.4), 
    transparent);
  transition: left 0.6s ease;
}

.track-btn:hover::before {
  left: 100%;
}

.track-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 
    0 20px 50px rgba(37, 99, 235, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%);
}

.track-btn:active {
  transform: translateY(-1px) scale(1.02);
  transition: all 0.1s ease;
}

.track-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.track-btn:hover svg {
  transform: scale(1.2) rotate(5deg);
}

/* Enhanced Form Hint Text */
.tracking-hint {
  margin-top: 1.5rem;
  color: #bae6fd;
  font-size: 0.95rem;
  font-weight: 200;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
  animation: fadeIn 1s ease-out 0.6s both;
}

.tracking-hint a {
  color: #ffffff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
  font-weight: 400;
}

.tracking-hint a:hover {
  border-bottom-color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Enhanced Results Container */
.tracking-results {
  background: #ffffff;
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--shadow-xl);
  margin-top: 2rem;
  border: 1px solid #e2e8f0;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tracking-results::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
  border-radius: 20px 20px 0 0;
}

/* Enhanced Header */
.tracking-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #f1f5f9;
}

.tracking-header h2 {
  color: #1e293b;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

/* Enhanced Status Badges - Complete Set */
.status-badge {
  padding: 0.5rem 1.5rem;
  border-radius: 25px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  color: white;
}

/* Completed/Delivered Statuses */
.status-badge.arrived_destination_hub,
.status-badge.delivered { 
  background: var(--success-gradient);
}

/* Active/In Progress Statuses */
.status-badge.out_for_delivery { 
  background: var(--warning-gradient);
}

.status-badge.in_transit,
.status-badge.enroute_origin_hub,
.status-badge.enroute_destination_terminal { 
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
}

/* Initial/Processing Statuses */
.status-badge.pending,
.status-badge.created { 
  background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
}

/* Hub Arrival Statuses */
.status-badge.arrived_origin_hub,
.status-badge.arrived_destination_terminal { 
  background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
}

/* Cancelled Status */
.status-badge.cancelled { 
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

/* Fallback for any undefined status */
.status-badge:not(.pending):not(.created):not(.enroute_origin_hub):not(.arrived_origin_hub):not(.in_transit):not(.arrived_destination_hub):not(.enroute_destination_terminal):not(.arrived_destination_terminal):not(.out_for_delivery):not(.delivered):not(.cancelled) {
  background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
  color: white;
}

/* Enhanced Party Cards */
.party-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.party-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.5rem;
  border: 2px solid #f1f5f9;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.party-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.party-card.sender {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
}

.party-card.receiver {
  border-color: #10b981;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.party-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.party-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.party-card.receiver .party-icon {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.party-title {
  color: #1e293b;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.party-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.party-detail {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.party-name {
  font-size: 1rem;
  color: #1e293b;
  font-weight: 600;
}

.party-address {
  font-size: 0.9rem;
  color: #475569;
  font-weight: 400;
  line-height: 1.5;
}

/* Enhanced Info Card */
.tracking-info-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 2px solid #f1f5f9;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.tracking-info-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 4px 0 0 4px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.info-item label {
  font-weight: 600;
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item span {
  color: #1e293b;
  font-size: 0.95rem;
  font-weight: 500;
}

.tracking-number {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: #1e40af;
  font-size: 0.95rem;
  background: rgba(30, 64, 175, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  display: inline-block;
  border: 1px solid rgba(30, 64, 175, 0.2);
}

.delivery-date {
  color: #059669;
  font-weight: 600;
  font-size: 0.95rem;
  background: rgba(5, 150, 105, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  display: inline-block;
  border: 1px solid rgba(5, 150, 105, 0.2);
}

/* Enhanced Delivery Journey */
.delivery-journey {
  margin-bottom: 2rem;
}

.delivery-journey h4 {
  color: #1e293b;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.journey-track {
  position: relative;
  padding: 2rem 0;
}

.journey-track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 40px;
  right: 40px;
  height: 3px;
  background: linear-gradient(90deg, 
    #10b981 0%, 
    #3b82f6 25%, 
    #f59e0b 50%, 
    #8b5cf6 75%, 
    #ef4444 100%);
  border-radius: 3px;
  transform: translateY(-50%);
  z-index: 1;
}

.journey-milestones {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}

.milestone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  flex: 1;
  transition: all 0.3s ease;
}

.milestone-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: white;
  border: 3px solid #e2e8f0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  z-index: 3;
  color: #64748b; /* Ensure icons are visible */
}

.milestone.completed .milestone-icon {
  background: #10b981;
  border-color: #10b981;
  color: white;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.milestone.current .milestone-icon {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  animation: pulse 2s infinite;
}

.milestone.pending .milestone-icon {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #94a3b8;
}

@keyframes pulse {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  }
  50% { 
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
  }
}

/* Status-specific icons with proper visibility */
.milestone[data-status="pending"] .milestone-icon::before { content: '⏳'; }
.milestone[data-status="created"] .milestone-icon::before { content: '📝'; }
.milestone[data-status="enroute_origin_hub"] .milestone-icon::before { content: '🚛'; }
.milestone[data-status="arrived_origin_hub"] .milestone-icon::before { content: '🏢'; }
.milestone[data-status="in_transit"] .milestone-icon::before { content: '✈️'; }
.milestone[data-status="arrived_destination_hub"] .milestone-icon::before { content: '🏢'; }
.milestone[data-status="enroute_destination_terminal"] .milestone-icon::before { content: '🚚'; }
.milestone[data-status="arrived_destination_terminal"] .milestone-icon::before { content: '📦'; }
.milestone[data-status="out_for_delivery"] .milestone-icon::before { content: '🛵'; }
.milestone[data-status="delivered"] .milestone-icon::before { content: '✅'; }
.milestone[data-status="cancelled"] .milestone-icon::before { content: '❌'; }

.milestone-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-align: center;
  line-height: 1.2;
  max-width: 80px;
  transition: all 0.3s ease;
}

.milestone.completed .milestone-label {
  color: #10b981;
  font-weight: 700;
}

.milestone.current .milestone-label {
  color: #3b82f6;
  font-weight: 700;
}

.milestone-time {
  font-size: 0.7rem;
  color: #94a3b8;
  text-align: center;
  margin-top: -0.25rem;
  font-weight: 500;
}

/* Enhanced Compact History */
.compact-history {
  margin-top: 2rem;
}

.compact-history h5 {
  color: #475569;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-items {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.history-items::-webkit-scrollbar {
  width: 4px;
}

.history-items::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 2px;
}

.history-items::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.compact-history-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 12px;
  transition: all 0.2s ease;
  margin-bottom: 0.75rem;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border-left: 3px solid #3b82f6;
}

.compact-history-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.compact-history-item.completed {
  border-left-color: #10b981;
}

.compact-history-item.current {
  border-left-color: #3b82f6;
  background: #eff6ff;
}

.history-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  margin-top: 0.5rem;
  flex-shrink: 0;
}

.compact-history-item.completed .history-bullet {
  background: #10b981;
}

.history-content {
  flex: 1;
}

.history-status {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: #64748b;
}

.history-location {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.history-time {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Enhanced Actions */
.tracking-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-outline {
  background: transparent;
  color: #1e40af;
  border: 2px solid #1e40af;
}

.btn-outline:hover {
  background: #1e40af;
  color: white;
  transform: translateY(-2px);
}

.btn-secondary {
  background: #475569;
  color: white;
  border: 2px solid #475569;
}

.btn-secondary:hover {
  background: #374151;
  transform: translateY(-2px);
}

/* Enhanced Loading State */
.loader {
  width: 40px;
  height: 40px;
  margin: 2rem auto;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .tracking-text h2 {
    font-size: 2rem;
  }
  
  .party-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .journey-track::before {
    left: 30px;
    right: 30px;
  }
}

@media (max-width: 768px) {
  .tracking-section {
    padding: 3rem 1rem;
    min-height: 40vh;
  }
  
  .tracking-text h2 {
    font-size: 1.75rem;
  }
  
  .tracking-text p {
    font-size: 1rem;
  }
  
  .tracking-form .input-group {
    flex-direction: column;
  }
  
  .tracking-form input {
    min-width: auto;
    width: 100%;
  }
  
  .tracking-results {
    padding: 1.5rem;
    margin: 1rem;
    border-radius: 16px;
  }
  
  .tracking-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  .journey-track::before {
    display: none;
  }
  
  .journey-milestones {
    flex-wrap: wrap;
    gap: 1.5rem;
  }
  
  .milestone {
    flex: 0 0 calc(50% - 0.75rem);
  }
  
  .tracking-actions {
    flex-direction: column;
  }
  
  .btn {
    min-width: auto;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .tracking-text h2 {
    font-size: 1.5rem;
  }
  
  .tracking-results {
    padding: 1.25rem;
  }
  
  .milestone {
    flex: 0 0 100%;
  }
  
  .milestone-icon {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }
  
  .milestone-label {
    font-size: 0.7rem;
  }
}

/* Print Styles */
@media print {
  .tracking-section {
    background: white !important;
    color: black !important;
    padding: 1rem 0 !important;
    min-height: auto;
  }
  
  .tracking-form,
  .tracking-actions {
    display: none !important;
  }
  
  .tracking-results {
    box-shadow: none !important;
    border: 1px solid #000 !important;
    background: white !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .tracking-results {
    background: #1f2937;
    color: #f9fafb;
  }
  
  .tracking-header h2,
  .info-item span,
  .party-title,
  .party-name,
  .history-status {
    color: #f9fafb;
  }
  
  .tracking-info-card,
  .party-card,
  .compact-history-item {
    background: #374151;
    border-color: #4b5563;
  }
  
  .party-card:hover,
  .compact-history-item:hover {
    background: #4b5563;
  }
  
  .milestone-icon {
    color: #d1d5db;
  }
}