:root {
  --primary-color: #0077cc;
  --secondary-color: #ffcb05;
  --accent-color: #00bfa5;
  --text-color: #333333;
  --light-text: #ffffff;
  --background-color: #f5f7fa;
  --card-color: #ffffff;
  --border-radius: 12px;
  --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

body {
  font-family: "Inter", sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--background-color);
  color: var(--text-color);
  background-image: linear-gradient(
    135deg,
    rgba(0, 119, 204, 0.05) 0%,
    rgba(0, 191, 165, 0.05) 100%
  );
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  z-index: 1;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: hidden;
  width: 100%;
}

header {
  background: linear-gradient(135deg, var(--primary-color), #1a5eaf);
  color: var(--light-text);
  padding: 3rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 150px;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding-top: 1rem;
}

header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("./public/bg.jpg");
  background-size: cover;
  background-position: center;
  opacity: 0.15;
  z-index: 0;
}

header h1 {
  margin: 0;
  font-size: 2.8rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
  margin-top: 1rem;
  font-size: 1.3rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 1;
  opacity: 0.9;
}

main {
  flex: 1;
}

.search-modal {
  max-width: 800px;
  width: 100%;
  margin: -5rem auto;
  padding: 2rem;
  text-align: center;
  background-color: var(--card-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  position: relative;
  top: -40px;
  margin-bottom: 3rem;
}

h2 {
  color: var(--primary-color);
  font-size: 1.8rem;
  margin-bottom: 2rem;
  position: relative;
  display: inline-block;
}

h2::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background-color: var(--secondary-color);
  border-radius: 3px;
}

input,
select,
button {
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  padding: 0.9rem;
  margin: 0.5rem 0;
  border: 1px solid #dde5f2;
  border-radius: var(--border-radius);
  width: 100%;
  box-sizing: border-box;
  transition: var(--transition);
  background-color: white;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 119, 204, 0.1);
}

button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  max-width: 300px;
  margin: 1.5rem auto;
  display: block;
  font-weight: 600;
  box-shadow: 0 4px 6px rgba(0, 119, 204, 0.2);
  position: relative;
  overflow: hidden;
}

button::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
  z-index: 1;
}

button:hover {
  background-color: #0066b3;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 119, 204, 0.3);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 4px 6px rgba(0, 119, 204, 0.2);
}

.results {
  margin-top: 2rem;
  padding: 0;
  text-align: left;
  border: none;
}

.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
  position: relative;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #576981;
  font-size: 0.95rem;
}

.airport-select {
  width: 100%;
}

.loading {
  margin: 2rem auto;
  text-align: center;
}

.loading p {
  margin-top: 1rem;
  color: #576981;
  font-size: 0.95rem;
}

.hidden {
  display: none;
}

.spinner {
  border: 4px solid rgba(0, 119, 204, 0.1);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border-left-color: var(--primary-color);
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

.route-option {
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background-color: white;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  transition: var(--transition);
  border-left: 4px solid var(--secondary-color);
}

.route-option:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.route-option h3 {
  margin-top: 0;
  color: var(--primary-color);
  font-size: 1.3rem;
  font-weight: 600;
}

.price-highlight {
  font-weight: 700;
  color: var(--accent-color);
  font-size: 1.4rem;
  display: inline-block;
  background-color: #f0fbf8;
  padding: 4px 10px;
  border-radius: 8px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Select2 custom styling */
.select2-container--default .select2-selection--single {
  height: auto;
  padding: 8px;
  border-radius: var(--border-radius);
  border: 1px solid #dde5f2;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__arrow {
  height: 42px;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  line-height: 28px;
  padding-left: 0;
  color: var(--text-color);
}

.select2-result-airport {
  display: flex;
  align-items: center;
  padding: 10px;
  transition: var(--transition);
}

.select2-result-airport__code {
  font-weight: bold;
  color: var(--primary-color);
  margin-right: 12px;
  width: 50px;
  font-size: 0.95rem;
  background-color: #f0f7ff;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
}

.select2-result-airport__info {
  flex: 1;
}

.select2-result-airport__name {
  font-weight: 500;
  color: var(--text-color);
}

.select2-result-airport__country {
  font-size: 0.85em;
  color: #6c757d;
}

.select2-container--default
  .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: var(--primary-color);
}

.select2-container--default
  .select2-results__option--highlighted[aria-selected] {
  background-color: #f5f9ff;
  color: var(--text-color);
}

.select2-container--default
  .select2-results__option--highlighted[aria-selected]
  .select2-result-airport__code {
  color: var(--primary-color);
  background-color: #e0efff;
}

.select2-container--open .select2-dropdown {
  border-color: #dde5f2;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius);
}

/* Flight details styling */
.flight-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 15px 0;
  flex-wrap: wrap;
}

