.done {
  background-color: lightgreen;  /* Xe đã trả về, màu xanh */
}

.overdue {
  background-color: lightcoral;  /* Xe hết thời gian, màu đỏ */
}

.countdown {
  font-weight: bold;
  color: red;
}

.old-car-code {
  font-size: 0.3em !important;
  color: #6ec1ff !important;
  margin-right: 4px;
}
  
.duplicate-done {
  animation: none !important;
  background-color: #fff8b0 !important;
}
@keyframes blink-yellow {
  from { background-color: #fff8b0; }
  to { background-color: #ffe066; }
}

/* Xe vừa bị trùng vừa hết thời gian - nhấp nháy giữa vàng và đỏ */
.duplicate-overdue {
  background-color: #fff8b0 !important;
  animation: none !important;
}

@keyframes blink-yellow-red {
  0% { 
    background-color: #fff8b0 !important; 
  }
  100% { 
    background-color: #ff7f7f !important; 
  }
}

/* Test class để kiểm tra animation hoạt động */
.test-blink {
  background-color: #fff8b0 !important;
  animation: test-blink 1s infinite alternate !important;
}

@keyframes test-blink {
  0% { 
    background-color: #fff8b0 !important; 
  }
  100% { 
    background-color: #ff7f7f !important; 
  }
}

.null-time-done {
  background-color: #455A64 !important;/* #2196f3 */
  color: #fff;
}

.old-car-row .old-car-code-italic, .old-car-code-italic {
  font-style: italic;
  color: #90a4ae;
  font-size: 0.8em;
}
.old-car-row td {
  background: #f8f9fa;
  border: none !important;
  padding-top: 0;
  padding-bottom: 0;
}

#car-list .btn {
  margin: 2px;
}

/* Styling cho nút Đổi khi nằm cùng hàng với nút R/C */
#car-list td:nth-child(2) .btn {
  margin: 1px;
  font-size: 0.85em;
  padding: 4px 8px;
}

/* Compact status column */
#car-list td:nth-child(2) {
  width: 70px;
  padding: 4px 6px;
  line-height: 1.1;
  text-align: center;
}
#car-list td:nth-child(2) .btn-status {
  min-width: 2.2em;
  font-size: 0.9em;
  padding: 0.25em 0.5em;
  margin: 0;
  display: block;
  width: 100%;
}
#car-list td:nth-child(2) .car-note {
  margin: 1px 0 0 0;
  font-size: 0.7em;
  text-align: center;
}

/* Styling cho cột thời gian - giảm kích thước font */
#car-list td:nth-child(4) {
  font-size: 0.9em;
}

#car-list td:nth-child(4) span {
  font-size: 0.85em;
}

#car-list .old-car-code-italic {
  font-size: 0.7em !important;
  font-style: italic !important;
  color: #90a4ae !important;
  display: block;
  margin-top: 4px;
}

/* Row selected - red outline */
#car-list tr.row-selected td {
  background-color: transparent !important;
  box-shadow: none !important;
  border-top: 2px solid #000 !important;
  border-bottom: 2px solid #000 !important;
}
#car-list tr.row-selected td:first-child {
  border-left: 2px solid #000 !important;
}
#car-list tr.row-selected td:last-child {
  border-right: 2px solid #000 !important;
}
#car-list tr.row-selected td:first-child::before {
  content: none !important; /* remove previous blue strip */
}
/* Con trỏ khi ở chế độ chọn dòng */
#car-list.select-mode tbody tr td {
  cursor: pointer;
}

#car-list input[type="checkbox"] {
  width: 1.5em;
  height: 1.5em;
  accent-color: #2196f3;
}

#car-list tr.overdue-unpaid td {
  background-color: #ffe066 !important;
}

.car-note {
  font-size: 0.9em;
  color: #888;
  font-style: italic;
  margin-left: 6px;
  display: block;
  margin-top: 4px;
}

/* Button hiển thị mã xe để mở đổi xe */
.car-code-btn {
  font-weight: bold;
  min-width: 3.2em;
  padding: 2px 8px;
  line-height: 1.2;
  border-width: 2px;
}
.car-code-btn.no-border {
  border-color: transparent !important;
}
.car-code-btn.grouped { border-style: solid; }

#bottomBar {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100vw;
  background: #fff;
  border-top: 1px solid #ddd;
  z-index: 9999;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
body {
  padding-bottom: 80px; /* Để không bị che bảng bởi thanh dưới */
}

.btn-status {
  min-width: 2.5em;
  font-weight: bold;
  font-size: 1.1em;
  padding: 0.3em 1em;
  transition: background-color 0.25s, color 0.25s, transform 0.1s;
}

.btn-status.btn-sm {
  min-width: 2em;
  font-size: 0.9em;
  padding: 0.2em 0.6em;
}

.btn-status:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08) inset;
  opacity: 0.85;
}

/* CSS cho nút Back */
#backBtn {
  font-weight: bold;
  transition: all 0.2s ease;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
}

#backBtn:hover {
  transform: translateX(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#backBtn:active {
  transform: translateX(0);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Toast container */
#toastContainer {
  margin-top: 20px;
}

