/* public/fleet/fleet-trips.css */

.ft-container {
  padding: 1rem 0;
}

.ft-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.ft-header h2 {
  margin: 0;
  color: #e2e8f0;
  font-size: 1.4rem;
}
.ft-btn-dashboard {
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.9rem;
}
.ft-btn-dashboard:hover {
  background: #475569;
}

/* Filter bar */
.ft-filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.ft-filter-bar select,
.ft-filter-bar input[type="date"] {
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.9rem;
}
.ft-btn-apply {
  background: #f39c12;
  color: #0f172a;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.2rem;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.9rem;
}
.ft-btn-apply:hover {
  background: #e67e22;
}

/* Card list */
.ft-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ft-card {
  background: #1e293b;
  border-radius: 10px;
  padding: 1rem;
  border-left: 4px solid #f39c12;
  transition: background 0.15s;
}
.ft-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.ft-card-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  color: #cbd5e1;
  font-size: 0.95rem;
  flex: 1;
}
.ft-driver {
  font-weight: 600;
  color: #f39c12;
}
.ft-vehicle {
  font-weight: 600;
  color: #e2e8f0;
}
.ft-status {
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}
.ft-status-active {
  background: #166534;
  color: #86efac;
}
.ft-status-completed {
  background: #1e3a8a;
  color: #93c5fd;
}
.ft-status-cancelled {
  background: #7f1d1d;
  color: #fca5a5;
}
.ft-time, .ft-distance, .ft-duration {
  color: #94a3b8;
  font-size: 0.85rem;
}
.ft-card-arrow {
  color: #f39c12;
  font-size: 1.2rem;
  margin-left: 1rem;
}

/* Expanded details */
.ft-card-details {
  margin-top: 1rem;
  border-top: 1px solid #334155;
  padding-top: 1rem;
}
.ft-maps {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.ft-map {
  flex: 1;
  min-width: 250px;
}
.ft-map img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #475569;
}
.ft-map strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #94a3b8;
}
.ft-no-gps {
  color: #94a3b8;
  font-style: italic;
  padding: 1rem 0;
}
.ft-route {
  margin-top: 1rem;
  color: #64748b;
  font-size: 0.8rem;
  word-break: break-all;
}

/* Load More button */
.ft-btn-load-more {
  display: block;
  width: 100%;
  margin-top: 1rem;
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 0.7rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
}
.ft-btn-load-more:hover {
  background: #475569;
}

/* Empty state */
.ft-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
  font-size: 1rem;
}

/* Toast messages */
.ft-toast {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  animation: ft-slide-in 0.2s ease;
}
.ft-toast-error {
  background: #7f1d1d;
  color: #fca5a5;
  border: 1px solid #ef4444;
}
.ft-toast-success {
  background: #14532d;
  color: #86efac;
  border: 1px solid #22c55e;
}
@keyframes ft-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Make the date‑picker icon visible (gold on dark) */
.ft-filter-bar input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) hue-rotate(180deg);   /* changes black icon to light/gold */
  cursor: pointer;
}

/* Apply button loading state */
.ft-btn-apply:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.ft-btn-apply .ft-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(15, 23, 42, 0.3);
  border-top-color: #0f172a;
  border-radius: 50%;
  animation: ft-spin 0.6s linear infinite;
  margin-right: 0.4em;
  vertical-align: middle;
}
@keyframes ft-spin {
  to { transform: rotate(360deg); }
}

