/**
 * @file
 * Takeda Clinical Trial Finder Modal Styles
 * Matches the exact Takeda brand design
 */
div#takeda-trial-finder-modal {
  font-family: "Montserrat Regular";
}

/* Modal Overlay */
.takeda-modal {
  display: none;
}

.takeda-modal.is-open {
  display: block;
}

/* Prevent body scroll when modal is open */
body.micromodal-open,
body:has(.takeda-modal.is-open) {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100vh;
}

html.micromodal-open,
html:has(.takeda-modal.is-open) {
  overflow: hidden !important;
}

.takeda-modal__overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  overflow-y: auto;
  padding: 20px;
}

/* Modal Container */
.takeda-modal__container {
  background: #ffffff;
  border-radius: 6px;
  max-width: 1100px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease-out;
  margin: auto;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Close Button */
.takeda-modal__close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #c41e3a;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 1;
}

.takeda-modal__close:hover {
  background: #fff5f5;
  transform: scale(1.1);
}

.takeda-modal__close svg {
  width: 24px;
  height: 24px;
}

/* Header */
.takeda-modal__header {
  padding: 40px 60px 0px;
}

.takeda-modal__title {
  font-size: 48px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* Content */
.takeda-modal__content {
  padding: 35px 60px 34px;
}

/* Form Layout */
.takeda-trial-form__fields {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 20px;
  align-items: end;
}

/* Form Field */
.takeda-trial-form__field {
  position: relative;
}

.takeda-trial-form__label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
}

/* Input Wrapper */
.takeda-trial-form__input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.takeda-trial-form__icon {
  position: absolute;
  left: 20px;
  color: #666666;
  pointer-events: none;
  z-index: 1;
}

/* Input Field */
.takeda-trial-form__input {
  width: 100%;
  height: 60px;
  padding: 0 20px 0 52px;
  border: 2px solid #cccccc;
  border-radius: 8px;
  font-size: 16px;
  color: #1a1a1a;
  background: #ffffff;
  transition: all 0.2s ease;
  font-family: inherit;
}

.takeda-trial-form__input:focus {
  outline: none;
  border-color: #c41e3a;
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.takeda-trial-form__input::placeholder {
  color: #999999;
}

.takeda-trial-form__field--keyword .takeda-trial-form__input:focus {
  border-color: #c41e3a;
}

/* Submit Button */
.takeda-trial-form__submit {
  height: 60px;
  padding: 0 40px;
  background: #c41e3a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.takeda-trial-form__submit:hover {
  background: #a01830;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

.takeda-trial-form__submit:active {
  transform: translateY(0);
}

.takeda-trial-form__submit svg {
  width: 20px;
  height: 20px;
}

/* Autocomplete Dropdown */
.takeda-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
}

.takeda-autocomplete-dropdown__item {
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid #f0f0f0;
}

.takeda-autocomplete-dropdown__item:first-child {
  background: #ffb6c1;
  color: #1a1a1a;
  font-weight: 600;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.takeda-autocomplete-dropdown__item:last-child {
  border-bottom: none;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.takeda-autocomplete-dropdown__item:not(:first-child):hover {
  background: #f8f8f8;
}

.takeda-autocomplete-dropdown__item:not(:first-child):active {
  background: #ffb6c1;
}

/* Google Places Autocomplete - Fix z-index and positioning */
.pac-container {
  z-index: 10001 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
  border: none !important;
  margin-top: 4px !important;
  font-family: "Montserrat Regular" !important;
  background: #ffffff !important;
  padding-top: 0 !important;
}

/* Add pink header to match keyword dropdown */
.pac-container::before {
  content: "Select a location";
  display: block;
  padding: 16px 20px;
  background: #ffb6c1;
  color: #1a1a1a;
  font-weight: 600;
  font-size: 16px;
  font-family: "Montserrat Regular";
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #f0f0f0;
}

/* Ensure pac-container appears above modal */
.takeda-modal.is-open ~ .pac-container {
  z-index: 10001 !important;
}

/* Style individual items */
.pac-item {
  padding: 16px 20px !important;
  border: none !important;
  border-bottom: 1px solid #f0f0f0 !important;
  cursor: pointer !important;
  font-size: 16px !important;
  line-height: 1.5 !important;
  display: flex !important;
  align-items: center !important;
  font-family: "Montserrat Regular" !important;
}

.pac-item:hover {
  background: #f8f8f8 !important;
}

.pac-item:last-child {
  border-bottom: none !important;
  border-radius: 0 0 8px 8px !important;
}

.pac-item:first-child {
  border-radius: 0 !important;
}

/* Style the matched text */
.pac-item-query {
  font-size: 16px !important;
  color: #1a1a1a !important;
  font-weight: 500 !important;
}

.pac-matched {
  font-weight: 700 !important;
  color: #c41e3a !important;
}

/* HIDE THE BUILDING ICONS */
.pac-icon {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
}

.pac-icon-marker {
  display: none !important;
}

/* Adjust spacing since icon is removed */
.pac-item {
  padding-left: 20px !important;
}

/* Additional location text (country, state) */
.pac-item span:last-child {
  color: #666666 !important;
  font-size: 13px !important;
}

/* Hide "powered by Google" logo */
.pac-logo:after {
  display: none !important;
}

.hdpi.pac-logo:after {
  display: none !important;
}

/* Fix positioning inside modal */
.takeda-modal__content .pac-container {
  position: absolute !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .takeda-trial-form__fields {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .takeda-modal__header {
    padding: 32px 40px 24px;
  }

  .takeda-modal__content {
    padding: 32px 40px 40px;
  }

  .takeda-modal__title {
    font-size: 36px;
  }
}

@media (max-width: 768px) {
  .takeda-modal__container {
    border-radius: 12px;
    max-width: 100%;
  }

  .takeda-modal__header {
    padding: 24px 24px 20px;
  }

  .takeda-modal__content {
    padding: 24px 24px 32px;
  }

  .takeda-modal__title {
    font-size: 28px;
  }

  .takeda-modal__close {
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
  }

  .takeda-trial-form__input,
  .takeda-trial-form__submit {
    height: 52px;
    font-size: 15px;
  }
}

/* Loading State */
.takeda-trial-form.is-loading .takeda-trial-form__submit {
  opacity: 0.7;
  cursor: not-allowed;
}

.takeda-trial-form.is-loading .takeda-trial-form__submit::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
/* Fix font for all Google Places dropdown text */
.pac-item,
.pac-item-query,
.pac-item span {
  font-family: "Montserrat Regular" !important;
}

.pac-item * {
  font-family: "Montserrat Regular" !important;
}
