/* app/assets/stylesheets/locations.css */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

.locations-container {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
}

.locations-header {
  padding: 0.75rem 1rem;
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.locations-header h1 {
  font-size: 1.5rem;
  color: #1a1a1a;
  margin: 0;
  font-weight: 600;
}

.process-locations-btn {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s, transform 0.1s;
}

.process-locations-btn:hover {
  background-color: #43A047;
}

.process-locations-btn:active {
  transform: scale(0.98);
}

.process-locations-btn i {
  font-size: 14px;
}

.process-locations-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.process-locations-btn.loading i {
  animation: spin 1s infinite linear;
}

.confirm-btn.process-btn {
  background-color: #4CAF50;
}

.confirm-btn.process-btn:hover {
  background-color: #43A047;
}

/* Filters container */
.filters-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0;
  width: 100%;
}

.filter-section {
  background: white;
  border-radius: 0;
  padding: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  width: 100%;
}

/* Device and Date sliders */
.device-slider-container,
.date-slider-container {
  width: 100%;
  padding: 0;
}

.device-slider,
.date-slider {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  position: relative;
  width: 100%;
  padding: 0 0.25rem;
}

.slider-arrow {
  background: white;
  border: 1px solid #e2e8f0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4a5568;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
  z-index: 2;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  position: absolute;
}

.slider-arrow i {
  font-size: 0.75rem;
  width: 0.75rem;
  height: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a5568;
}

.slider-arrow:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
  transform: scale(1.05);
}

.slider-arrow:active {
  transform: scale(0.95);
}

#leftArrow, #dateLeftArrow {
  left: 0;
}

#rightArrow, #dateRightArrow {
  right: 0;
}

.device-slider-track,
.date-slider-track {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 0.25rem 1.75rem;
  -ms-overflow-style: none;
  scrollbar-width: none;
  flex: 1;
  width: 100%;
}

.device-slider-track::-webkit-scrollbar,
.date-slider-track::-webkit-scrollbar {
  display: none;
}

.device-chip,
.date-chip {
  padding: 0.375rem 0.75rem;
  background: white;
  border-radius: 4px;
  font-size: 0.875rem;
  color: #4a5568;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.device-chip i,
.date-chip i {
  font-size: 0.875rem;
  color: #718096;
  transition: color 0.15s ease;
}

.device-chip:hover,
.date-chip:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.device-chip.active,
.date-chip.active {
  background: #4299e1;
  color: white;
  border-color: #3182ce;
  box-shadow: 0 2px 4px rgba(66, 153, 225, 0.2);
  transform: translateY(-1px);
}

.device-chip.active i,
.date-chip.active i {
  color: white;
}

/* Add a subtle animation for active state */
@keyframes activePulse {
  0% {
    box-shadow: 0 2px 4px rgba(66, 153, 225, 0.2);
  }
  50% {
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.3);
  }
  100% {
    box-shadow: 0 2px 4px rgba(66, 153, 225, 0.2);
  }
}

.device-chip.active,
.date-chip.active {
  animation: activePulse 2s infinite;
}

/* Main content layout */
.locations-content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0;
  flex: 1;
  height: calc(100vh - 120px);
  min-height: 0;
}

.map-container {
  background-color: #f8fafc;
  height: 100%;
  width: 100%;
  position: relative;
  min-height: 300px;
}

#map {
  height: 100%;
  width: 100%;
  z-index: 1;
}

/* Locations list */
.locations-list {
  background-color: white;
  padding: 0.75rem;
  box-shadow: -1px 0 2px rgba(0, 0, 0, 0.05);
  overflow-y: auto;
  height: 100%;
}

.locations-list h2 {
  font-size: 1.25rem;
  color: #2d3748;
  margin: 0 0 0.75rem 0;
  font-weight: 600;
  position: sticky;
  top: 0;
  background: white;
  padding: 0.25rem 0;
  z-index: 1;
}

/* Trajectory controls */
.trajectory-controls {
  background: white;
  padding: 0.75rem;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  margin-bottom: 0.75rem;
}

.trajectory-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #4a5568;
}

.trajectory-navigation {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
  align-items: center;
}

.trajectory-btn {
  background: white;
  border: 1px solid #e2e8f0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #4a5568;
  transition: all 0.15s ease;
  padding: 0;
  position: relative;
}

.trajectory-slider {
  width: 100%;
  height: 3px;
  -webkit-appearance: none;
  background: #e2e8f0;
  border-radius: 1.5px;
  outline: none;
  margin: 0.375rem 0;
}

/* Location items */
.location-item {
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  transition: all 0.15s ease;
  background: white;
  margin-bottom: 0.5rem;
}

.location-item:last-child {
  margin-bottom: 0;
}

.location-item h3 {
  margin: 0 0 0.5rem 0;
  color: #2d3748;
  font-size: 1rem;
  font-weight: 600;
}

