/* Base popup styles */
.popup-made-visible {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-color: white;
  border: 4px solid #408074;
  border-radius: 10px;
  transition: all 0.3s ease;
  overflow: hidden;
  box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
}

/* Tab that's always visible */
.popup-tab {
  color: black;
  font-size: large !important;
  padding: 8px 16px;
  cursor: pointer;
  text-align: center;
  font-weight: bold;
  font-size: 14px;
  order: -2; /* Always appears at top */
  transition: background-color 0.3s ease;
}

.popup-tab:hover {
  background-color: #615e9b;
   color: white;
}

/* Close button */
.popup-close {
  color: black;
  border: none;
  background-color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 10;
  order: -1;
  transition: background-color 0.3s ease;
}

.popup-close:hover {
  background: #c82333;
 
}

/* Open state */
.popup-open {
  padding: 1rem;
  max-height: 400px;
  width: 300px;
}

.popup-open .popup-tab {
  pointer-events: none; /* Disable clicking when open */
  cursor: default;
  border-bottom: 1px dotted #615e9b;
}

/* Closed state */
.popup-closed {
  padding: 0;
  max-height: fit-content;
  width: 120px;
  border: 4px solid #408074;
}

.popup-closed .popup-close {
  display: none;
}

.popup-closed > *:not(.popup-tab) {
  display: none;
}

.popup-closed .popup-tab {
  margin: 0;
}

/* Form styling */
#block-finance-popupsurvey .js-form-type-webform-rating {
  display: flex;
  flex-direction: column;
}

#block-finance-popupsurvey legend {
  line-height: 1;
}

#block-finance-popupsurvey  {
  text-align: center;
}

/* Last question */
.anything-else-wrapper {
 border-top: 1px dotted #615e9b;
 padding-top: 0.25rem; 
 display: inherit;
}

textarea[data-drupal-selector="edit-what-can-we-improve-to-make-your-experience-better"] {
  max-height: 70px;
}

/* Accessibility  */

 #block-finance-popupsurvey:has(.popup-tab:focus),
.popup-close:focus,
input[type="range"]:focus + .rateit 
 {
  outline:4px solid #64ccc9;
}
 
.popup-closed .popup-tab:focus {
  background-color: #005a87;
  color: white;
}
