/* Smart Popup System Styles */

.smart-popup {
  position: fixed;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 10000;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
  min-height: 80px; /* Fixed minimum height for all popups */
  height: 80px; /* Fixed height for all popups */
  display: flex;
  align-items: center;
}

.smart-popup.show {
  opacity: 1;
  transform: translateY(0);
}

/* Position variants */
.smart-popup[data-position="bottom-right"] {
  bottom: calc(20px + var(--bottom-offset, 0px));
  right: 20px;
}

.smart-popup[data-position="bottom-left"] {
  bottom: calc(20px + var(--bottom-offset, 0px));
  left: 20px;
}

.smart-popup[data-position="top-right"] {
  top: 20px;
  right: 20px;
}

.smart-popup[data-position="top-left"] {
  top: 20px;
  left: 20px;
}

.smart-popup[data-position="center"] {
  top: 50%;
  left: 50%;
  --offset-x: 0px;
  --offset-y: 0px;
  transform: translate(calc(-50% + var(--offset-x)), calc(-50% + var(--offset-y))) translateY(20px);
  max-width: 520px;
  width: 90%;
}

.smart-popup[data-position="center"].show {
  transform: translate(calc(-50% + var(--offset-x)), calc(-50% + var(--offset-y))) translateY(0);
}

.popup-content {
  position: relative;
  padding: 24px 28px;
  text-align: center;
  min-width: 0; /* Allow content to shrink */
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Mission statement popup - more padding for better spacing */
#popup-mission-statement .popup-content {
  padding: 28px 32px;
}

#popup-mission-statement {
  min-height: 90px;
  height: auto;
}

#popup-mission-statement .popup-text {
  padding-right: 0;
}

.smart-popup[data-position="bottom-left"] .popup-content,
.smart-popup[data-position="bottom-right"] .popup-content {
  padding: 16px 40px 16px 16px;
  text-align: left;
  overflow: hidden;
  justify-content: flex-start;
}

.popup-close {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.popup-close:hover {
  background: rgba(0,0,0,.1);
  color: #0f172a;
}

.popup-close:focus,
.popup-close:active {
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.popup-text {
  margin: 0;
  padding-right: 24px;
  font-size: 1.05rem;
  line-height: 1.6;
  color: #0f172a;
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif !important;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.popup-text-small {
  font-size: 0.9rem !important;
  padding-right: 0 !important;
  white-space: normal !important;
  line-height: 1.4 !important;
  text-align: left !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  max-width: 100% !important;
}

.popup-link {
  color: #0a7cff;
  text-decoration: none;
  font-weight: 500;
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif !important;
}

.popup-link:hover {
  text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .smart-popup {
    max-width: calc(100% - 32px) !important;
    width: calc(100% - 32px);
  }
  
  /* Stack ALL popups at bottom-left on mobile */
  .smart-popup[data-position="bottom-right"],
  .smart-popup[data-position="bottom-left"],
  .smart-popup[data-position="top-right"],
  .smart-popup[data-position="top-left"],
  .smart-popup[data-position="center"] {
    bottom: calc(16px + var(--bottom-offset, 0px)) !important;
    left: 16px !important;
    right: auto !important;
    top: auto !important;
    max-width: calc(100% - 32px) !important;
    width: calc(100% - 32px);
    transform: translateY(20px) !important;
  }
  
  .smart-popup[data-position="center"].show,
  .smart-popup[data-position="top-right"].show,
  .smart-popup[data-position="top-left"].show,
  .smart-popup[data-position="bottom-right"].show,
  .smart-popup[data-position="bottom-left"].show {
    transform: translateY(0) !important;
  }
  
  /* Consistent close button styling on mobile - all popups */
  .popup-close {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Adjust padding for mobile to accommodate close button */
  .smart-popup[data-position="bottom-left"] .popup-content,
  .smart-popup[data-position="bottom-right"] .popup-content {
    padding: 16px 44px 16px 16px;
    justify-content: flex-start;
  }
  
  .smart-popup {
    min-height: 80px;
    height: 80px;
  }
  
  /* Slightly larger text on mobile for readability */
  .popup-text {
    font-size: 0.95rem;
  }
}

