/**
 * TourSure Booking Order List Styles
 * Suffix: bk01
 * Version: 1.4.0
 *
 * This stylesheet provides all necessary styles for the AJAX booking list,
 * including filters, pagination, responsive table, skeleton loading,
 * inline status update, and email notification functionality.
 */

/* =================================================================
   1. ROOT VARIABLES & GLOBAL STYLES
   ================================================================= */
:root {
  --tsb-primary: #5B21B6;
  --tsb-primary-light: #7C3AED;
  --tsb-primary-dark: #4C1D95;
  --tsb-success: #10B981;
  --tsb-warning: #F59E0B;
  --tsb-danger: #EF4444;
  --tsb-info: #3B82F6;
  --tsb-gray-50: #F9FAFB;
  --tsb-gray-100: #F3F4F6;
  --tsb-gray-200: #E5E7EB;
  --tsb-gray-300: #D1D5DB;
  --tsb-gray-500: #6B7280;
  --tsb-gray-700: #374151;
  --tsb-gray-900: #111827;
  --tsb-radius: 8px;
  --tsb-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --tsb-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tsb-container-bk01 {
  font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--tsb-gray-900);
  background-color: #fff;
  padding: 24px;
  border-radius: var(--tsb-radius);
  box-shadow: var(--tsb-shadow-md);
}

/* =================================================================
   2. FILTER SECTION
   ================================================================= */
.tsb-filters-bk01 {
  background: var(--tsb-gray-50);
  border-radius: var(--tsb-radius);
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--tsb-gray-200);
}

.tsb-filter-row-bk01 {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.tsb-filter-row-bk01:not(:last-child) {
  margin-bottom: 16px;
}

.tsb-filter-group-bk01 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
}

.tsb-filter-group-bk01.tsb-search-group-bk01 {
  flex: 2 1 300px;
}

.tsb-filter-group-bk01.tsb-date-group-bk01 {
  flex: 1 1 300px;
}

.tsb-filters-bk01 input[type="text"],
.tsb-filters-bk01 input[type="date"],
.tsb-filters-bk01 select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--tsb-gray-300);
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s;
  background: white;
}

.tsb-filters-bk01 input[type="text"]:focus,
.tsb-filters-bk01 input[type="date"]:focus,
.tsb-filters-bk01 select:focus {
  outline: none;
  border-color: var(--tsb-primary);
  box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.1);
}

.tsb-search-group-bk01 .tsb-icon-bk01 {
  color: var(--tsb-gray-500);
  width: 20px;
  height: 20px;
}

.tsb-date-group-bk01 label {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.tsb-date-group-bk01 span {
  color: var(--tsb-gray-500);
}

.tsb-btn-bk01.btn--reset {
  background: white;
  color: var(--tsb-gray-700);
  border: 1px solid var(--tsb-gray-300);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tsb-btn-bk01.btn--reset:hover {
  background: var(--tsb-gray-100);
  border-color: var(--tsb-gray-400);
}

.tsb-btn-bk01.btn--reset .tsb-icon-bk01 {
  width: 16px;
  height: 16px;
}

/* =================================================================
   3. TABLE STYLES
   ================================================================= */
.tsb-table-wrapper-bk01 {
  overflow-x: auto;
  margin-bottom: 24px;
}

.tsb-table-bk01 {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.tsb-table-bk01 thead {
  background: var(--tsb-gray-50);
}

.tsb-table-bk01 th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--tsb-gray-500);
  white-space: nowrap;
  border-bottom: 2px solid var(--tsb-gray-200);
}

.tsb-table-bk01 tbody tr {
  border-bottom: 1px solid var(--tsb-gray-100);
  transition: background-color 0.2s;
}

.tsb-table-bk01 tbody tr:hover {
  background: var(--tsb-gray-50);
}

.tsb-table-bk01 td {
  padding: 12px 16px;
  color: var(--tsb-gray-700);
  vertical-align: middle;
}

.tsb-booking-number-bk01 {
  font-weight: 600;
  color: var(--tsb-primary);
}

.tsb-customer-cell-bk01 .name {
  font-weight: 500;
  color: var(--tsb-gray-900);
}

.tsb-customer-cell-bk01 .phone {
  font-size: 12px;
  color: var(--tsb-gray-500);
  margin-top: 2px;
}

/* =================================================================
   4. STATUS BADGES & INLINE UPDATE
   ================================================================= */
.tsb-status-badge-bk01 {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.tsb-status-badge-bk01.status--pending {
  background-color: #FEF3C7;
  color: #92400E;
}

.tsb-status-badge-bk01.status--confirmed {
  background-color: #DBEAFE;
  color: #1E40AF;
}

.tsb-status-badge-bk01.status--paid {
  background-color: #D1FAE5;
  color: #065F46;
}

.tsb-status-badge-bk01.status--partial_paid {
  background-color: #E0E7FF;
  color: #3730A3;
}

.tsb-status-badge-bk01.status--cancelled {
  background-color: #FEE2E2;
  color: #991B1B;
}

.tsb-status-badge-bk01.status--refunded {
  background-color: #E5E7EB;
  color: #374151;
}

.tsb-status-badge-bk01.status--completed {
  background-color: #E9D5FF;
  color: #5B21B6;
}

.tsb-status-cell-bk01 {
  position: relative;
}

.tsb-status-cell-bk01 .tsb-status-badge-bk01 {
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.tsb-status-cell-bk01:hover .tsb-status-badge-bk01 {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  filter: brightness(1.1);
}

.tsb-status-select-inline-bk01 {
  padding: 4px 8px;
  font-size: 12px;
  font-family: 'Sarabun', sans-serif;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--tsb-primary);
  background-color: #fff;
  min-width: 130px;
  box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.1);
}


.tsb-status-loader-bk01 {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-left-color: var(--tsb-primary);
  border-radius: 50%;
  animation: tsb-spinner-bk01 0.6s linear infinite;
}

@keyframes tsb-spinner-bk01 {
  to {
    transform: rotate(360deg);
  }
}

/* --- Editable Cell Styles (for Departure Date) --- */
.tsb-editable-cell-bk01 {
  position: relative;
  cursor: pointer;
}

.tsb-editable-cell-bk01 .tsb-edit-icon-bk01 {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  padding: 4px;
  border-radius: 50%;
  background-color: transparent;
  border: none;
  color: var(--tsb-gray-400);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, background-color 0.2s;
}

.tsb-editable-cell-bk01:hover .tsb-edit-icon-bk01 {
  opacity: 1;
}

.tsb-editable-cell-bk01 .tsb-edit-icon-bk01:hover {
  color: var(--tsb-primary);
  background-color: var(--tsb-gray-100);
}

.tsb-editable-cell-bk01 .tsb-cell-input-bk01 {
  width: calc(100% - 32px);
  /* Adjust width to fit inside the cell padding */
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid var(--tsb-primary);
  border-radius: 4px;
  box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.1);
}

