/* =====================================================
   AEMILLIUS REFERRAL PROGRAM — Plugin Styles
   ===================================================== */
.aem-ref {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Hero */
.aem-ref-hero {
  background: linear-gradient(135deg, var(--text) 0%, #2a2a2e 100%);
  border-radius: 16px;
  padding: 36px 32px;
  text-align: center;
  color: #ffffff;
}

.aem-ref-hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  margin-bottom: 18px;
}

.aem-ref-hero-icon svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

html body .aem-ref .aem-ref-hero h2 {
  font-size: 24px !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  margin: 0 0 10px !important;
  text-align: center !important;
  line-height: 1.2 !important;
}

.aem-ref-hero p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* Link Card */
.aem-ref-link-card {
  background: var(--white);
  border: 1px solid #e5e5e8;
  border-radius: 16px;
  padding: 24px;
}

.aem-ref-link-card h3 {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  margin: 0 0 14px !important;
}

.aem-ref-link-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.aem-ref-link-input {
  flex: 1;
  border: 1px solid #e5e5e8 !important;
  border-radius: 8px !important;
  padding: 12px 16px !important;
  font-size: 14px !important;
  color: var(--text) !important;
  background: #f8f8fa !important;
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aem-ref-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  background: var(--text);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.aem-ref-copy-btn:hover {
  background: var(--accent);
}

.aem-ref-copy-btn.copied {
  background: #16a34a;
}

.aem-ref-copy-btn svg {
  flex-shrink: 0;
}

/* Share Buttons */
.aem-ref-share-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.aem-ref-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  color: #ffffff !important;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.aem-ref-share-btn:hover {
  transform: translateY(-1px);
  text-decoration: none !important;
}

.aem-ref-share-btn svg {
  flex-shrink: 0;
}

.aem-ref-share-btn--fb {
  background: #1877F2;
}

.aem-ref-share-btn--fb:hover {
  background: #0d65d9;
  color: #ffffff !important;
}

.aem-ref-share-btn--messenger {
  background: #0099FF;
}

.aem-ref-share-btn--messenger:hover {
  background: #007acc;
  color: #ffffff !important;
}

.aem-ref-share-btn--viber {
  background: rgb(102, 92, 167);
  /* Match SVG background #665ca7 */
}

.aem-ref-share-btn--viber:hover {
  background: rgb(86, 78, 140);
  color: #ffffff !important;
}

/* Tiers */
.aem-ref-tiers-card {
  background: var(--white);
  border: 1px solid #e5e5e8;
  border-radius: 16px;
  padding: 24px;
}

.aem-ref-tiers-card h3 {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  margin: 0 0 16px !important;
}

.aem-ref-tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.aem-ref-tier {
  position: relative;
  background: #f8f8fa;
  border: 2px solid #e5e5e8;
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.aem-ref-tier--active {
  border-color: var(--accent);
  background: linear-gradient(to bottom, rgba(212, 175, 55, 0.06), transparent);
}

.aem-ref-tier--current {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.aem-ref-tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #e5e5e8;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.aem-ref-tier--active .aem-ref-tier-badge {
  background: var(--accent);
  color: var(--white);
}

.aem-ref-tier-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aem-ref-tier-clients {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.aem-ref-tier-duration {
  font-size: 12px;
  color: var(--muted);
}

.aem-ref-tier-status {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: var(--white);
  padding: 3px 8px;
  border-radius: 4px;
}

.aem-ref-tier-status--done {
  background: #16a34a;
}

/* Active Discount Banner */
.aem-ref-active-discount {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(212, 175, 55, 0.02) 100%);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 16px;
  padding: 20px 24px;
}

.aem-ref-active-discount-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--accent);
  border-radius: 12px;
  flex-shrink: 0;
}

.aem-ref-active-discount-icon svg {
  width: 22px;
  height: 22px;
  color: var(--white);
}

.aem-ref-active-discount-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aem-ref-active-discount-info strong {
  font-size: 16px;
  color: var(--text);
}

.aem-ref-active-discount-info>span {
  font-size: 13px;
  color: var(--muted);
}