.flight-details__time {
  width: 48%;
  font-weight: 600;
}

.flight-details__route {
  flex: 1;
  display: flex;
  align-items: center;
}

.flight-details__airport {
  font-size: 0.95rem;
  margin-top: 2px;
  word-break: break-word;
}

.flight-details__line {
  flex: 1;
  height: 2px;
  background-color: #dde5f2;
  margin: 0 10px;
  position: relative;
}

.flight-details__line::after {
  content: "✈️";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
}

.flight-details__airline {
  background-color: #f0f7ff;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--primary-color);
  font-weight: 500;
  font-size: 0.9rem;
  margin-left: 10px;
}

@media (max-width: 768px) {
  header h1 {
    font-size: 2.2rem;
  }

  header p {
    font-size: 1.1rem;
  }

  .search-modal {
    padding: 1.5rem;
    margin: 0 1rem;
    margin-top: -12rem;
    top: 0;
    max-width: 100%;
    width: calc(100% - 2rem);
    box-sizing: border-box;
  }

  .route-option {
    padding: 1rem;
  }

  footer {
    margin-top: 3rem;
    padding: 1rem;
  }

  footer p {
    height: 100%;
    margin: unset;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .search-container {
    width: 100%;
  }

  input,
  select,
  button {
    font-size: 16px; /* Prevents iOS zoom on input focus */
  }

  .form-group {
    margin-bottom: 1rem;
  }

  .select2-container {
    width: 100%;
  }

  .select2-container--default .select2-selection--single {
    padding: 10px 8px;
  }

  .select2-container--default
    .select2-selection--single
    .select2-selection__arrow {
    height: 44px;
  }

  .select2-result-airport {
    padding: 8px 0;
  }

  .flight-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .flight-details__time {
    width: 100%;
    margin-bottom: 0;
  }

  .flight-details__airline {
    margin-left: 0;
    margin-top: 5px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .flight-details__airport {
    font-size: 0.9rem;
  }

  .flight-details__route {
    flex-direction: column;
    gap: 5px;
  }

  .price-details {
    flex-direction: column;
    align-items: flex-start;
  }

  .route-option {
    padding: 1.2rem;
    overflow-x: hidden; /* Prevent horizontal scroll */
  }

  .price-highlight {
    font-size: 1.2rem;
  }

  .layover-info {
    font-size: 0.9rem;
  }

  .select2-results__options {
    max-width: 100%;
    word-break: break-word;
  }

  .select2-container--open .select2-dropdown {
    left: 0 !important;
    right: 0 !important;
  }

  .select2-container--default .select2-results > .select2-results__options {
    max-width: 100%;
    overflow-x: hidden;
  }

  .select2-result-airport__name,
  .select2-result-airport__country {
    word-break: break-word;
    max-width: calc(100% - 70px);
  }

  .header-logo {
    max-width: 100px !important;
  }

  .logo {
    max-height: 60px;
  }

  .logo-mobile {
    display: block !important;
  }

  .logo-desktop {
    display: none;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.8rem;
  }

  header p {
    font-size: 1rem;
  }

  .search-modal {
    padding: 1.2rem;
  }

  footer {
    margin-top: 3rem !important;
  }

  h2 {
    font-size: 1.5rem;
  }

  button {
    width: 100%;
    max-width: none;
  }

  .select2-result-airport__name {
    font-size: 0.9rem;
  }

  .select2-result-airport__country {
    font-size: 0.8rem;
  }

  .header-logo {
    max-width: 100px;
  }

  .logo {
    max-height: 40px;
  }

  .logo-mobile {
    display: block;
  }

  .logo-desktop {
    display: none;
  }
}

/* New container for the search form */
.search-container {
  width: 100%;
}

/* Footer styling */
footer {
  background-color: #f0f5fa;
  text-align: center;
  width: -webkit-fill-available;
  color: #576981;
  font-size: 0.9rem;
  border-top: 1px solid #e7edf5;
  position: relative;
  bottom: 0;
}

/* Styles for the results sections */
.results-section {
  margin-bottom: 2.5rem;
}

.results-section h3 {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eaeef5;
}

/* No results found */
.no-results {
  text-align: center;
  padding: 2rem;
  background-color: #f9fafc;
  border-radius: var(--border-radius);
  border: 1px dashed #d1e0f6;
}

.no-results h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.no-results p {
  color: #576981;
}

/* Layover information */
.layover-info {
  background-color: #f0f8ff;
  padding: 12px 15px;
  margin: 15px 0;
  border-radius: 8px;
  border-left: 3px solid var(--primary-color);
  color: #425466;
  font-size: 0.95rem;
}

.layover-info p {
  margin: 5px 0;
}

/* Price summary */
.price-summary {
  margin-top: 1.5rem;
  background-color: #fafbfd;
  padding: 15px;
  border-radius: 8px;
  border-top: 1px solid #eaeef5;
  overflow: hidden; /* Prevent overflow */
}

.price-details {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

.price-details p {
  margin: 5px 0;
  font-size: 0.95rem;
}

.price-original {
  font-weight: 500;
  text-decoration: line-through;
  color: #8c98a8;
}

.price-savings {
  color: #28a745;
  font-weight: 600;
  background-color: rgba(40, 167, 69, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Connecting flight option */
.connecting-option {
  border-left: 4px solid var(--primary-color);
  background-color: #f9fbfe;
}

/* Discount information */
.discount-info {
  margin-top: 3rem;
  padding: 1.5rem;
  background-color: #f0f7ff;
  border-radius: var(--border-radius);
  border: 1px solid #d1e0f6;
}

.discount-info h3 {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.discount-info p {
  color: #425466;
  margin: 0;
  line-height: 1.6;
}

/* Flight info section */
.flight-info {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

.flight-info p {
  margin: 5px 0;
  font-size: 0.95rem;
  color: #576981;
}

/* Date notice for flights found on different dates */
.date-notice {
  background-color: #fff3cd;
  color: #856404;
  padding: 12px 15px;
  margin-bottom: 20px;
  border-radius: var(--border-radius);
  border-left: 4px solid #ffeeba;
  font-size: 0.95rem;
}

.date-notice p {
  margin: 0;
}

/* Best option highlighting */
.best-option {
  border-left: 4px solid var(--accent-color);
  background-color: #f9fffd;
}

/* Mini vacation options styling */
.options-group-title {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: var(--primary-color);
  padding-bottom: 8px;
  border-bottom: 1px solid #eaeef5;
}

.connecting-option.mini {
  padding: 1rem;
  margin-bottom: 1rem;
}

.mini-flight-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 1rem 0;
}

.mini-flight-leg p,
.mini-hotel-details p {
  margin: 5px 0;
  font-size: 0.95rem;
}

.mini-flight-leg {
  padding: 10px;
  background-color: #f9fafc;
  border-radius: 8px;
}

.mini-hotel-details {
  padding: 10px;
  background-color: #f0f8ff;
  border-radius: 8px;
  border-left: 3px solid var(--primary-color);
}

.mini-price {
  margin-top: 1rem;
  margin-bottom: 0;
  padding: 10px;
  background-color: #f5f7fa;
}

.mini-price p {
  margin: 0;
  text-align: right;
  font-size: 0.95rem;
}

/* Hotel details styling */
.hotel-details {
  background-color: rgba(239, 239, 239, 0.4);
  border-left: 3px solid #ccc;
  padding: 10px;
  margin: 8px 0;
  border-radius: 4px;
  font-size: 0.9rem;
}

.hotel-small {
  font-size: 0.8rem;
  color: #8c98a8;
  margin-top: 4px;
  font-style: italic;
}

/* Responsive adjustments for mini vacation options */
@media (max-width: 768px) {
  .mini-flight-details {
    gap: 8px;
  }

  .options-group-title {
    font-size: 1rem;
  }

  .connecting-option.mini {
    padding: 12px;
    overflow-x: hidden; /* Prevent horizontal scroll */
  }

  .layover-info {
    padding: 10px;
  }

  .mini-price p {
    text-align: left;
  }

  .flight-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-logo {
    bottom: -10px;
    left: 5px;
  }

  .logo {
    max-height: 60px;
  }

  .logo-mobile {
    display: block;
  }

  .logo-desktop {
    display: none !important;
  }
}

@media (min-width: 769px) and (max-width: 1320px) {
  header {
    padding: 3rem 3rem;
  }
  .search-modal {
    max-width: 600px;
  }
  .header-logo {
    width: 600px;
    margin-left: auto !important;
    margin-right: auto !important;
    position: relative !important;
    bottom: 23px;
    right: 230px;
  }
}

@media (max-width: 480px) {
  .no-results {
    padding: 1.2rem;
  }

  .discount-info {
    padding: 1.2rem;
  }

  .mini-flight-leg p,
  .mini-hotel-details p {
    font-size: 0.9rem;
  }

  .date-notice {
    padding: 10px;
  }

  .header-logo {
    bottom: -12px;
    left: 5px;
  }

  .logo {
    max-height: 40px;
  }

  .logo-mobile {
    display: block;
  }

  .logo-desktop {
    display: none;
  }

  .header-logo {
    max-width: 65px !important;
  }
}

/* Fix the mobile viewport scrolling issue */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  height: 100dvh;
}

.select2-container .select2-dropdown {
  left: 0 !important;
}

.select2-dropdown {
  box-sizing: border-box;
}

.select2-results {
  max-width: 100%;
  overflow-x: hidden;
}

.header-logo {
  position: relative;
  z-index: 2;
  display: block;
  max-width: 200px;
  margin: 0;
}

.logo {
  width: 100%;
  height: auto;
  max-height: 80px;
  object-fit: contain;
}

.logo-mobile {
  display: none;
}

.logo-desktop {
  display: block;
}

/* Route path styling */
.route-path {
  margin-top: 5px;
  margin-bottom: 15px;
  color: #425466;
  font-weight: 500;
  font-size: 1.1rem;
}

.route-option h3 {
  margin-bottom: 0;
}

.connection-time {
  color: #0077cc;
  font-weight: 500;
  margin-top: 0.5rem;
  display: inline-block;
  background-color: rgba(0, 119, 204, 0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

.mini-connection-info {
  background-color: rgba(0, 119, 204, 0.05);
  padding: 0.8rem;
  border-radius: 8px;
  margin: 0.5rem 0;
}

.mini-connection-info p {
  margin: 0.3rem 0;
}

.mini-connection-info p:first-child {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.connection-warning {
  background-color: rgba(255, 193, 7, 0.15);
  color: #856404;
  border-left: 3px solid #ffc107;
  position: relative;
  padding-left: 30px;
  margin: 8px 0;
  border-radius: 4px;
  padding: 8px 8px 8px 35px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-weight: 500;
}

.connection-warning::before {
  content: "⚠️";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}

.mini-connection-info.connection-warning {
  background-color: rgba(255, 193, 7, 0.15);
  border-left: 3px solid #ffc107;
  padding-left: 30px;
  position: relative;
  border-radius: 4px;
  padding: 8px 8px 8px 35px;
  margin: 8px 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.mini-connection-info.connection-warning::before {
  content: "⚠️";
  position: absolute;
  left: 10px;
  top: 15px;
}

.mini-connection-info.connection-warning p {
  color: #856404;
  font-weight: 500;
}