.tsb-editable-cell-bk01.is-editing .tsb-edit-icon-bk01 {
  display: none;
}


/* =================================================================
   5. ACTION BUTTONS
   ================================================================= */
.tsb-actions-bk01 {
  display: flex;
  gap: 8px;
}

.tsb-btn-bk01 {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.tsb-btn-bk01 svg {
  width: 16px;
  height: 16px;
}

.tsb-btn-bk01.btn--edit {
  background-color: var(--tsb-gray-200);
  color: var(--tsb-gray-700);
}

.tsb-btn-bk01.btn--edit:hover {
  background-color: var(--tsb-gray-300);
}

.tsb-btn-bk01.btn--view {
  background-color: var(--tsb-info);
  color: white;
}

.tsb-btn-bk01.btn--view:hover {
  background-color: #2563EB;
}


.tsb-btn-bk01.btn--history {
  background-color: var(--tsb-gray-600);
  color: var(--tsb-gray-100);
}

.tsb-btn-bk01.btn--history:hover {
  background-color: var(--tsb-gray-700);
}

/* --- Tooltip for Email Button --- */
.tsb-btn-bk01.btn--send-email[data-tooltip] {
  position: relative;
}

.tsb-btn-bk01.btn--send-email[data-tooltip]:hover::after,
.tsb-btn-bk01.btn--send-email[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transition-delay: 0.3s;
}

.tsb-btn-bk01.btn--send-email[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 10px;
  background-color: var(--tsb-gray-900);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.tsb-btn-bk01.btn--send-email[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 6px solid transparent;
  border-top-color: var(--tsb-gray-900);
  z-index: 101;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

/* =================================================================
   6. FOOTER, PAGINATION & PER-PAGE
   ================================================================= */
.tsb-footer-bk01 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  padding-top: 16px;
}

.tsb-per-page-bk01 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.tsb-per-page-bk01 select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--tsb-gray-300);
}

.tsb-pagination-bk01 {
  display: flex;
  gap: 8px;
}

.tsb-page-btn-bk01 {
  padding: 6px 12px;
  border: 1px solid var(--tsb-gray-300);
  background: white;
  border-radius: 6px;
  color: var(--tsb-gray-700);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  min-width: 36px;
}

.tsb-page-btn-bk01:hover {
  border-color: var(--tsb-primary);
  color: var(--tsb-primary);
}

.tsb-page-btn-bk01.active {
  background: var(--tsb-primary);
  color: white;
  border-color: var(--tsb-primary);
  font-weight: bold;
}

.tsb-page-btn-bk01:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--tsb-gray-100);
}

.tsb-page-dots-bk01 {
  padding: 6px 0;
  color: var(--tsb-gray-500);
}

/* =================================================================
   7. SKELETON LOADING & NO RESULTS
   ================================================================= */