/* Speed limit inline row */
.ft-speed-limit-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.ft-speed-limit-row label {
  color: var(--text-muted, #94a3b8);
  font-size: 0.85rem;
  white-space: nowrap;
}
.ft-speed-limit-input {
  width: 70px;
  padding: 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border, #334155);
  background: var(--bg-primary, #0f172a);
  color: var(--text-primary, #e2e8f0);
  font-size: 0.9rem;
  text-align: center;
}
.ft-speed-limit-input:focus {
  outline: none;
  border-color: var(--accent, #f39c12);
}

/* ── Detail columns (map + timeline) ──────────────────── */
.ft-detail-columns {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.ft-detail-columns .ft-map-container {
  flex: 2;
  min-width: 280px;
  min-height: 350px;
}


.ft-detail-columns .ft-timeline-container {
  flex: 1;
  min-width: 200px;
  max-height: 350px;
  overflow-y: auto;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.98) 100%),
    repeating-linear-gradient(
      45deg,
      transparent 0px,
      transparent 10px,
      rgba(243, 156, 18, 0.06) 10px,
      rgba(243, 156, 18, 0.06) 11px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent 0px,
      transparent 10px,
      rgba(34, 197, 94, 0.04) 10px,
      rgba(34, 197, 94, 0.04) 11px
    );
  border-radius: 8px;
  padding: 0.8rem;
  border: 1px solid var(--border, #334155);
  position: relative;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Subtle map‑pin watermark in the centre */
.ft-timeline-container::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f39c12'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5S10.62 6.5 12 6.5s2.5 1.12 2.5 2.5S13.38 11.5 12 11.5z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}


/* Loading / empty messages */
.ft-timeline-loading,
.ft-timeline-empty {
  color: var(--text-muted, #94a3b8);
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* Timeline vertical line */
.ft-timeline {
  position: relative;
  margin-left: 14px;
  border-left: 2px solid var(--border, #334155);
  padding-left: 1.2rem;
}

/* Single event */
.ft-timeline-event {
  margin-bottom: 1.2rem;
  position: relative;
}

/* Coloured dot on the timeline */
.ft-timeline-event::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent, #f39c12);
  border: 2px solid var(--bg-secondary, #1e293b);
}

/* Dot colours per event type */
.ft-timeline-event.speed_violation::before { background: #ef4444; }
.ft-timeline-event.idle_start::before,
.ft-timeline-event.idle_end::before { background: #f59e0b; }
.ft-timeline-event.trip_start::before,
.ft-timeline-event.trip_end::before { background: #22c55e; }

.ft-event-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: #f39c12;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}

.ft-event-description {
  font-size: 0.92rem;
  font-weight: 500;
  color: #e2e8f0;
  line-height: 1.4;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.ft-timeline-event:hover {
  background: rgba(243, 156, 18, 0.05);
  border-radius: 4px;
  padding-left: 4px;
  margin-left: -4px;
  transition: background 0.15s;
}

/* Stale location badge */
.ft-stale-badge {
  display: inline-block;
  background: #f59e0b;        /* amber / orange */
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  margin-left: 0.4rem;
  white-space: nowrap;
}

/* Replay controls */
.ft-replay-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.ft-replay-progress {
  flex: 1;
  height: 6px;
  background: var(--border, #334155);
  border-radius: 3px;
  overflow: hidden;
}

.ft-replay-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent, #f39c12);
  transition: width 0.2s linear;
}

.ft-btn-replay {
  background: var(--accent, #f39c12);
  color: #0f172a;
  border: none;
  border-radius: 4px;
  padding: 0.3rem 0.8rem;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.ft-btn-replay:hover {
  background: var(--accent-hover, #e67e22);
}

/* Live Map full‑screen container */
.ft-live-map-container {
  display: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  min-height: 500px;
  background: #0f172a;
  z-index: 100;
  border-radius: 8px;
  overflow: hidden;
}

.ft-btn-live {
  background: #22c55e;
  color: #0f172a;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.2rem;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.9rem;
}

.ft-btn-live.active {
  background: #ef4444;
  color: white;
}

.ft-btn-delete-trip {
  background: #7f1d1d;
  color: #fca5a5;
  border: none;
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.5rem;
  vertical-align: middle;
}
.ft-btn-delete-trip:hover {
  background: #991b1b;
}

/* Delete confirmation overlay (same as subscription modal but self‑contained) */
#ft-delete-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.7);
  z-index: 5000;
  
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#ft-delete-overlay.open {
  opacity: 1;
  pointer-events: auto;
  display: flex; 
}
#ft-delete-overlay .fsub-modal {
  background: var(--bg-secondary, #1e293b);
  border: 1px solid var(--border, #475569);
  border-radius: 12px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  color: var(--text-primary, #e2e8f0);
  text-align: center;
}

/* Mini‑cards row */
.ft-mini-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.ft-mini-card {
  background: var(--bg-secondary, #1e293b);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
  border: 1px solid var(--border, #334155);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.ft-mini-icon {
  color: var(--accent, #f39c12);
  margin-bottom: 0.2rem;
}

.ft-mini-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
}

.ft-mini-label {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Car marker container – transparent, no border */
.ft-pulsing-marker {
  background: transparent !important;
  border: none !important;
}

/* Car icon itself – centred inside the marker */
.ft-car-marker {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pulsing ring behind the car */
.ft-pulse-ring {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid #d97706;
  animation: ft-pulse-ring 1.5s ease-out infinite;
  opacity: 0;
}

@keyframes ft-pulse-ring {
  0% {
    transform: scale(0.8);
    opacity: 0.7;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}