:root {
  --primary_color: #ffffff;
  --accent_color: #4a649f;
  --accent_light: #4a649fee;
  --border_color: #999;
  --border_light: #d1d5db;
  --text_primary: #333;
  --text_secondary: #555;
  --text_muted: #6c757d;
  --gray_light: #f5f5f5;
  --gray_hover: #f0f0f0;
  --bg_detail: #cbd8f7a3;
  --bg_page: #f3f4f6;
}

* {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Open Sans', Helvetica, Arial, sans-serif;
}

/* Base styles from style.css */
html { font-size: clamp(15.5px, 1.5vw, 21px); }
html, body { height: 100%; margin: 0; padding: 0; }
table { border-collapse: collapse; }

/* Override body for history page */
body {
  background-color: var(--bg_page); /* Override from hist.css */
  color: var(--text_primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.8rem 0; /* Override from hist.css */
}

/* General link styles */
a {
  color: var(--accent_color);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* Utility classes */
.hide { visibility: hidden; }
.off { display: none; }
.no_click { pointer-events: none; }

/* Disabled states */
label:disabled, input:disabled {
  opacity: 0.7;
  pointer-events: none;
}

/* History page specific container */
.container-wrapper {
  margin: 0 auto;
  background-color: var(--primary_color);
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 1rem;
  height: calc(100vh - 1.6rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* History page header */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

.header-title {
  font-size: 1.3rem;
  font-weight: 500;
  color: #41526a;
}

/* Back button with hist.css overrides */
.back_button {
  background-color: var(--accent_color);
  color: #f7f7f7;
  padding: 0.5rem 1rem;
  border-radius: 0.3rem;
  outline: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  /*transition: background-color 0.1s;*/
}

.back_button:hover { background-color: var(--accent_light); }
.back_button:focus { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5); }

.back_button u {
  text-decoration: none;
  font-size: 1.1rem;
  line-height: 1.0;
}

/* Search functionality (commented out in HTML but keeping styles) */
.search-bar-container { margin-bottom: 1.5rem; }
.search-input-wrapper { position: relative; }

.search-icon-wrapper {
  position: absolute;
  inset-y: 0;
  left: 0;
  padding-left: 0.75rem;
  display: flex;
  align-items: center;
  pointer-events: none;
  height: 100%;
}

.search-input {
  display: block;
  width: 100%;
  padding-left: 2.5rem;
  padding-right: 0.75rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  border: 1px solid var(--border_light);
  border-radius: 0.5rem;
  outline: none;
  font-size: 0.875rem;
}

.search-input:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #3b82f6;
  border-color: #3b82f6;
}

/* History table container */
.hist {
  overflow: auto;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* History table */
#hist {
  min-width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

#hist thead {
  background-color: #f9fafb;
  position: sticky;
  top: 0;
  z-index: 10;
}

#hist thead th {
  padding: 0.7rem 0.6rem;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  text-wrap: nowrap;
  background-color: #f9fafb;
}

#hist thead th:first-child { border-top-left-radius: 0.5rem; }
#hist thead th:last-child { border-top-right-radius: 0.5rem; }

#hist tbody { background-color: var(--primary_color); }
#hist tbody, #hist tr { border-bottom: 1px solid #e0e0e0; }
#hist tr:last-child { border-bottom: none; }

#hist tbody tr:hover {
  background-color: var(--gray_light);
  /*transition: background-color 100ms ease;*/
  cursor: pointer;
}

#hist tbody tr:has(td:nth-child(4) s):hover {
  cursor: not-allowed;
  background-color: #fafafa;
}

#hist td {
  padding: 0.75rem 0.5rem;
  white-space: nowrap;
  font-size: 0.9rem;
  color: #4b5563;
}

#hist td.text-dark {
  font-weight: 500;
  color: #1f2937;
}

#hist td.flex_center {
  align-items: center;
}

