/* CardLane Component Styles */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Filter Section Styles */
.filter-section {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 3rem;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

.search-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 2rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

/* Grouped filter styles for origin and destination */
.filter-group.location-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.location-main {
  display: flex;
  flex-direction: column;
}

.radius-control {
  display: flex;
  flex-direction: column;
}

.filter-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.75rem;
}

.radius-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.radius-spinner {
  width: 80px;
  padding: 0.5rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.875rem;
  background: white;
  transition: all 0.2s ease;
}

.radius-spinner:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

/* Location Finder Styles */
.location-finder {
  position: relative;
}

.location-input-container {
  position: relative;
}

.location-input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 1rem;
  background: white;
  transition: all 0.2s ease;
}

.location-input:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.clear-button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #6c757d;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
  transition: background-color 0.2s ease;
}

.clear-button:hover {
  background: #e9ecef;
}

/* Location Dropdown */
.location-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ced4da;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}

.location-item {
  padding: 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f8f9fa;
}

.location-item:last-child {
  border-bottom: none;
}

.location-item:hover {
  background-color: #f8f9fa;
}

.location-item.loading-item,
.location-item.no-results {
  cursor: default;
  color: #6c757d;
  text-align: center;
  font-style: italic;
}

.location-item.loading-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.location-details {
  width: 100%;
}

.location-name {
  font-weight: 500;
  color: #2c3e50;
  margin-bottom: 0.25rem;
}

.location-meta {
  font-size: 0.8rem;
  color: #6c757d;
}

.location-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #e9ecef;
  border-top: 2px solid #0d6efd;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Equipment Select */
.equipment-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 1rem;
  background: white;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
  padding-right: 2.5rem;
}

.equipment-select:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

/* Search Button */
.search-button {
  padding: 0.75rem 2rem;
  background: #0d6efd;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 150px;
}

.search-button:hover:not(:disabled) {
  background: #0b5ed7;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.search-button:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
}

/* Loading and No Results States */
.loading-state,
.no-results {
  text-align: center;
  padding: 3rem;
  color: #6c757d;
  font-size: 1.1rem;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  margin-top: 3rem;
  margin-bottom: 2rem;
}

.loading-state {
  background: #e7f3ff;
  color: #0d6efd;
  border-color: #b6d4fe;
}

/* Loads Container */
.loads-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.load-card {
  width: 100%;
  padding: 1.5rem;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.load-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.clickable-load {
  cursor: pointer;
  position: relative;
}

.click-hint {
  font-size: 12px;
  color: #666;
  text-align: center;
  margin-top: 8px;
  font-style: italic;
}

/* Load Header */
.load-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.load-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.load-number {
  font-weight: 700;
  color: #0d6efd;
  font-size: 1rem;
}

.platform {
  font-size: 0.875rem;
  color: #6c757d;
  font-weight: 500;
}

.price-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.price {
  font-size: 1.75rem;
  font-weight: 700;
  color: #28a745;
}

.rate {
  font-size: 0.875rem;
  color: #6c757d;
  font-weight: 500;
}

/* Location Container */
.location-container {
  margin: 1rem 0;
  position: relative;
  padding-left: 0;
}

.location-line {
  display: flex;
  align-items: flex-start;
  position: relative;
  margin-bottom: 0.5rem;
  height: 35px;
}

.location-line:last-child {
  height: auto;
  margin-bottom: 0;
}

.location-container::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 12px;
  width: 2px;
  height: 35px;
  background-color: #333;
  z-index: 1;
}

