/* Import Montserrat font from Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap");

/* Import ABCFavorite font */
@font-face {
  font-family: "ABC Favorite";
  src: url("fonts/ABCFavorite/Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: "Montserrat", Arial, sans-serif;
  margin: 0;
  background-color: #f5f5f5;
}

/* Apply ABC Favorite font to all headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "ABC Favorite", "Montserrat", sans-serif;
}

.app-container__logo {
  background: black;
  justify-content: center;
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.price-estimator__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  img {
    width: 40px;
    position: absolute;
    left: 0;
    top: 0;
  }
}

/* Price Estimator Block */
.price-estimator {
  max-width: 800px;
  margin: 20px auto;
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
}

.price-estimator__title {
  color: black;
  text-align: center;
  font-family: "ABC Favorite", "Montserrat", sans-serif;
}

/* Price Form Block */
.price-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.price-form__group {
}

.price-form__label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #333;
  font-family: "ABC Favorite", "Montserrat", sans-serif;
}

.price-form__input,
.price-form__select {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.2s ease;
  font-family: "Montserrat", sans-serif;
}

.price-form__input:focus,
.price-form__select:focus {
  outline: none;
  border-color: #333;
}

.price-form__input--custom {
  display: none;
  margin-top: 5px;
}

/* Autocomplete and Select container styles */
.autocomplete-container,
.select-container {
  position: relative;
  width: 100%;
}

.autocomplete-dropdown {
  position: absolute;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  background-color: white !important;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 10;
  display: none;
}

.autocomplete-item {
  padding: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
  color: #333 !important;
  background-color: white !important;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background-color: #f5f5f5 !important;
}

.required {
  color: #ff1900;
}

/* Clear button styles */
.clear-button {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 18px;
  font-weight: bold;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  visibility: hidden;
  opacity: 0;
  z-index: 5;
}

.clear-button:hover {
  background-color: #f1f1f1;
  color: #666;
}

.clear-button.visible {
  visibility: visible;
  opacity: 1;
}

.autocomplete-container .price-form__input,
.select-container .price-form__select {
  padding-right: 36px;
}

.price-form__button {
  padding: 12px 24px;
  background-color: #ff1900;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: "ABC Favorite", sans-serif;
  margin-bottom: 10px;
  height: 50px;
  width: 100%;
}

.price-form__button:hover {
  background: #ff1900bd;
}

.price-form__button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Results Block */
.results {
}

.results__container {
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
  border-inline: 2px solid #ff1900;
}

.results__title {
  margin-top: 0;
  margin-bottom: 20px;
}

.results__price-highlight {
  font-size: 24px;
  font-weight: bold;
  color: black;
  text-align: center;
  margin: 20px 0;
  padding: 15px;
  background: white;
  font-family: "ABC Favorite", sans-serif;
  border-radius: 8px;
}

/* Sorting Controls Block */
.sorting-controls {
  margin: 20px 0;
  padding: 15px;
  background: white;
  border-radius: 8px;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.sorting-controls__label {
  font-weight: bold;
  color: #333;
  margin: 0;
  font-family: "ABC Favorite", "Montserrat", sans-serif;
}

.sorting-controls__select {
  width: auto;
  min-width: 120px;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.2s ease;
  font-family: "Montserrat", sans-serif;
}

.sorting-controls__button {
  background: #ff1900;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  width: auto;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.sorting-controls__button:hover {
  background: #ff1900c0;
}

/* Listing Block */
.listing {
  margin: 15px 0;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
}

.listing__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.listing__title {
  margin: 0;
  flex: 1;
  color: #333;
}

.listing__logo {
  height: 40px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  margin-left: 15px;
  border-radius: 4px;
  border: 1px solid #eee;
  padding: 5px;
  background: white;
}

.listing__details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}

.listing__detail-item {
  margin: 0;
}

.listing__link {
  text-align: center;
  margin-top: 10px;
}

.listing__link-anchor {
  color: #2196f3;
  text-decoration: none;
  font-weight: bold;
}

.listing__link-anchor:hover {
  text-decoration: underline;
}

/* Utility Classes */
.loading {
  text-align: center;
  color: #666;
  font-style: italic;
}

.error {
  background: #ffebee;
  color: #c62828;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid #c62828;
  margin: 20px 0;
  font-size: 16px;
  text-align: center;
  font-weight: 500;
}

/* Chart Container Block */
.chart-container {
  margin-top: 30px;
  padding: 20px;
  background: white;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.chart-container__title {
  margin-top: 0;
  color: #333;
  text-align: center;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 30px;
}

#priceChart,
#priceYearChart {
  max-height: 400px;
}

/* Media Queries */
@media (max-width: 600px) {
  .price-form__grid,
  .listing__details {
    grid-template-columns: 1fr;
  }

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

  .listing__logo {
    margin-left: 0;
    margin-top: 10px;
    align-self: flex-start;
  }

  .sorting-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* Loader Styles */
.loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  border-radius: 10px;
}

.animateLoader {
  display: flex;
  justify-content: center;
  align-items: center;
  animation: pulse 1.5s infinite ease-in-out;
}

.loader__img {
  width: 60px;
  height: 60px;
}

@keyframes pulse {
  0% {
    transform: scale(0.8);
    opacity: 0.7;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.8);
    opacity: 0.7;
  }
}

/* Password Protection Styles */
.password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.password-container {
  background-color: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.password-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.password-logo {
  width: 60px;
  height: 60px;
  margin-bottom: 10px;
}

.password-form-group {
  margin-bottom: 20px;
}

.password-form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #333;
  font-family: "ABC Favorite", "Montserrat", sans-serif;
}

.password-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.2s ease;
  font-family: "Montserrat", sans-serif;
}

.password-input:focus {
  outline: none;
  border-color: #333;
}

.password-button {
  padding: 12px 24px;
  background-color: #ff1900;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: "ABC Favorite", sans-serif;
  height: 50px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-button:hover {
  background: #ff1900bd;
}

.password-error {
  color: #ff1900;
  margin-top: 10px;
  text-align: center;
  font-weight: 500;
}
