/* Personal Center — AI training background + icon automation */

/* Header button: never inherit dashboard link color */
.order-portal .mitsui-header a.mitsui-header_user-btn,
.order-portal .mitsui-header_user-btn {
  background: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  letter-spacing: 0.04em;
}

.order-portal .mitsui-header_user-btn:hover {
  background: linear-gradient(135deg, #6366f1 0%, #38bdf8 100%) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

/* —— AI training background —— */
.ai-training-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ai-training-bg__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

.ai-training-bg__grid {
  position: absolute;
  inset: -50%;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 47px,
      rgba(99, 102, 241, 0.06) 47px,
      rgba(99, 102, 241, 0.06) 48px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 47px,
      rgba(99, 102, 241, 0.06) 47px,
      rgba(99, 102, 241, 0.06) 48px
    );
  animation: aiGridDrift 24s linear infinite;
}

.ai-training-bg__scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(99, 102, 241, 0.12) 40%,
    rgba(14, 165, 233, 0.18) 50%,
    rgba(99, 102, 241, 0.12) 60%,
    transparent
  );
  animation: aiScanLine 4s ease-in-out infinite;
  opacity: 0.7;
}

.ai-training-bg__core {
  position: absolute;
  left: 50%;
  top: 38%;
  width: min(280px, 70vw);
  height: min(280px, 70vw);
  transform: translate(-50%, -50%);
}

.ai-training-bg__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(99, 102, 241, 0.25);
  animation: aiRingSpin 8s linear infinite;
}

.ai-training-bg__ring--b {
  inset: 12%;
  animation-duration: 12s;
  animation-direction: reverse;
  border-color: rgba(14, 165, 233, 0.3);
}

.ai-training-bg__ring--c {
  inset: 24%;
  animation-duration: 6s;
  border-color: rgba(167, 139, 250, 0.35);
}

.ai-training-bg__bot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(224, 231, 255, 0.9));
  box-shadow:
    0 0 40px rgba(99, 102, 241, 0.4),
    0 0 80px rgba(14, 165, 233, 0.2);
  display: grid;
  place-items: center;
  animation: aiBotPulse 2s ease-in-out infinite;
}

.ai-training-bg__bot svg {
  width: 32px;
  height: 32px;
  color: #6366f1;
  animation: aiBotIcon 3s ease-in-out infinite;
}

.ai-training-bg__pulse {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 80px;
  height: 80px;
  margin: -40px 0 0 -40px;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.4);
  animation: aiPulseRing 2.5s ease-out infinite;
}

.ai-training-bg__pulse--2 {
  animation-delay: 0.8s;
}

.ai-training-bg__data {
  position: absolute;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: rgba(99, 102, 241, 0.45);
  white-space: nowrap;
  animation: aiDataFloat 6s ease-in-out infinite;
}

.ai-training-bg__data--1 { left: 8%; top: 22%; animation-delay: 0s; }
.ai-training-bg__data--2 { right: 6%; top: 35%; animation-delay: -1.5s; }
.ai-training-bg__data--3 { left: 12%; bottom: 28%; animation-delay: -3s; }
.ai-training-bg__data--4 { right: 10%; bottom: 22%; animation-delay: -4.5s; }

.dashboard.order-portal.personal-center-page .dash-orb {
  opacity: 0.35;
}

.dashboard.order-portal.personal-center-page .dash {
  z-index: 2;
  padding-bottom: 0.5rem; /* Reduced from 2.5rem */
}

/* Compact footer for Personal Center */
.personal-center-page .mitsui-footer {
  padding-top: 30px;
  padding-bottom: 30px;
  margin-top: 0;
  background: transparent;
  border-top: 1px solid rgba(99, 102, 241, 0.1);
}

.personal-center-page .mitsui-footer_bottom {
  margin-top: 20px;
}

/* Quick actions — per-icon insane motion */
.qa__icon,
.row__icon {
  position: relative;
}

.qa__icon::after,
.row__icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid var(--icon-accent, #6366f1);
  opacity: 0.35;
  animation: iconOrbitPulse 2.5s ease-in-out infinite;
  pointer-events: none;
}

.qa:hover .qa__icon::after,
.row:hover .row__icon::after {
  opacity: 0.85;
}

