/* tracking_details.css - Tracking Details Overlay Styling */

/* Overlay backdrop */
.tracking-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tracking-overlay.show {
  opacity: 1;
}

/* Overlay content box */
.tracking-overlay-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 4px;
  padding: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: fit-content;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  cursor: move;
}

/* Overlay title - left aligned */
.tracking-overlay-title {
  font-size: 16px;
  font-weight: bold;
  color: #495057;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #dee2e6;
  text-align: left;
}

/* Close button at bottom right */
.tracking-overlay-close {
  display: block;
  margin: 15px 0 0 auto;
  padding: 8px 20px;
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  width: fit-content;
}

.tracking-overlay-close:hover {
  background-color: #c82333;
}

/* Tracking details table */
.tracking-details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

.tracking-details-table th,
.tracking-details-table td {
  border: 1px solid #ced4da;
  padding: 8px;
  vertical-align: middle;
  white-space: nowrap;
}

.tracking-details-table th {
  background-color: #dee2e6;
  font-weight: bold;
}

.tracking-details-table tbody tr:nth-child(even) {
  background-color: #f1f3f5;
}

.tracking-details-table tbody tr:hover {
  background-color: #e2e6ea;
  transition: background-color 0.15s ease;
}

/* Column specific styling */
.tracking-details-table th:nth-child(1),
.tracking-details-table td:nth-child(1) {
  /* Time */
  text-align: center;
  font-family: 'Courier New', monospace;
}

.tracking-details-table th:nth-child(2),
.tracking-details-table td:nth-child(2) {
  /* Location */
  text-align: left;
  padding-left: 10px;
}

.tracking-details-table th:nth-child(3),
.tracking-details-table td:nth-child(3) {
  /* Device */
  text-align: left;
  padding-left: 10px;
}

.tracking-details-table th:nth-child(4),
.tracking-details-table td:nth-child(4) {
  /* Info (Temperature or Source) */
  text-align: center;
}

/* Responsive design */
@media (max-width: 768px) {
  /* Full-screen sheet on mobile. The desktop variant uses
     `position: absolute; transform: translate(-50%, -50%)` to centre the
     content; that has to be overridden so the box can fill the viewport.
     Title and close button stick at the top and bottom respectively;
     the data table scrolls between them. The whole-content `cursor: move`
     hint is also stripped — drag is mouse-only and a no-op on touch. */
  .tracking-overlay {
    padding: 0;
  }

  .tracking-overlay-content {
    position: fixed;
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    border: none;
    border-radius: 0;
    padding: 0;
    cursor: default;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .tracking-overlay-title {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0;
    padding: 12px 15px;
    background: #fff;
    flex-shrink: 0;
  }

  /* The data table is the scrollable middle. Wrapping the table in a
     scroll region requires no DOM change because the table is the only
     non-sticky child between the title and the close button. Font size
     matches the daily-stats table (13 px on mobile) — the overlay is
     full-screen on phones, so there's no reason to shrink the type. */
  .tracking-details-table {
    font-size: 13px;
    flex: 1;
    min-height: 0;
    display: block;
    overflow: auto;
    margin: 0 15px;
  }

  .tracking-details-table th,
  .tracking-details-table td {
    padding: 6px;
  }

  .tracking-overlay-close {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin: 0;
    width: 100%;
    border-radius: 0;
    min-height: 44px;
    flex-shrink: 0;
  }
}