.location-item p {
  margin: 0.125rem 0;
  color: #718096;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* Responsive design */
@media (max-width: 1024px) {
  .locations-content {
    grid-template-columns: 1fr;
    height: auto;
  }

  .map-container {
    height: 400px;
  }

  .locations-list {
    height: auto;
    max-height: 400px;
  }
}

@media (max-width: 640px) {
  .locations-header {
    padding: 0.5rem;
  }

  .locations-header h1 {
    font-size: 1.25rem;
  }

  .device-chip,
  .date-chip {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
  }
}

.device-summary {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.device-summary h3 {
  margin: 0 0 1rem 0;
  color: #2c3e50;
  font-size: 1.25rem;
  font-weight: 600;
}

.device-stats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

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

.stat-label {
  color: #666;
  font-size: 0.9rem;
}

.stat-value {
  color: #2c3e50;
  font-weight: 500;
  font-size: 0.95rem;
}

.device-list {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.device-stat-item {
  background: #f8fafc;
  border-radius: 6px;
  padding: 1rem;
  border: 1px solid #e2e8f0;
}

.device-stat-item h4 {
  margin: 0 0 0.5rem 0;
  color: #2d3748;
  font-size: 1rem;
  font-weight: 600;
}

.device-stat-item p {
  margin: 0.25rem 0;
  color: #4a5568;
  font-size: 0.9rem;
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.date-filter label {
  color: #4a5568;
  font-weight: 500;
  font-size: 0.95rem;
}

.date-select {
  padding: 0.5rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  color: #2d3748;
  font-size: 0.95rem;
  cursor: pointer;
  min-width: 200px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%234a5568' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.date-select:hover {
  border-color: #cbd5e0;
}

.date-select:focus {
  outline: none;
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* Specific button styles */
#playTrajectory i {
  margin-left: 1px;
}

#pauseTrajectory i {
  font-size: 0.75rem;
}

#prevLocation i,
#nextLocation i {
  font-size: 0.75rem;
}

/* Custom map marker styles */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
}

/* Base marker styles */
.marker-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

/* Online marker style - solid dot with white border */
.marker-dot.online {
  border: 2px solid white;
  opacity: 1;
}

/* Offline marker style - different shape (diamond) */
.marker-dot.offline {
  transform: rotate(45deg);
  border-radius: 2px;
  width: 10px;
  height: 10px;
  border: 2px solid white;
  opacity: 0.85;
}

.custom-marker:hover .marker-dot.online {
  transform: scale(1.2);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.custom-marker:hover .marker-dot.offline {
  transform: rotate(45deg) scale(1.2);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* Active marker styles */
.custom-marker.active .marker-dot.online {
  transform: scale(1.3);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.4);
}

.custom-marker.active .marker-dot.offline {
  transform: rotate(45deg) scale(1.3);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.4);
}

/* Pulsing animation for active markers */
@keyframes markerPulse {
  0% {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.2);
  }
  100% {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
  }
}

.custom-marker.active .marker-dot {
  animation: markerPulse 1.5s infinite;
}

/* Offline marker popup style */
.location-popup-content.offline {
  background-color: #f8f9fa;
  border-left: 3px solid #6c757d;
}

.offline-badge {
  display: inline-block;
  background-color: #6c757d;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 5px;
}

/* Confirmation Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.confirmation-dialog {
  background-color: white;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 400px;
  padding: 24px;
  transform: translateY(-20px);
  transition: transform 0.3s;
}

.modal-overlay.active .confirmation-dialog {
  transform: translateY(0);
}

.confirmation-dialog h3 {
  margin-top: 0;
  color: #d32f2f;
  font-size: 1.2rem;
}

.confirmation-dialog p {
  margin-bottom: 20px;
  font-size: 1rem;
  line-height: 1.5;
}

.confirmation-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.confirm-btn, .cancel-btn {
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s;
}

.confirm-btn {
  background-color: #d32f2f;
  color: white;
}

.confirm-btn:hover {
  background-color: #b71c1c;
}

.cancel-btn {
  background-color: #e0e0e0;
  color: #424242;
}

.cancel-btn:hover {
  background-color: #bdbdbd;
}

/* Marker popup delete button */
.location-popup-content {
  padding: 10px;
}

.delete-location-btn {
  margin-top: 10px;
  padding: 5px 10px;
  background-color: #f44336;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.delete-location-btn:hover {
  background-color: #d32f2f;
}

/* Loading animation */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-right: 8px;
}

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

.delete-location-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

/* Notification */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 4px;
  color: white;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 1001;
}

.notification.show {
  transform: translateY(0);
  opacity: 1;
}

.notification.success {
  background-color: #43a047;
}

.notification.error {
  background-color: #e53935;
}

/* Map Legend */
.map-legend {
  position: absolute;
  bottom: 20px;
  right: 10px;
  background: white;
  padding: 10px;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  font-size: 12px;
  max-width: 200px;
}

.map-legend h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.legend-marker {
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.legend-marker.online {
  background-color: #4299e1;
  border: 2px solid white;
}

.legend-marker.offline {
  background-color: #4299e1;
  transform: rotate(45deg);
  border-radius: 2px;
  width: 8px;
  height: 8px;
  border: 2px solid white;
} 