/* Result styling */
#result {
  margin: 1rem auto;
  width: 100%;
  max-width: 1000px;
}

#result ul { margin: .5rem 1rem; }
#result li { padding: .2rem 0; }

#result hr {
  height: 1px;
  border: none;
  background-color: #ccc;
  margin: 1rem auto;
  width: 96%;
  max-width: 840px;
}

#result table { width: 96%; }

#result td {
  text-align: left;
  vertical-align: top;
  padding: .2rem .5rem;
}

#result th { color: var(--accent_light); }

#result u {
  text-decoration: none;
  padding: 0 .3rem;
  color: #3056ab;
}

.exw {
  color: var(--accent_light) !important;
  padding-right: .3rem;
}

#result s {
  text-decoration: none !important;
  padding-right: .23rem;
  font-size: 90%;
  color: #888;
}

#result th i {
  font-style: normal;
  padding: 0 .8rem;
}

#result td i {
  font-style: normal;
  font-size: 90%;
  color: #888;
}

#result td.num {
  padding-right: .2rem;
  text-align: right;
}

#result td.tot {
  border-left: 1px solid #ccc;
  text-align: right;
}

/* History table specific formatting */
.hist i {
  color: #61c161;
  font-style: normal;
}

#hist s {
  text-decoration: none;
  color: #d75050;
}

/* Arrow indicator - using hist.css version */
.arrow-indicator {
  display: inline-block;
  width: 20px;
  text-align: right;
  color: #6b7280;
  font-size: 1.5rem;
  opacity: 0;
  float: right;
  line-height: 0.8rem;
}

#hist tbody tr:hover .arrow-indicator { opacity: 1; }

#hist tbody tr.expanded .arrow-indicator {
  opacity: 1;
  transform: rotate(90deg);
}

/* Detail row styles */
.detail_row {
  background-color: #f8f9fa;
  border-bottom: 1px solid #e5e7eb;
}

.detail_row td { padding: 0 !important; }

.detail_row .tbl_row {
  display: flex;
  align-items: center;
  padding: 1rem 0.5rem;
  gap: 1rem;
  background-color: var(--bg_detail);
  border-bottom: .5px solid #bbb;
}

.detail_row .tbl_row:last-child { border-bottom: none; }

.detail_row .col {
  flex: 1;
  padding: 0;
  font-size: 0.875rem;
  color: #4b5563;
}