/* Car Menu Editor Styles */
#carMenuEditorContainer {
  max-height: 70vh;
  overflow-y: auto;
}

#carMenuEditorContainer .card {
  border: 1px solid #dee2e6;
  margin-bottom: 1rem;
}

#carMenuEditorContainer .card-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

#carMenuEditorContainer .car-list {
  max-height: 200px;
  overflow-y: auto;
}

/* New editor drag UI */
#carMenuEditorContainer .dragging {
  opacity: 0.6;
}
.trash-bin {
  border: 2px dashed #dc3545;
  color: #dc3545;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 600;
}
.trash-bin.active {
  background: rgba(220,53,69,0.08);
}
.drop-placeholder {
  display: inline-block;
  width: 52px;
  height: 32px;
  border: 2px dashed #0d6efd;
  border-radius: 6px;
  vertical-align: middle;
}

#carMenuEditorContainer .btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

#carMenuEditorContainer input[type="text"] {
  font-size: 0.875rem;
}

#carMenuEditorContainer .form-control-sm {
  height: calc(1.5em + 0.5rem + 2px);
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: 0.2rem;
}

/* Multiple Car Selection Styles */
#multipleCarSelectionContainer {
  max-height: 70vh;
  overflow-y: auto;
}

#multipleCarSelectionContainer .btn {
  margin: 2px !important;
  padding: 8px 12px;
  min-width: 60px;
  transition: all 0.2s ease;
}

#multipleCarSelectionContainer .btn:hover {
  transform: scale(1.05);
}

#selectedCount {
  font-weight: bold;
  color: #0d6efd;
}

/* Black outline for selected cars in multi-select modal */
#multipleCarSelectionContainer button[data-car-code].selected {
  box-shadow: 0 0 0 2px #000 !important; /* visual black border without layout shift */
}

/* Multi-select modal responsive adjustments to avoid bottomBar overlap */
@media (max-width: 768px) {
  #selectMultipleModal .modal-dialog {
    margin: 10px;
    margin-bottom: 80px; /* create space above bottomBar */
    max-height: calc(100vh - 90px); /* keep within viewport minus bottom bar */
  }
  #selectMultipleModal .modal-content {
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }
  #selectMultipleModal .modal-footer {
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px;
  }
  #selectMultipleModal .modal-footer .btn {
    flex: 1;
    min-width: calc(50% - 5px);
    margin: 2px 0;
    font-size: 0.85rem;
    padding: 6px 8px;
  }
}

@media (max-width: 480px) {
  #selectMultipleModal .modal-dialog {
    margin: 5px;
    margin-bottom: 70px; /* extra space for smaller screens */
    max-height: calc(100vh - 80px);
  }
  #selectMultipleModal .modal-content {
    max-height: calc(100vh - 90px);
  }
  #selectMultipleModal .modal-footer .btn {
    font-size: 0.8rem;
    padding: 5px 6px;
  }
}

/* Responsive adjustments for multiple car selection */
@media (min-width: 768px) {
  #multipleCarSelectionContainer .btn {
    min-width: 70px;
    padding: 10px 15px;
  }
}

/* Selection bar responsive adjustments */
#selectionBar {
  padding: 8px 12px !important;
  bottom: 0 !important;
  height: 60px;
  z-index: 10002 !important;
  background: #fff;
}

#selectionBar .d-flex {
  flex-wrap: wrap;
  gap: 4px;
}

#selectionBar .btn {
  font-size: 0.9rem;
  padding: 6px 10px;
  white-space: nowrap;
  margin: 1px;
  min-width: auto;
}

/* Mobile dropdown optimization */
#selectionBar .dropdown-menu {
  min-width: 180px;
  font-size: 0.9rem;
}

#selectionBar .dropdown-item {
  padding: 8px 12px;
  font-size: 0.85rem;
}

#selectionBar .dropdown-item i {
  width: 16px;
  margin-right: 8px;
}

@media (max-width: 768px) {
  #selectionBar {
    padding: 6px 10px !important;
    bottom: 55px !important;
  }
  
  #selectionBar .container {
    padding: 0 !important;
  }
  
  #selectionBar .d-flex {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 8px;
  }
  
  #selectionBar .btn {
    font-size: 0.8rem;
    padding: 4px 8px;
    margin: 1px;
    min-width: auto;
    flex: 0 0 auto;
  }
  
  #selectionBar .btn i {
    font-size: 0.8rem;
  }
  
  /* Giảm kích thước text */
  #selectionBar span {
    font-size: 0.9rem;
  }
  
  /* Mobile: chỉ hiển thị 4 nút chính */
  #selectionBar .d-md-none {
    gap: 4px;
  }
  
  #selectionBar .d-md-none .btn {
    padding: 6px 8px;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  #selectionBar {
    padding: 4px 8px !important;
    bottom: 50px !important;
  }
  
  #selectionBar .btn {
    font-size: 0.75rem;
    padding: 3px 6px;
    margin: 1px;
  }
  
  #selectionBar .btn i {
    font-size: 0.7rem;
  }
  
  /* Mobile nhỏ: tối ưu dropdown */
  #selectionBar .dropdown-menu {
    min-width: 160px;
    font-size: 0.8rem;
  }
  
  #selectionBar .dropdown-item {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  
  /* Text đã được ẩn bằng Bootstrap class d-none d-md-inline */
}

