/* DEBUGGING STYLES - TEMPORARY
* {
  outline: 1px dashed rgba(255, 0, 0, 0.5);
}

.navbar, .page-container, table, section, header, footer, main, div {
  outline: 2px solid rgba(0, 0, 255, 0.3);
}
*/

/* Container for consistent page layout */
.page-container {
  width: 100%;
  max-width: none;
  padding: 0 2rem;
  margin: 1rem auto;
  box-sizing: border-box;
}
body {
  font-family: sans-serif;
  margin: 2rem;
  background-color: #f9f9f9;
  color: #333;
}

h1, h2 {
  margin-top: 2rem;
  color: #222;
}

#scan-inputs {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
}

.scan-section {
  display: flex;
  flex-direction: column;
}

input[type="text"] {
  padding: 0.5rem;
  font-size: 1rem;
  width: 250px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th, td {
  padding: 0.75rem;
  border: 1px solid #ccc;
  text-align: left;
}

th {
  background-color: #eee;
}

/* Apply zebra striping only to non-highlighted rows */
tbody tr:not(.has-highlight):nth-child(even) {
  background-color: #f1f1f1;
}

/* Do not wash out highlighted rows on hover */
tbody tr:not(.has-highlight):hover {
  background-color: #e0e0e0;
}

button, .icon-button {
  padding: 0.3rem 0.6rem;
  font-size: 0.9rem;
  border: none;
  background: #d9534f;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

button:hover, .icon-button:hover {
  background: #c9302c;
}

.toast {
  padding: 1rem;
  position: fixed;
  top: 1rem;
  right: 1rem;
  bottom: auto;
  left: auto;
  border-radius: 5px;
  z-index: 1100;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  transition: opacity 0.3s ease;
  opacity: 0;
  font-size: 1rem;
  color: #fff;
  max-width: min(26rem, calc(100vw - 2rem));
  width: max-content;
  box-sizing: border-box;
}

.toast.show {
  opacity: 1;
}

.toast.success {
  background-color: #2ecc71; /* green for starting shift */
}

.toast.error {
  background-color: #e74c3c;
}

.toast.end {
  background-color: #e74c3c; /* red for ending shift */
}
.toast.popup {
  top: 1rem;
  right: 1rem;
  left: auto;
  bottom: auto;
  transform: none;
  font-size: 1.1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: block;
}

@media (max-width: 640px) {
  .toast,
  .toast.popup {
    top: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    max-width: none;
    width: auto;
    font-size: 1rem;
  }
}

nav.navbar {
  margin-bottom: 2rem;
  background-color: #ffffff;
  border-bottom: 1px solid #ccc;
  padding: 0.75rem 2rem;
  width: 100%;
  max-width: 1380px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

nav.navbar ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

nav.navbar li {
  margin: 0;
}

nav.navbar a {
  text-decoration: none;
  color: #333;
  font-weight: bold;
  font-size: 1rem;
}

nav.navbar a:hover {
  color: #007acc;
  text-decoration: underline;
}

nav.navbar button {
  background: #007acc;
  padding: 0.45rem 0.85rem;
}

nav.navbar button:hover {
  background: #005fa3;
}
 
.shift-action-btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: bold;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  height: 38px;
  color: white;
}

.danger-button {
  background-color: #c00;
}

.danger-button:hover {
  background-color: #a00;
}

.auto-end-btn {
  background-color: #007bff;
}

.auto-end-btn:hover {
  background-color: #0056b3;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.modal-content button {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  font-weight: bold;
  border: none;
  background-color: #007acc;
  color: white;
  border-radius: 20px;
  cursor: pointer;
}

.modal-content button:hover {
  background-color: #005fa3;
}

body#index-page {
  min-height: 100vh;
  margin: 0;
  padding: 0 0 3rem;
  box-sizing: border-box;
}

.scan-page-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
  padding-top: 1rem;
}

.center-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  width: 100%;
}

.center-wrapper h1 {
  margin: 0;
}

#datetime-display {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

#datetime-display p {
  margin: 0.25rem 0;
}

#scan-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

#scan-inputs {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.scan-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.scan-section label {
  font-weight: 600;
  text-align: center;
}

.scan-section input[type="text"] {
  font-size: 1.25rem;
  width: 100%;
  padding: 0.75rem;
  text-align: center;
  box-sizing: border-box;
}

