/* ===================== Reset & body ===================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f7f9fc;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
}

/* ===================== Header ===================== */
h1 {
  margin-bottom: 15px;
  color: #0074D9;
  font-weight: 700;
  text-align: center;
  font-size: 22px;
}

/* ===================== Main container ===================== */
#main-container {
  display: flex;
  flex-direction: column;
  flex: 1;                /* chiếm toàn bộ chiều cao còn lại */
  width: 100%;
  align-items: center;
}

/* ===================== Map ===================== */
#map {
  flex: 0 0 60%;          /* map chiếm 60% chiều cao container */
  width: 100%;
  max-width: 100%;
  border-radius: 0;
  box-shadow: none;
  margin-bottom: 20px;
  position: relative;
}

.trackasia-gl-map {
  border-radius: 0;
}

/* ===================== Map style selector ===================== */
#style-select {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 30px;
  padding: 2px 5px;
  font-size: 12px;
  background: rgba(255,255,255,0.9);
  border-radius: 6px;
  border: 1px solid #ccc;
  z-index: 1000;
  cursor: pointer;
}

#style-select:focus {
  border-color: #0074D9;
  outline: none;
  box-shadow: 0 0 8px #0074D9aa;
}

/* ===================== Form ===================== */
form {
  background-color: white;
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  width: 90%;
  max-width: 800px;
  margin-bottom: 40px;
}

.form-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ===================== Input row ===================== */
.input-row {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  align-items: stretch; /* stretch để nút cao bằng input */
}

.inputs-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group {
  position: relative;
  width: 100%;
}

/* ===================== Input icons ===================== */
.input-group svg {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  fill: #0074D9;
  pointer-events: none;
}

/* ===================== Input fields ===================== */
input[type="text"],
input[type="tel"],
input[type="datetime-local"] {
  width: 100%;
  padding: 5px 32px 5px 32px;
  font-size: 13px;
  border: 2px solid #ccc;
  border-radius: 6px;
  height: 28px;
  transition: border-color 0.3s ease;
}

input::placeholder {
  color: #aaa;
  font-style: italic;
}

input:focus {
  border-color: #0074D9;
  outline: none;
  box-shadow: 0 0 6px #0074D9aa;
}

/* ===================== Select ===================== */
select {
  width: 100%;
  padding: 5px 8px;
  font-size: 13px;
  border-radius: 6px;
  border: 2px solid #ccc;
  height: 28px;
  transition: border-color 0.3s ease;
}

select:focus {
  border-color: #0074D9;
  outline: none;
  box-shadow: 0 0 6px #0074D9aa;
}

/* ===================== Current location button ===================== */
#btn-current-location {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background-color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  z-index: 1100;
  padding: 0;
  transition: background-color 0.2s ease;
}

#btn-current-location:hover { background-color: #f0f0f0; }
#btn-current-location:active { background-color: #e0e0e0; }

#btn-current-location::before {
  content: '';
  display: block;
  width: 18px;
  height: 18px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23007BD9"><path d="M12 8a4 4 0 100 8 4 4 0 000-8zm0-5c.552 0 1 .448 1 1v2.065a8.002 8.002 0 014.935 4.935H21c.552 0 1 .448 1 1s-.448 1-1 1h-2.065a8.002 8.002 0 01-4.935 4.935V21c0 .552-.448 1-1 1s-1-.448-1-1v-2.065a8.002 8.002 0 01-4.935-4.935H3c-.552 0-1-.448-1-1s.448-1 1-1h2.065a8.002 8.002 0 014.935-4.935V4c0-.552.448-1 1-1z"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* ===================== Reverse button ===================== */
#btn-reverse-vertical {
  flex: 0 0 28px;
  margin-right: 5px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  user-select: none;
  height: 28px;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* ===================== Suggestions dropdown ===================== */
.suggestions {
  border: 1px solid #ccc;
  max-width: 100%;
  margin-top: 3px;
  background: #fff;
  position: absolute;
  z-index: 1200;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
  max-height: 150px;
  overflow-y: auto;
}

.suggestions div {
  padding: 8px 10px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.suggestions div:hover {
  background-color: #e0f0ff;
}

/* ===================== Route info ===================== */
#route-info {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 350px;
  background: rgba(230, 240, 255, 0.9);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 13px;
  color: #004a99;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  z-index: 1000;
}

/* ===================== Route submit button ===================== */
#route-form button[type="submit"] {
  background: linear-gradient(90deg, #0074D9, #00aaff);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
  width: 100%;
}

#route-form button[type="submit"]:hover {
  background: linear-gradient(90deg, #005fa3, #0099dd);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

#route-form button[type="submit"]:active {
  background: linear-gradient(90deg, #00407a, #0077aa);
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* ===================== Checkbox ===================== */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: default;
  user-select: none;
  color: #004a99;
  font-weight: 600;
  position: relative;
}

.checkbox-label svg {
  width: 16px;
  height: 16px;
  fill: #0074D9;
  flex-shrink: 0;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

input#night-surcharge {
  cursor: not-allowed;
}

#night-surcharge-status {
  font-weight: 700;
  margin-left: 4px;
  font-size: 13px;
  color: #d9534f;
  display: none;
}

#night-surcharge:checked + #night-surcharge-status {
  color: #28a745;
  display: inline;
}

/* ===================== Input datetime ===================== */
.input-datetime {
    position: relative;
    display: inline-block;
}

.input-datetime input[type="datetime-local"] {
    padding-left: 32px; /* cách icon 32px */
    font-size: 13px;
}

.input-datetime svg {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.input-datetime .time-placeholder {
    position: absolute;
    left: 32px; /* cách icon */
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 13px;
    pointer-events: none;
    transition: 0.2s;
}

.input-datetime .time-placeholder.has-value {
    opacity: 0;
}



/* ===================== TrackAsia Popup ===================== */
.ta-popup {
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  padding: 6px 10px;
}

.ta-popup button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 6px 8px;
  color: #fff;
  font-weight: 600;
}

.ta-popup .btn-start { background-color: #28a745; }
.ta-popup .btn-end { background-color: #d9534f; }

/* ===================== Responsive ===================== */
@media screen and (max-width: 768px) {
  #map { flex: 0 0 50%; }      /* map thấp hơn trên tablet */
  form, #route-info { width: 95%; }
}

@media (max-width: 480px) {
  #btn-reverse-vertical {
    height: 28px;          
    flex: 0 0 auto;        
    margin-right: 5px;     
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 18px;
  }

  .input-row {
    flex-direction: row;   
    flex-wrap: wrap;
    align-items: center;  
    gap
}
