/*
 * Referral invitation surfaces in the header: a popover anchored to the
 * desktop account icon, and a centred modal on mobile.
 *
 * Both are hidden until `referral-notification.js` has a campaign to show, so
 * nothing here depends on a Liquid setting and all of it is cacheable. The
 * header only keeps the declarations the merchant's colour settings feed.
 */

/* Hidden until the referral campaign is known. */
#referralNotification,
.referral-modal__toggle {
  display: none;
}

.referral-notification {
  position: absolute;
  top: 100%;
  right: 0;
  width: 280px;
  margin-top: 8px;
  padding: 16px;
  z-index: 1000;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  line-height: 1.4;
}

/* The pointer: a white triangle over a matching border-coloured one. */
.referral-notification::before,
.referral-notification::after {
  content: '';
  position: absolute;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
}

.referral-notification::before {
  top: -8px;
  border-bottom: 8px solid white;
}

.referral-notification::after {
  top: -9px;
  border-bottom: 8px solid #e0e0e0;
}

.referral-notification h4 {
  margin: 0 0 8px 0;
  color: #2196f3;
  font-size: 16px;
  font-weight: 600;
}

.referral-notification p {
  margin: 0 0 12px 0;
  color: #666;
}

.referral-notification .referral-code {
  margin: 8px 0;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #f5f5f5;
  font-family: monospace;
  font-size: 13px;
  text-align: center;
}

.referral-notification .close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: none;
  color: #999;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.referral-notification .close-btn:hover {
  color: #333;
}

.referral-notification .action-btn {
  margin-top: 8px;
  margin-right: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background: #2196f3;
  color: white;
  cursor: pointer;
  font-size: 12px;
}

.referral-notification .action-btn:hover {
  background: #1976d2;
}

.referral-notification .dismiss-btn {
  margin-top: 8px;
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: transparent;
  color: #666;
  cursor: pointer;
  font-size: 12px;
}

.referral-notification .dismiss-btn:hover {
  background: #f5f5f5;
}

.referral-notification__media,
.referral-notification__actions {
  text-align: center;
}

.referral-notification__media {
  margin-bottom: 16px;
}

.referral-notification__image {
  width: 100px;
  height: 100px;
  margin: 0 auto;
}

.referral-notification__message {
  margin: 0 0 20px;
  color: #666;
  font-size: 14px;
  text-align: center;
}

.referral-notification__button,
.referral-modal__button {
  width: 100%;
}

.referral-modal__dialog {
  position: fixed;
  top: 20vh;
  left: 50%;
  width: 100%;
  max-width: 350px;
  padding: 20px;
  z-index: 10000;
  border-radius: 12px;
  background-color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: #000;
  text-align: center;
  transform: translate(-50%, 0);
  transition: transform var(--duration-default) ease, visibility 0s;
}

.modal-overlay.referral-modal-overlay {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2001;
  background-color: rgba(0, 0, 0, 0.7);
  opacity: 1;
  transition: opacity var(--duration-default) ease, visibility 0s;
}

.referral-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 24px;
}

.referral-modal__media {
  margin-bottom: 24px;
}

.referral-modal__image-wrapper {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
}

.referral-modal__image {
  width: 100%;
  height: 100%;
}

.referral-modal__message {
  margin: 0 0 30px;
  color: #333;
  font-size: 16px;
  line-height: 1.5;
}