/* Multiple select modal floating bottom bar - overlay current bottom bar */
#multiSelectBottomBar {
  height: 60px;
  z-index: 10002 !important;
  background: #fff;
}
#multiSelectBottomBar .container {
  height: 100%;
}
#multiSelectBottomBar .btn {
  font-size: 0.95rem;
  padding: 8px 14px;
}

@media (max-width: 768px) {
  #multiSelectBottomBar {
    height: 58px;
  }
  #multiSelectBottomBar .btn {
    font-size: 0.9rem;
    padding: 8px 12px;
  }
}

@media (max-width: 480px) {
  #multiSelectBottomBar {
    height: 56px;
  }
  #multiSelectBottomBar .btn {
    font-size: 0.9rem;
    padding: 8px 12px;
  }
}

/* Red overlay border for selected rows */
#car-list tbody tr.row-selected {
  position: relative;
}

/* Animation dòng đang được move lên/xuống */
.car-row-moved {
  animation: rowMoveHighlight 0.6s ease-in;
  background-color: #fff49a !important;
}

@keyframes rowMoveHighlight {
  0%   { background-color: #fff49a; }
  70%  { background-color: #fff49a; }
  100% { background-color: inherit; }
}

/* Slide out/in animation for moving rows */
.car-row-slide-up {
  animation: rowSlideUpOut 0.3s ease-in forwards;
}
.car-row-slide-down {
  animation: rowSlideDownOut 0.3s ease-in forwards;
}
.car-row-slide-in-up {
  animation: rowSlideInUp 0.3s ease-out;
}
.car-row-slide-in-down {
  animation: rowSlideInDown 0.3s ease-out;
}

@keyframes rowSlideUpOut {
 0%   { opacity: 1; transform: translateY(0); }
 99%  { opacity: 0; transform: translateY(-40px); }
 100% { opacity: 0; transform: translateY(-40px); }
}
@keyframes rowSlideDownOut {
 0%   { opacity: 1; transform: translateY(0); }
 99%  { opacity: 0; transform: translateY(40px); }
 100% { opacity: 0; transform: translateY(40px); }
}
@keyframes rowSlideInUp {
 0%   { opacity: 0; transform: translateY(40px); }
 100% { opacity: 1; transform: translateY(0); }
}
@keyframes rowSlideInDown {
 0%   { opacity: 0; transform: translateY(-40px); }
 100% { opacity: 1; transform: translateY(0); }
}
#car-list tbody tr.duplicate-overdue {
  position: relative;
}
#car-list tbody tr.row-selected::after {
  content: '';
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 0;
  right: 0;
  border: 2px solid #000;
  border-radius: 4px;
  pointer-events: none;
  z-index: 2;
}
#car-list tbody tr.duplicate-overdue::after {
  content: '';
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 0;
  right: 0;
  border: 2px solid #0d6efd; /* blue border for duplicates */
  border-radius: 4px;
  pointer-events: none;
  z-index: 2;
}

/* Robust red border per cell for selected rows */
#car-list tbody tr.row-selected td {
  position: relative;
}
#car-list tbody tr.duplicate-overdue td {
  position: relative;
}
#car-list tbody tr.row-selected td::after {
  content: '';
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  left: 1px;
  border: 2px solid #000;
  pointer-events: none;
  border-radius: 3px;
  z-index: 3;
}
#car-list tbody tr.duplicate-overdue td::after {
  content: '';
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  left: 1px;
  border: 2px solid #0d6efd; /* blue border for duplicates */
  pointer-events: none;
  border-radius: 3px;
  z-index: 3;
}

/* Force black text for menu buttons */
#bottomBar .btn,
#carModal .btn,
#selectMultipleModal .btn,
#settingsModal .btn,
#carMenuEditorModal .btn,
#rowActionModal .btn,
#timeModal .btn,
#multiTimeModal .btn,
#multiNoteModal .btn,
#selectionBar .btn {
  color: #000 !important;
}

/* Visual feedback for Select button when active */
#activateMultiSelectBtn.active {
  background-color: #0dcaf0 !important;
  color: #000 !important;
  box-shadow: 0 0 10px rgba(13, 202, 240, 0.5);
  animation: pulse-select 2s infinite;
}

@keyframes pulse-select {
  0% { box-shadow: 0 0 10px rgba(13, 202, 240, 0.5); }
  50% { box-shadow: 0 0 20px rgba(13, 202, 240, 0.8); }
  100% { box-shadow: 0 0 10px rgba(13, 202, 240, 0.5); }
}

/* Nút xe đang ra trong menu: hiển thị đen tối nhưng vẫn bấm được */
.btn-car-out {
  background-color: #bfbfbf !important;
  color: #000 !important;
  border-color: #999 !important;
  filter: none !important;
}
.btn-car-out.selected {
  /* Khi chọn, vẫn giữ cảm giác được chọn nhưng không quá rực */
  box-shadow: 0 0 0 2px #000 inset;
}
