/* Local UI patch v2: pricing plan borders/current-state color and profile plan heading layout. */

/*
 * Pricing card borders: use a distinct, visible identity color for every plan,
 * matching the reference layout while preserving the existing backgrounds/effects.
 */
.pricing-page .price-card[data-plan-card] {
  border-width: 1.5px !important;
  border-style: solid !important;
}

.pricing-page .price-card[data-plan-card="free"] {
  border-color: #38527f !important;
}

.pricing-page .price-card[data-plan-card="personal"] {
  border-color: #2f80ed !important;
}

.pricing-page .price-card[data-plan-card="firm"] {
  border-color: #20a464 !important;
}

.pricing-page .price-card[data-plan-card="team"] {
  border-color: #8b5cf6 !important;
}

.pricing-page .price-card[data-plan-card="plus"] {
  border-color: #e0a11a !important;
}

/* The active card keeps its plan-colored gradient border. */
.pricing-page .price-card.current-plan-card:not([data-plan-card="free"]) {
  border: 1.5px solid transparent !important;
}

/* Current-plan badge: clear green active state. */
.pricing-page .price-card:not([data-plan-card="free"]) .current-plan-marker {
  color: #166534;
  border-color: #86efac;
  background: #f0fdf4;
}

.pricing-page .price-card:not([data-plan-card="free"]) .current-plan-marker::before {
  background: #22c55e;
}

/*
 * Profile card heading:
 * left column = "当前套餐" above plan version;
 * right column = plan badge.
 * Explicit nowrap overrides the retained-entitlements rule in profile-plan-effects.css.
 */
.profile-current-plan-card .profile-plan-heading {
  display: flex !important;
  flex-flow: row nowrap !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 16px !important;
  width: 100%;
}

.profile-current-plan-card .profile-plan-heading-copy {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.profile-current-plan-card .profile-plan-heading-copy > strong {
  flex: none;
  color: #0f172a;
  font-size: 15px;
}

.profile-current-plan-card .profile-plan-heading #profilePlan {
  margin: 0;
  line-height: 1.15;
}

.profile-current-plan-card .profile-plan-heading .profile-plan-badge {
  flex: 0 0 auto;
  align-self: flex-start;
  max-width: 46%;
  margin: 0;
  white-space: nowrap;
  overflow-wrap: normal;
  text-align: left;
}

@media (max-width: 420px) {
  .profile-current-plan-card .profile-plan-heading {
    gap: 10px !important;
  }

  .profile-current-plan-card .profile-plan-heading-copy {
    gap: 10px;
  }

  .profile-current-plan-card .profile-plan-heading .profile-plan-badge {
    max-width: 50%;
    padding-inline: 8px;
    font-size: 10px;
  }
}


/* v3: keep the Plus border as visible as the other plan borders, including when active. */
.pricing-page .price-card[data-plan-card="plus"],
.pricing-page .price-card.current-plan-card[data-plan-card="plus"] {
  border: 2px solid #d59a08 !important;
  background:
    radial-gradient(circle at 86% 17%, rgba(212, 167, 44, 0.14) 0 1px, transparent 2px),
    radial-gradient(circle at 94% 29%, rgba(91, 33, 182, 0.13) 0 1px, transparent 2px),
    radial-gradient(circle at 92% 8%, rgba(126, 34, 206, 0.12), transparent 32%),
    #ffffff !important;
}