.detail_row .col b { color: #1f2937; }

.detail_row .col_actions {
  flex: 0 0 auto;
  text-align: right;
}

.booked b {
    color: #22c55e;
    font-weight: 500;
}

/* Buttons */
.btn_book_hist {
  background-color: var(--accent_color);
  color: white !important;
  padding: 0.375rem 1rem;
  border: none;
  border-radius: 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  /*transition: background-color 100ms;*/
}

.btn_book_hist:hover { background-color: var(--accent_light); }

/* Loading animation */
.btn_book_detail.loading,
.btn_book_hist.loading {
  animation: pulse 1s ease-in-out infinite;
  cursor: not-allowed;
}

@keyframes pulse {
  0% { background-color: var(--accent_color); }
  50% {
    background-color: var(--accent_light);
    transform: scale(1.02);
  }
  100% { background-color: var(--accent_color); }
}

.btn_book_detail:disabled,
.btn_book_hist:disabled {
  opacity: 0.9;
}

/* Icon classes */
.icon-base {
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.icon-size-sm {
  height: 1rem;
  width: 1rem;
}

.icon-size-md {
  height: 1.25rem;
  width: 1.25rem;
}

.icon-size-xs {
  height: 0.75rem;
  width: 0.75rem;
  margin-left: 0.25rem;
  margin-right: 0;
}

.icon-button-plus {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0iI2ZmZmZmZiI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAgM2ExIDEgMCAwMTExdjVoNWExIDEgMCAxMTAgMmgtNXY1YTEgMSAwIDExLTIgMFYxMmgtNWExIDEgMCAxMTAtMmg1VjRhMSAxIDAgMDExLTF6IiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=");
}

.icon-search {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0iIzk5YTMxYWYiPjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTggM2E0IDQgMCAxMDAgOCA0IDQgMCAwMDAtOHpNMiA4YTYgNiAwIDExMTAuODkgMy40NzZsNC44MTcgNC44MTdhMSAxIDAgMDEtMS40MTQgMS40MTRsLTQuODE2LTQuODE2QTYgNiAwIDAxMiA4eiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+");
}

.icon-airport {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0iIzk5YTMxYWYiPjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTEwIDNhMSAxIDAgMDExMXY1aDVhMSAxIDAgMTEwIDJoLTV2NWExIDEgMCAxMS0yIDBWMTJoLTVhMSAxIDAgMTEwLTJoNVY0YTEgMSAwIDAxMS0xeiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+");
}

.icon-location {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0iIzk5YTMxYWYiPjxwYXRoIGQ9Ik0wLjcwNyAyLjI5M2ExIDEgMCAwMC0xLjQxNCAwTDAgNy41ODZWMTRhMiAyIDAgMDAyIDJoOGEyIDIgMCAwMDItMlY3LjU4NmwtNS4yOTMtNS4yOTN6TTEwIDExYTEgNTIwIDUyaDFhMDIgMCAxMTAtMmgtMXpNMTIgMTFhIDEgMCAxMTAgMDJoMmExIDEgMCAxMTAtMmgtMnpNNS42OSA2LjY5IDEwLjcxIDIuMjkgMS40MTQgMFMxMCAzIDEuNTg2IDVsLTUuMjkzLTIuM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zYTEgMSAwIDEwLTIgMHYxSDJWM2ExIDEgMCAxMDAtMnYxSDIwYTIgMiAwIDAwMiAyaDEyeiIgY2xpcC1ydWxlPSJldmVub2RkIi8+PC9zdmc+");
}

.icon-quote {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0iIzNiODJmNiI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNIDQgNGEyIDIgMCAwMC0yIDJ2OGEyIDIgMCAwMDIgMmgxMmEyIDIgMCAwMDItMlY2YTIgMiAwIDAwLTItMkg0em0xMiA1SDRWNmgxMnYzem0tMSAzSDV2MmoxMHYtMnoiIGNsaXAtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==");
}

.icon-external-link {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMjU2M2ViIiBzdHJva2Utd2lkdGg9IjIiPjxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTEwIDZINmEyIDIgMCAwMC0yIDJ2MTBhMiAyIDAgMDAyIDJoMTBhMiAyIDAgMDAyLTJ2LTRNMTQGNGG2bTAgMHY2bTAtNkwxMCAxNCIvPjwvc3ZnPg==");
}

.action-cell {
  text-align: right;
  font-weight: 500;
}

/* Booked search rows */
tr.booked { cursor: default; }
tr.booked:hover { background-color: inherit; }

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(0.25rem);
}

.modal_content {
  position: relative;
  background-color: #fff;
  margin: 10% auto;
  padding: 2rem;
  border-radius: 0.5rem;
  width: 90%;
  max-width: 30rem;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.2);
}

.modal_close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 1.75rem;
  font-weight: bold;
  line-height: 1;
  color: #999;
  cursor: pointer;
  /*transition: color 0.13s;*/
}

.modal_close:hover { color: var(--text_primary); }

.modal h3 {
  margin: 0 0 1rem 0;
  color: var(--text_primary);
  font-size: 1.25rem;
}

.modal>div {
  padding: 2rem 4rem 3rem;
  position: relative;
}

.modal .from_group { margin-bottom: 1rem; }
.modal h2 { text-align: center; }

#info_form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 0.0625rem solid var(--border_light);
  border-radius: 0.375rem;
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
  min-height: 8rem;
  margin-bottom: 1rem;
}

#info_form textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 0.125rem rgba(59, 130, 246, 0.1);
}