#scan-active-lists {
  width: 100%;
  display: grid;
  gap: 1rem;
}

.active-scan-list-panel {
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.active-scan-list-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.active-scan-list {
  margin: 0;
  padding-left: 1.25rem;
}

.active-scan-list li + li {
  margin-top: 0.35rem;
}

.active-scan-empty {
  margin: 0;
  color: #666;
}

@media (max-width: 640px) {
  body#index-page {
    padding-bottom: 2rem;
  }

  .scan-page-layout {
    width: calc(100% - 1rem);
  }

  #datetime-display,
  #scan-inputs {
    max-width: none;
  }
}
/* Align column widths for both tables */
.active-scans-table colgroup col,
.completed-scans-table colgroup col {
  width: auto;
}

.active-scans-table colgroup col:nth-child(1),
.completed-scans-table colgroup col:nth-child(1) {
  width: 12%;
}
.active-scans-table colgroup col:nth-child(2),
.completed-scans-table colgroup col:nth-child(2) {
  width: 12%;
}
.active-scans-table colgroup col:nth-child(3),
.completed-scans-table colgroup col:nth-child(3) {
  width: 16%;
}
.active-scans-table colgroup col:nth-child(4),
.completed-scans-table colgroup col:nth-child(4) {
  width: 12%;
}
.active-scans-table colgroup col:nth-child(5),
.completed-scans-table colgroup col:nth-child(5) {
  width: 9%;
}
.active-scans-table colgroup col:nth-child(6),
.completed-scans-table colgroup col:nth-child(6) {
  width: 11%;
}
.active-scans-table colgroup col:nth-child(7),
.completed-scans-table colgroup col:nth-child(7) {
  width: 9%;
}
.active-scans-table colgroup col:nth-child(8),
.completed-scans-table colgroup col:nth-child(8) {
  width: 10%;
}
.active-scans-table colgroup col:nth-child(9),
.completed-scans-table colgroup col:nth-child(9) {
  width: 10%;
}
/* Password Modal Styles */
#password-modal {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#password-modal .modal-content {
  background-color: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  text-align: center;
  max-width: 400px;
  width: 90%;
  position: relative;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#password-modal label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

#password-modal input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 1rem;
}

#password-modal input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 1rem;
}

#password-error {
  color: #c9302c;
  margin: 0 0 1rem;
}

#password-modal button {
  padding: 0.5rem 1rem;
  font-weight: bold;
  border: none;
  background-color: #007acc;
  color: white;
  border-radius: 20px;
  cursor: pointer;
}

#password-modal button:hover {
  background-color: #005fa3;
}
#password-modal .button-group {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

#password-modal .button-group button {
  flex: 1;
  max-width: 120px;
}

/* Auto-hide navbar styles for index page */
body#index-page nav.navbar.auto-hide {
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  pointer-events: none;
}

body#index-page nav.navbar.auto-hide.show {
  transform: translateY(0);
  pointer-events: auto;
}

/* Flagged rows from auto-ended shifts */
.flagged-row {
  background-color: #cfe2ff !important; /* soft blue for auto-ended shifts */
  /* border-left: 4px solid #6ea8fe;       accent for quick scanning */
}

/* === Row highlighting for completed shifts === */
.tr-bathroom-over-7 { background-color: #f8d7da !important; } /* red-ish */
.tr-work-under-25   { background-color: #fff3cd !important; } /* yellow */
.tr-work-25-50      { background-color: #ffe0b2 !important; } /* orange */
.tr-work-50-plus    { background-color: #d4edda !important; } /* green */

/* OK bathroom rows (<= 7 min) — neutral white by default */
.tr-bathroom-ok,
.tr-bathroom-ok td {
  background-color: #ffffff !important;
}

/* === Auto-end visual override (highest precedence) === */
/* Ensure entire row and cells are soft blue even if other row classes set backgrounds */
tbody tr.flagged-row,
tbody tr.flagged-row td {
  background-color: #cfe2ff !important;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pagination[hidden] {
  display: none;
}

.pagination-button,
.pagination-summary,
.pagination-ellipsis {
  margin: 0;
}

.pagination-button {
  min-width: 2.5rem;
}

.pagination-summary {
  margin-left: 0.5rem;
  white-space: nowrap;
}