/* v3: let the plan label pill size itself to its full text. */
.profile-current-plan-card .profile-plan-heading .profile-plan-badge {
  width: max-content;
  min-width: max-content;
  max-width: none;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

/* v3: avatar corner badges use the same symbols as the plan-label badge. */
.profile-avatar-card[data-plan]::after {
  min-width: 30px;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.profile-avatar-card[data-plan="free"]::after {
  content: "●";
  color: #475569;
  border-radius: 50%;
  background: #e2e8f0;
  box-shadow: 0 8px 18px rgba(71, 85, 105, 0.18);
}

.profile-avatar-card[data-plan="personal"]::after {
  content: "◇";
  border-radius: 8px;
}

.profile-avatar-card[data-plan="firm"]::after {
  content: "▦";
  border-radius: 7px;
}

.profile-avatar-card[data-plan="team"]::after {
  content: "✦";
  min-width: 30px;
  width: 30px;
  height: 30px;
  border-radius: 7px 7px 10px 10px;
}

.profile-avatar-card[data-plan="plus"]::after {
  content: "⬢";
  min-width: 30px;
  width: 30px;
  height: 30px;
}

@media (max-width: 420px) {
  .profile-current-plan-card .profile-plan-heading .profile-plan-badge {
    min-width: max-content;
    max-width: none;
    padding-inline: 8px;
    font-size: 9px;
  }
}


/* v4: the free plan has no avatar corner badge. */
.profile-avatar-card[data-plan="free"]::after {
  content: none !important;
  display: none !important;
}

/* v4: richer Plus-plan usage-panel rendering. */
.profile-usage-panel[data-plan="plus"] {
  isolation: isolate;
  border-color: rgba(168, 85, 247, 0.55);
  background:
    radial-gradient(circle at 12% 10%, rgba(168, 85, 247, 0.18), transparent 30%),
    radial-gradient(circle at 88% 16%, rgba(250, 204, 21, 0.17), transparent 27%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(250, 245, 255, 0.94));
  box-shadow:
    0 24px 65px rgba(91, 33, 182, 0.18),
    0 0 0 1px rgba(212, 167, 44, 0.08) inset;
}

.profile-usage-panel[data-plan="plus"]::before,
.profile-usage-panel[data-plan="plus"]::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.profile-usage-panel[data-plan="plus"]::before {
  inset: -35%;
  background:
    conic-gradient(
      from 20deg,
      transparent 0deg,
      rgba(126, 34, 206, 0.16) 55deg,
      transparent 115deg,
      rgba(212, 167, 44, 0.15) 180deg,
      transparent 245deg,
      rgba(59, 130, 246, 0.12) 310deg,
      transparent 360deg
    );
  filter: blur(34px);
  animation: plus-usage-aurora-spin 14s linear infinite;
}

.profile-usage-panel[data-plan="plus"]::after {
  inset: 0;
  z-index: 0;
  opacity: 0.48;
  background-image:
    radial-gradient(circle, rgba(126, 34, 206, 0.55) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(212, 167, 44, 0.5) 0 1px, transparent 1.8px);
  background-position: 14% 18%, 78% 28%;
  background-size: 82px 82px, 116px 116px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 72%);
  animation: plus-usage-stars-drift 10s ease-in-out infinite alternate;
}

.profile-usage-panel[data-plan="plus"] > * {
  position: relative;
  z-index: 1;
}

.profile-usage-panel[data-plan="plus"] .profile-usage-item {
  position: relative;
  overflow: hidden;
  border-color: rgba(192, 132, 252, 0.48) !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(250, 245, 255, 0.76)) !important;
  box-shadow:
    0 12px 28px rgba(91, 33, 182, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  transition:
    transform 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

.profile-usage-panel[data-plan="plus"] .profile-usage-item::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    transparent 20%,
    rgba(255, 255, 255, 0.74) 42%,
    rgba(212, 167, 44, 0.2) 50%,
    transparent 66%
  );
  transform: translateX(-125%);
  animation: plus-usage-card-sheen 6.4s ease-in-out infinite;
}

.profile-usage-panel[data-plan="plus"] .profile-usage-item:nth-child(2)::before {
  animation-delay: 1.1s;
}

.profile-usage-panel[data-plan="plus"] .profile-usage-item:nth-child(3)::before {
  animation-delay: 2.2s;
}

.profile-usage-panel[data-plan="plus"] .profile-usage-item:hover {
  transform: translateY(-4px) scale(1.012);
  border-color: rgba(212, 167, 44, 0.72) !important;
  box-shadow:
    0 18px 38px rgba(91, 33, 182, 0.16),
    0 0 24px rgba(212, 167, 44, 0.12);
}

.profile-usage-panel[data-plan="plus"] .profile-usage-line strong {
  background: linear-gradient(100deg, #111827 5%, #5b21b6 48%, #b7791f 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 8px 22px rgba(91, 33, 182, 0.09);
}

.profile-usage-panel[data-plan="plus"] .profile-usage-item > span,
.profile-usage-panel[data-plan="plus"] .profile-usage-item > small {
  color: #5b21b6;
  text-shadow: 0 0 18px rgba(126, 34, 206, 0.16);
}

@keyframes plus-usage-aurora-spin {
  to {
    transform: rotate(360deg) scale(1.08);
  }
}

@keyframes plus-usage-stars-drift {
  from {
    transform: translate3d(-8px, -5px, 0);
    opacity: 0.32;
  }
  to {
    transform: translate3d(12px, 10px, 0);
    opacity: 0.62;
  }
}

@keyframes plus-usage-card-sheen {
  0%,
  62% {
    transform: translateX(-125%);
  }
  82%,
  100% {
    transform: translateX(125%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-usage-panel[data-plan="plus"]::before,
  .profile-usage-panel[data-plan="plus"]::after,
  .profile-usage-panel[data-plan="plus"] .profile-usage-item::before {
    animation: none !important;
  }

  .profile-usage-panel[data-plan="plus"] .profile-usage-item {
    transition: none;
  }
}