.tsb-skeleton-row-bk01 td .tsb-skeleton-cell-bk01 {
  height: 20px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.tsb-no-results-bk01 {
  text-align: center;
  padding: 60px 20px;
  color: var(--tsb-gray-500);
}

/* =================================================================
   8. SEND EMAIL BUTTON & NOTIFICATION STYLES
   ================================================================= */
.tsb-btn-bk01.btn--send-email {
  background-color: var(--tsb-warning);
  color: white;
}

.tsb-btn-bk01.btn--send-email:hover:not(:disabled) {
  background-color: #D97706;
  /* Darker Orange */
}

.tsb-btn-bk01:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.tsb-btn-bk01.is-loading svg {
  animation: tsb-spinner-bk01 0.6s linear infinite;
}

.tsb-btn-bk01.is-success {
  background-color: var(--tsb-success);
}

.tsb-btn-bk01.is-error {
  background-color: var(--tsb-danger);
}

.tsb-toast-notification-bk01 {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease-in-out;
}

.tsb-toast-notification-bk01.show {
  opacity: 1;
  transform: translateY(0);
}

.tsb-toast-notification-bk01.success {
  background-color: var(--tsb-success);
}

.tsb-toast-notification-bk01.error {
  background-color: var(--tsb-danger);
}

/* =================================================================
   9. HISTORY MODAL STYLES
   ================================================================= */
.tsb-modal-bk01 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tsb-modal-bk01.is-visible {
  opacity: 1;
  visibility: visible;
}

.tsb-modal-overlay-bk01 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.tsb-modal-content-bk01 {
  position: relative;
  background: white;
  border-radius: var(--tsb-radius);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.tsb-modal-bk01.is-visible .tsb-modal-content-bk01 {
  transform: scale(1);
}

.tsb-modal-header-bk01 {
  padding: 16px 24px;
  border-bottom: 1px solid var(--tsb-gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tsb-modal-header-bk01 h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.tsb-modal-close-bk01 {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--tsb-gray-500);
  padding: 0;
  line-height: 1;
}

.tsb-modal-body-bk01 {
  padding: 24px;
  overflow-y: auto;
}

.tsb-history-table-bk01 .tsb-status-badge-bk01 {
  cursor: default;
}

.tsb-history-table-bk01 .tsb-status-badge-bk01:hover {
  transform: none;
  box-shadow: none;
  filter: none;
}

/* =================================================================
   9. RESPONSIVE DESIGN
   ================================================================= */
@media (max-width: 992px) {
  .tsb-filter-row-bk01 {
    flex-direction: column;
    align-items: stretch;
  }

  .tsb-filter-group-bk01 {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .tsb-table-bk01 {
    display: block;
    width: 100%;
  }

  .tsb-table-bk01 thead {
    display: none;
  }

  .tsb-table-bk01 tr {
    display: block;
    margin-bottom: 16px;
    border: 1px solid var(--tsb-gray-200);
    border-radius: var(--tsb-radius);
    padding: 8px;
  }

  .tsb-table-bk01 td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    text-align: right;
    border-bottom: 1px solid var(--tsb-gray-100);
  }

  .tsb-table-bk01 td:last-child {
    border-bottom: none;
  }

  .tsb-table-bk01 td::before {
    content: attr(data-label);
    font-weight: 600;
    text-align: left;
    color: var(--tsb-gray-900);
    margin-right: 16px;
  }

  .tsb-footer-bk01 {
    flex-direction: column;
    align-items: center;
  }
}

/* =================================================================
   10. PAYMENT SLIP IMAGES & LIGHTBOX
   ================================================================= */

/* Payment Slip Thumbnails Container */
.tsb-payment-slips-bk01 {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Payment Slip Thumbnail Image */
.tsb-slip-thumb-bk01 {
  width: 80px;
  height: auto;
  border-radius: 5px;
  cursor: pointer;
  border: 2px solid var(--tsb-gray-200);
  transition: all 0.2s ease;
  object-fit: cover;
  max-height: 100px;
}

.tsb-slip-thumb-bk01:hover {
  transform: scale(1.05);
  border-color: var(--tsb-primary);
  box-shadow: 0 4px 12px rgba(91, 33, 182, 0.2);
}

/* No Slip Indicator */
.tsb-no-slip-bk01 {
  color: var(--tsb-gray-500);
  font-style: italic;
  font-size: 14px;
}

/* Lightbox Modal */
.tsb-lightbox-bk01 {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.tsb-lightbox-bk01.active {
  opacity: 1;
  visibility: visible;
}

/* Lightbox Overlay */
.tsb-lightbox-overlay-bk01 {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

/* Lightbox Content */
.tsb-lightbox-content-bk01 {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 1;
  animation: lightboxZoomIn 0.3s ease-out;
}

@keyframes lightboxZoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.tsb-lightbox-content-bk01 img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Lightbox Close Button */
.tsb-lightbox-close-bk01 {
  position: absolute;
  top: -40px;
  right: 0;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.tsb-lightbox-close-bk01:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.8);
  transform: rotate(90deg);
}

/* Responsive Lightbox */
@media (max-width: 768px) {
  .tsb-lightbox-content-bk01 {
    max-width: 95vw;
    max-height: 85vh;
  }

  .tsb-lightbox-close-bk01 {
    top: 10px;
    right: 10px;
  }

  .tsb-slip-thumb-bk01 {
    width: 60px;
    max-height: 80px;
  }
}