.aem-ref-coupon-code code {
  background: rgba(212, 175, 55, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0px !important;
}

button.aem-ref-copy-btn.aem-ref-copy-btn--small {
  color: var(--white) !important;
}

.aem-ref-active-discount-badge {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

/* Progress Card */
.aem-ref-progress-card {
  background: var(--white);
  border: 1px solid #e5e5e8;
  border-radius: 16px;
  padding: 24px;
}

.aem-ref-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.aem-ref-progress-header h3 {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  margin: 0 !important;
}

.aem-ref-progress-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.aem-ref-progress {
  display: flex;
  margin-bottom: 28px;
}

.aem-ref-progress-step {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.aem-ref-progress-line {
  width: 100%;
  height: 8px;
  background: #e5e5e8;
  border-radius: 0;
  margin-top: 8px;
  transition: all 0.3s ease;
}

.aem-ref-progress-step:first-child .aem-ref-progress-line {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.aem-ref-progress-step:last-child .aem-ref-progress-line {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.aem-ref-progress-step.active .aem-ref-progress-line {
  background: linear-gradient(90deg, var(--accent), #e6c84e);
}

.aem-ref-progress-dot {
  position: absolute;
  top: 0;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e5e5e8;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  z-index: 2;
  transition: all 0.3s ease;
}

.aem-ref-progress-step.active .aem-ref-progress-dot {
  background: var(--accent);
  color: var(--white);
}

/* History */
.aem-ref-history-card {
  background: var(--white);
  border: 1px solid #e5e5e8;
  border-radius: 16px;
  padding: 24px;
}

.aem-ref-history-card h3 {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  margin: 0 0 16px !important;
}

.aem-ref-history {
  display: flex;
  flex-direction: column;
}

.aem-ref-history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f2;
}

.aem-ref-history-item:last-child {
  border-bottom: none;
}

.aem-ref-history-avatar img {
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  object-fit: cover;
}

.aem-ref-history-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.aem-ref-history-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.aem-ref-history-date {
  font-size: 12px;
  color: var(--muted);
}

.aem-ref-history-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* Empty State */
.aem-ref-empty {
  background: var(--white);
  border: 1px solid #e5e5e8;
  border-radius: 16px;
  padding: 40px 24px;
  text-align: center;
}

.aem-ref-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: #f0f0f2;
  border-radius: 50%;
  margin-bottom: 14px;
}

.aem-ref-empty-icon svg {
  width: 28px;
  height: 28px;
  color: var(--muted);
}

.aem-ref-empty p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

/* Dashboard CTA */
.aem-ref-cta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--text) 0%, #2a2a2e 100%);
  border-radius: 16px;
  padding: 22px 28px;
  gap: 16px;
  margin-top: 16px;
}

.aem-ref-cta-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.aem-ref-cta-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  flex-shrink: 0;
}

.aem-ref-cta-icon svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.aem-ref-cta-left strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
}

.aem-ref-cta-left span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

.aem-ref-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  background: var(--accent) !important;
  color: var(--white) !important;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.aem-ref-cta-btn:hover {
  background: #d4bc6e !important;
  color: var(--white) !important;
  text-decoration: none !important;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 980px) {
  .aem-ref-tiers {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .aem-ref-tier {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    padding: 16px 18px;
  }

  .aem-ref-tier-badge {
    margin-bottom: 0;
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  .aem-ref-cta {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
  }

  .aem-ref-cta-btn {
    width: 100%;
    justify-content: center;
  }

  .aem-ref-active-discount {
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .aem-ref-hero {
    padding: 24px 18px;
  }

  .aem-ref-hero h2 {
    font-size: 20px !important;
  }

  .aem-ref-link-row {
    flex-direction: column;
  }

  .aem-ref-copy-btn {
    width: 100%;
    justify-content: center;
  }

  .aem-ref-share-row {
    flex-direction: column;
  }

  .aem-ref-share-btn {
    justify-content: center;
  }

  .aem-ref-cta-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* =====================================================
   WELCOME BANNER
   ===================================================== */
.aem-ref-welcome-banner {
  position: fixed;
  top: 47px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text, #3e3e3e);
  color: var(--white, #ffffff);
  padding: 14px 20px 14px 16px;
  border-radius: 50px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: max-content;
  max-width: 90vw;
  animation: aem-ref-slide-down 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease;
}

.aem-ref-welcome-banner__left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.aem-ref-welcome-banner__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent, #cbb162);
  border-radius: 50%;
  color: #fff;
  flex-shrink: 0;
}

.aem-ref-welcome-banner__content {
  line-height: 1.3;
}

.aem-ref-welcome-banner__title {
  display: block;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.aem-ref-welcome-banner__desc {
  opacity: 0.8;
  font-size: 13px;
}

.aem-ref-welcome-banner__close {
  background: transparent;
  border: none;
  color: #fff;
  opacity: 0.5;
  cursor: pointer;
  padding: 6px;
  margin-left: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.aem-ref-welcome-banner__close:hover {
  opacity: 1;
}

.aem-ref-welcome-banner__btn {
  background: var(--accent, #cbb162);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.aem-ref-welcome-banner__btn:hover {
  opacity: 0.9;
  color: #fff;
}

@keyframes aem-ref-slide-down {
  0% {
    transform: translate(-50%, -40px);
    opacity: 0;
  }

  100% {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .aem-ref-welcome-banner {
    top: auto;
    bottom: 24px;
    border-radius: 16px;
    padding: 16px;
    width: calc(100% - 32px);
    max-width: none;
    flex-direction: column;
    align-items: flex-start;
  }

  .aem-ref-welcome-banner__right {
    width: 100%;
    justify-content: space-between;
  }

  @keyframes aem-ref-slide-down {
    0% {
      transform: translate(-50%, 40px);
      opacity: 0;
    }

    100% {
      transform: translate(-50%, 0);
      opacity: 1;
    }
  }
}