.qa__icon::before {
  content: '';
  position: absolute;
  inset: 50%;
  width: 140%;
  height: 140%;
  margin: -70% 0 0 -70%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--icon-glow, rgba(99, 102, 241, 0.35)) 0%, transparent 70%);
  animation: iconGlowPulse 2s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.qa__icon svg,
.row__icon svg {
  position: relative;
  z-index: 2;
}

/* Quick actions — per-icon insane motion */
.qa--task {
  --icon-accent: #6366f1;
  --icon-accent-2: #a78bfa;
  --icon-glow: rgba(99, 102, 241, 0.5);
}

.qa--task .qa__icon {
  animation: qaBoxFloat 3s ease-in-out infinite;
}

.qa--task .qa__icon svg {
  animation: iconTaskInsane 2.4s ease-in-out infinite;
}

.qa--task .qa__icon path {
  stroke-dasharray: 40;
  animation: iconStrokeDash 2s ease-in-out infinite;
}

.qa--cs {
  --icon-accent: #0ea5e9;
  --icon-accent-2: #38bdf8;
  --icon-glow: rgba(14, 165, 233, 0.5);
}

.qa--cs .qa__icon {
  animation: qaBoxFloat 3.2s ease-in-out infinite 0.2s;
}

.qa--cs .qa__icon svg {
  animation: iconCsInsane 2s ease-in-out infinite;
}

.qa--topup {
  --icon-accent: #10b981;
  --icon-accent-2: #34d399;
  --icon-glow: rgba(16, 185, 129, 0.5);
}

.qa--topup .qa__icon svg {
  animation: iconTopupInsane 1.8s ease-in-out infinite;
}

.qa--withdraw {
  --icon-accent: #f59e0b;
  --icon-accent-2: #fbbf24;
  --icon-glow: rgba(245, 158, 11, 0.5);
}

.qa--withdraw .qa__icon svg {
  animation: iconWithdrawInsane 1.8s ease-in-out infinite;
}

/* Menu rows — data-icon specific */
.row[data-icon='withdraw-records'] {
  --icon-accent: #8b5cf6;
  --icon-glow: rgba(139, 92, 246, 0.4);
}

.row[data-icon='withdraw-records'] .row__icon svg {
  animation: iconRecordsInsane 2.5s ease-in-out infinite;
}

.row[data-icon='personal-info'] {
  --icon-accent: #6366f1;
  --icon-glow: rgba(99, 102, 241, 0.4);
}

.row[data-icon='personal-info'] .row__icon svg {
  animation: iconUserInsane 3s ease-in-out infinite;
}

.row[data-icon='login-password'] .row__icon svg {
  animation: iconPenInsane 2.2s ease-in-out infinite;
}

.row[data-icon='security-password'] .row__icon svg {
  animation: iconShieldInsane 2.8s ease-in-out infinite;
}

.row[data-icon='wallet'] .row__icon svg {
  animation: iconWalletInsane 2.4s ease-in-out infinite;
}

.row[data-icon='contract'] .row__icon svg {
  animation: iconDocInsane 2.6s ease-in-out infinite;
}

.row[data-icon='language'] .row__icon svg {
  animation: iconGlobeInsane 4s linear infinite;
}

.row[data-icon='logout'] .row__icon svg {
  animation: iconLogoutInsane 2s ease-in-out infinite;
}

.row[data-icon='wallet-balance'] .member-card__chev svg,
.member-card__row[data-action] .row__chev {
  animation: iconChevInsane 2s ease-in-out infinite;
}

/* Chevron on rows */
.row__chev {
  animation: chevNudge 2s ease-in-out infinite;
}

.row:hover .row__chev {
  animation: chevSlide 0.4s ease-in-out infinite;
}

/* Member card level pulse */
.member-card__value[data-level] {
  animation: levelPulse 2.5s ease-in-out infinite;
}

/* Active tap burst */
.qa__icon.is-burst::before,
.row__icon.is-burst::before {
  animation: iconBurst 0.5s ease-out forwards;
}

@keyframes aiGridDrift {
  to { transform: translate(48px, 48px); }
}

@keyframes aiScanLine {
  0%, 100% { top: -15%; opacity: 0.3; }
  50% { top: 85%; opacity: 0.85; }
}