.marker {
  width: 10px;
  height: 10px;
  margin-right: 12px;
  margin-top: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.marker-circle {
  background-color: #000;
  border-radius: 50%;
}

.marker-square {
  background-color: #000;
}

.location-text {
  flex: 1;
  line-height: 1.3;
}

.location-time {
  font-size: 0.875rem;
  color: #6c757d;
}

.my-2 {
  margin: 0.5rem 0;
  border: none;
  border-top: 1px solid #dee2e6;
}

/* Load Details */
.load-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.detail-row .equipment {
  color: #495057;
  font-weight: 600;
}

.detail-row .weight {
  color: #6c757d;
  font-weight: normal;
}

.detail-row .miles {
  color: #6c757d;
  font-weight: 500;
}

.detail-row .company {
  color: #343a40;
  font-weight: 500;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-row .phone {
  color: #0d6efd;
  font-weight: 500;
  text-decoration: none;
}

.detail-row .phone:hover {
  text-decoration: underline;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: #ffffff;
  background-color: #ffffff !important;
  border-radius: 12px;
  width: 95%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  opacity: 1 !important;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 30px !important;
  border-bottom: 1px solid #eee;
  background-color: #ffffff;
  border-radius: 12px 12px 0 0;
}

.modal-header h2 {
  margin: 0 !important;
  color: #333;
  font-size: 28px;
  font-weight: 600;
}

.close-button {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
  font-weight: bold;
}

.close-button:hover {
  background-color: #f5f5f5;
  color: #333;
}

.modal-body {
  padding: 30px !important;
  background-color: #ffffff;
  border-radius: 0 0 12px 12px;
}

.load-details-section {
  margin-bottom: 30px;
  padding: 25px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f8f9fa !important;
  opacity: 1 !important;
}

.returning-loads-section {
  background-color: #ffffff;
  opacity: 1 !important;
}

.returning-loads-section h3 {
  margin: 0 0 25px 0 !important;
  color: #333;
  font-size: 22px;
  padding-bottom: 10px;
  font-weight: 600;
  background-color: transparent;
  border-bottom: none !important;
}

.returning-loads-container {
  display: grid;
  gap: 16px;
  background-color: transparent;
}

.returning-load-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  background-color: #ffffff !important;
  transition: box-shadow 0.2s ease;
  opacity: 1 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.returning-load-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Time difference header styling */
.time-difference-header {
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.time-difference-badge {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Different colors for different time ranges */
.time-difference-badge.immediate {
  background: linear-gradient(135deg, #28a745, #1e7e34);
}

.time-difference-badge.short-wait {
  background: linear-gradient(135deg, #ffc107, #e0a800);
  color: #333;
}

.time-difference-badge.long-wait {
  background: linear-gradient(135deg, #dc3545, #bd2130);
}

.time-difference-badge.before-delivery {
  background: linear-gradient(135deg, #6f42c1, #5a32a3);
}

/* Ensure all text is visible */
.modal-content * {
  opacity: 1 !important;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .filter-row {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 992px) {
  .filter-row {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
  
  .filter-group:nth-child(3) {
    grid-column: 1 / -1;
    justify-self: start;
    max-width: 300px;
  }
  
  .filter-group.location-group {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: end;
  }
  
  .location-main {
    grid-column: 1;
  }
  
  .radius-control {
    grid-column: 2;
  }
}

@media (max-width: 768px) {
  .filter-section {
    padding: 1.5rem;
  }
  
  .filter-row {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .search-row {
    margin-top: 1.5rem;
  }
  
  .search-button {
    width: 100%;
    padding: 1rem;
  }
  
  .filter-group.location-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .location-main {
    align-self: flex-start;
  }

  .radius-control {
    align-self: flex-start;
  }

  .radius-label {
    justify-content: flex-start;
  }

  .load-card {
    padding: 1.25rem;
  }
  
  /* Keep header horizontal on mobile - similar to desktop */
  .load-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .load-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .load-number {
    font-size: 15px;
    font-weight: 700;
  }
  
  .platform {
    font-size: 13px;
  }
  
  /* Keep price info on the right, stacked vertically */
  .price-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
  }
  
  .price {
    font-size: 22px;
    font-weight: 700;
  }
  
  .rate {
    font-size: 12px;
  }
  
  .detail-row .company {
    max-width: 50%;
  }
  
  /* Modal responsive */
  .modal-overlay {
    padding: 10px;
  }
  
  .modal-content {
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 15px;
  }
  
  .modal-header h2 {
    font-size: 20px;
  }
  
  .modal-body {
    padding: 15px;
  }
  
  .load-details-section {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .load-card {
    padding: 1rem;
  }
  
  .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .detail-row .company {
    max-width: 100%;
  }
}