#info_form button[type="submit"] {
  background-color: var(--accent_color);
  color: white;
  border: none;
  border-radius: 0.375rem;
  padding: 0.75rem 2rem;
  font-size: 0.875rem;
  cursor: pointer;
  /*transition: background-color 0.13s;*/
}

#info_form button[type="submit"]:hover { background-color: var(--accent_light); }

.modal_ok {
  background-color: var(--accent_color);
  color: white;
  border: none;
  border-radius: 0.375rem;
  padding: 0.75rem 2rem;
  font-size: 0.875rem;
  cursor: pointer;
  /*transition: background-color 0.13s;*/
  margin-top: 1rem;
  width: 100%;
}

.modal_ok:hover { background-color: var(--accent_light); }

/* Custom scrollbar */
.hist::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.hist::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
}

.hist::-webkit-scrollbar-track {
  background-color: #f1f5f9;
}

/* Media queries */
@media (min-width: 640px) {
  body { padding: 1.5rem 0; }
  
  .container-wrapper {
    padding: 1.5rem;
    height: calc(100vh - 3rem);
  }
  
  .header { flex-direction: row; }
  
  .hist { min-width: 38rem; }
  
  .back_button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .search-input { font-size: 16px; }
  
  #hist td { padding: 0.75rem 0.6rem; }
}

@media (min-width: 1024px) {
  body { padding: 2rem 0; }
  
  .container-wrapper {
    padding: 2rem;
    height: calc(100vh - 4rem);
  }
  
  #hist td { padding: 0.75rem 0.7rem; }
  
  .hist { min-width: 40rem; }
}

/* Mobile styles */
@media (max-width: 639px) {
  body { padding: 0; }
  
  .container-wrapper {
    border-radius: 0;
    box-shadow: none;
    padding: 0.5rem;
    width: 100%;
    height: 100vh;
  }
  
  .header {
    padding: .5rem 0.2rem 0;
    flex-direction: row;
    gap: 0.5rem;
  }
  
  .header-title {
    font-size: 1.04rem;
    margin: 0;
  }
  
  .back_button {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    white-space: nowrap;
  }
}

@media (min-width: 361px) and (max-width: 480px) {
  #hist td { font-size: 0.85rem; }
}

@media (max-width: 480px) {
  /* Hide T/T column on very small screens */
  #hist th:nth-child(4), #hist td:nth-child(4) {
    display: none;
  }
  
  /* Mobile modal adjustments */
  .modal_content {
    width: 95%;
    padding: 1.5rem;
    margin: 20% auto;
  }
  
  .modal h3 { font-size: 1.125rem; }
  
  #info_form textarea {
    font-size: 0.875rem;
    padding: 0.625rem;
  }
}

@media (max-width: 360px) {
  body { padding: 0; }
  
  .container-wrapper { padding: 0.375rem; }
  
  #hist thead th {
    padding: 0.5rem 0.3rem;
    font-size: 0.7rem;
  }
  
  #hist td {
    padding: 0.5rem 0.3rem;
    font-size: 0.8rem;
  }
  
  #hist th:nth-child(3),
  #hist td:nth-child(3) {
    font-size: 0.75rem;
  }
  
  #hist button {
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
  }
  
  .detail_row .tbl_row {
    padding: 0.75rem 0.3rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  
  .detail_row .col {
    padding: 0;
    font-size: 0.75rem;
  }
  
  .detail_row .btn_book_hist {
    padding: 0.3rem 0.75rem;
    font-size: 0.7rem;
  }
}

/* High DPR screens */
@media (-webkit-min-device-pixel-ratio: 2), 
       (min-resolution: 192dpi) {
  .hist,
  #hist thead th,
  #hist tbody,
  #hist tr,
  .detail_row .tbl_row {
    border-width: 0.5px;
  }
  
  #hist button,
  .back_button {
    border-width: 0.5px;
  }
}