@keyframes aiRingSpin {
  to { transform: rotate(360deg); }
}

@keyframes aiBotPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 40px rgba(99, 102, 241, 0.4); }
  50% { transform: translate(-50%, -50%) scale(1.06); box-shadow: 0 0 60px rgba(14, 165, 233, 0.5); }
}

@keyframes aiBotIcon {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

@keyframes aiPulseRing {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes aiDataFloat {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 0.7; transform: translateY(-8px); }
}

@keyframes iconOrbitPulse {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.08); }
}

@keyframes iconGlowPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 0.9; transform: scale(1.1); }
}

@keyframes qaBoxFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes iconStrokeDash {
  0%, 100% { stroke-dashoffset: 0; }
  50% { stroke-dashoffset: 20; }
}

@keyframes iconTaskInsane {
  0%, 100% { transform: rotate(0deg) scale(1); }
  20% { transform: rotate(-6deg) scale(1.08); }
  40% { transform: rotate(4deg) scale(0.95); }
  60% { transform: rotate(-3deg) scale(1.05); }
  80% { transform: rotate(2deg) scale(1); }
}

@keyframes iconCsInsane {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(25deg); }
}

@keyframes iconTopupInsane {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px) scale(1.1); }
  60% { transform: translateY(2px) scale(0.95); }
}

@keyframes iconWithdrawInsane {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(6px) scale(1.1); }
  60% { transform: translateY(-2px) scale(0.95); }
}

@keyframes iconRecordsInsane {
  0%, 100% { transform: scaleX(1); }
  50% { transform: scaleX(1.15); }
}

@keyframes iconUserInsane {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes iconPenInsane {
  0%, 100% { transform: rotate(0deg) translate(0, 0); }
  33% { transform: rotate(-12deg) translate(-2px, 2px); }
  66% { transform: rotate(8deg) translate(2px, -1px); }
}

@keyframes iconShieldInsane {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.6)); }
}

@keyframes iconWalletInsane {
  0%, 100% { transform: perspective(80px) rotateY(0deg); }
  50% { transform: perspective(80px) rotateY(18deg); }
}

@keyframes iconDocInsane {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes iconGlobeInsane {
  to { transform: rotate(360deg); }
}

@keyframes iconLogoutInsane {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

@keyframes iconChevInsane {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

@keyframes chevNudge {
  0%, 100% { transform: translateX(0); opacity: 0.5; }
  50% { transform: translateX(3px); opacity: 1; }
}

@keyframes chevSlide {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

@keyframes levelPulse {
  0%, 100% { color: var(--portal-text); }
  50% { color: var(--portal-accent); text-shadow: 0 0 20px rgba(99, 102, 241, 0.4); }
}

/* —— iOS Style Notifications —— */
.ios-notification {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  width: min(340px, 90vw);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-radius: 20px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.1),
    0 16px 32px rgba(0, 0, 0, 0.1);
  z-index: 10000;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  opacity: 0;
  pointer-events: none;
}

.ios-notification.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.ios-notification__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}

.ios-notification__content {
  flex: 1;
  min-width: 0;
}

.ios-notification__title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #000;
  margin-bottom: 0.15rem;
}

.ios-notification__body {
  font-size: 0.8rem;
  color: #333;
  line-height: 1.3;
}

.ios-notification__money {
  color: #10b981;
  font-weight: 700;
}

/* —— Training UI Highlights —— */
.training-reward-highlight {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-radius: 6px;
  font-weight: 800;
  font-family: 'IBM Plex Mono', monospace;
  transform: scale(1.1);
  animation: rewardPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes rewardPop {
  0% { transform: scale(1); }
  100% { transform: scale(1.2); text-shadow: 0 0 15px rgba(16, 185, 129, 0.4); }
}

@keyframes iconBurst {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.8); }
}

@media (prefers-reduced-motion: reduce) {
  .ai-training-bg__grid,
  .ai-training-bg__scan,
  .ai-training-bg__ring,
  .ai-training-bg__bot,
  .ai-training-bg__pulse,
  .ai-training-bg__data,
  .qa__icon,
  .qa__icon svg,
  .qa__icon path,
  .row__icon svg,
  .row__chev {
    animation: none !important;
  }
  .qa__icon::after,
  .row__icon::after {
    display: none;
  }
}
