/* Final interaction polish: auth buttons, custom dropdowns, softer chat colors, rocket success */

:root {
  --sai-glass-bg: rgba(248, 252, 255, .78);
  --sai-glass-bg-strong: rgba(255, 255, 255, .92);
  --sai-glass-border: rgba(118, 139, 178, .24);
  --sai-ink: #102033;
  --sai-muted: #64748b;
  --sai-accent-a: #7dd3fc;
  --sai-accent-b: #c4b5fd;
  --sai-accent-c: #86efac;
}

/* Login/Register: password action button straight and compact */
.auth-modern-page .input-with-action {
  position: relative !important;
  display: block !important;
  width: 100% !important;
}
.auth-modern-page .input-with-action input {
  width: 100% !important;
  padding-right: 112px !important;
  box-sizing: border-box !important;
}
.auth-modern-page .input-with-action button {
  position: absolute !important;
  top: 50% !important;
  right: 8px !important;
  transform: translateY(-50%) !important;
  width: auto !important;
  min-width: 88px !important;
  max-width: 96px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 12px !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  font-size: .84rem !important;
  letter-spacing: .01em !important;
  background: linear-gradient(135deg, rgba(125,211,252,.28), rgba(196,181,253,.24)) !important;
  color: #eaf6ff !important;
  border: 1px solid rgba(226,238,255,.24) !important;
  box-shadow: 0 10px 24px rgba(2,8,23,.18) !important;
}
.auth-modern-page .input-with-action button:hover {
  transform: translateY(-50%) translateY(-1px) !important;
  background: linear-gradient(135deg, rgba(125,211,252,.36), rgba(196,181,253,.32)) !important;
}
.auth-modern-page .input-with-action button:active {
  transform: translateY(-50%) scale(.985) !important;
}

/* Native selects that are upgraded remain accessible but visually replaced */
select.sai-native-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.sai-custom-select {
  position: relative !important;
  width: 100% !important;
  min-width: 0 !important;
  z-index: 2;
}
.sai-custom-select.is-open { z-index: 60 !important; }
.sai-custom-select__button {
  width: 100% !important;
  min-height: 46px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 12px 14px !important;
  border-radius: 16px !important;
  cursor: pointer !important;
  border: 1px solid rgba(128, 150, 184, .26) !important;
  background:
    linear-gradient(135deg, rgba(255,255,255,.82), rgba(241,247,255,.62)),
    radial-gradient(circle at 18% 0%, rgba(125,211,252,.18), transparent 38%) !important;
  color: #13243a !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .08) !important;
  font-weight: 750 !important;
  text-align: left !important;
  transform: none !important;
}
.sai-custom-select__button:hover {
  border-color: rgba(96, 165, 250, .42) !important;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .12) !important;
}
.sai-custom-select__button:active { transform: scale(.992) !important; }
.sai-custom-select__value {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  color: inherit !important;
}
.sai-custom-select__chevron {
  width: 28px !important;
  height: 28px !important;
  display: inline-grid !important;
  place-items: center !important;
  border-radius: 10px !important;
  flex: 0 0 auto !important;
  background: rgba(125, 211, 252, .14) !important;
  color: #334155 !important;
  transition: transform .18s ease, background .18s ease !important;
}
.sai-custom-select.is-open .sai-custom-select__chevron {
  transform: rotate(180deg) !important;
  background: rgba(196,181,253,.18) !important;
}
.sai-custom-select__menu {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: calc(100% + 8px) !important;
  max-height: 260px !important;
  overflow: auto !important;
  padding: 7px !important;
  border-radius: 18px !important;
  border: 1px solid rgba(128, 150, 184, .28) !important;
  background: rgba(255, 255, 255, .96) !important;
  backdrop-filter: blur(18px) saturate(150%) !important;
  box-shadow: 0 24px 65px rgba(15, 23, 42, .20) !important;
  transform-origin: top center !important;
  transform: translateY(-6px) scale(.98) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity .16s ease, transform .16s ease !important;
}
.sai-custom-select.is-open .sai-custom-select__menu {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
}
.sai-custom-select__option {
  width: 100% !important;
  min-height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 10px 11px !important;
  border-radius: 13px !important;
  border: 0 !important;
  background: transparent !important;
  color: #14233a !important;
  box-shadow: none !important;
  font-weight: 700 !important;
  text-align: left !important;
}
.sai-custom-select__option:hover,
.sai-custom-select__option.is-focused {
  background: linear-gradient(135deg, rgba(125,211,252,.18), rgba(196,181,253,.16)) !important;
  color: #0f172a !important;
}
.sai-custom-select__option.is-selected::after {
  content: "✓";
  color: #4f46e5;
  font-weight: 950;
}

/* Auth page variant: dropdowns in dark glass style */
.auth-modern-page .sai-custom-select__button {
  min-height: 52px !important;
  background: rgba(8, 18, 38, .64) !important;
  color: #edf6ff !important;
  border-color: rgba(226, 238, 255, .16) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 14px 34px rgba(0,0,0,.18) !important;
}
.auth-modern-page .sai-custom-select__menu {
  background: rgba(8, 18, 38, .96) !important;
  border-color: rgba(226, 238, 255, .17) !important;
}
.auth-modern-page .sai-custom-select__option {
  color: #edf6ff !important;
}
.auth-modern-page .sai-custom-select__option:hover,
.auth-modern-page .sai-custom-select__option.is-focused {
  background: linear-gradient(135deg, rgba(125,211,252,.20), rgba(196,181,253,.18)) !important;
  color: #ffffff !important;
}
.auth-modern-page .sai-custom-select__chevron {
  background: rgba(255,255,255,.08) !important;
  color: #edf6ff !important;
}

/* Stats+ custom dropdowns: premium controls */
.stats-plus-modern-panel .modern-select-label .sai-custom-select__button,
.admin-container .stats-plus-modern-panel .sai-custom-select__button {
  min-height: 52px !important;
  border-radius: 18px !important;
  background:
    linear-gradient(135deg, rgba(255,255,255,.90), rgba(237,245,255,.74)),
    radial-gradient(circle at 20% 20%, rgba(125,211,252,.20), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(196,181,253,.18), transparent 42%) !important;
  color: #0f172a !important;
}
.stats-plus-modern-panel .modern-select-label .sai-custom-select__menu {
  min-width: 100% !important;
}

/* Softer communication bubbles: only a light green/lilac touch */
.unified-message,
.sai-chat-message,
.sai2-chat-msg,
.message-bubble {
  background: linear-gradient(135deg, rgba(255,255,255,.88), rgba(248,250,252,.70)) !important;
  color: #122033 !important;
  border: 1px solid rgba(128, 150, 184, .24) !important;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .08) !important;
}
.unified-message.mine,
.unified-message.own,
.sai-chat-message.mine,
.sai2-chat-msg.mine,
.message-bubble.own {
  background:
    linear-gradient(135deg, rgba(220,252,231,.78), rgba(237,233,254,.68)),
    rgba(255,255,255,.74) !important;
  border-color: rgba(74, 222, 128, .22) !important;
  color: #122033 !important;
}
.unified-message.theirs,
.sai-chat-message.theirs,
.sai2-chat-msg.theirs {
  background:
    linear-gradient(135deg, rgba(250,245,255,.78), rgba(240,253,250,.68)),
    rgba(255,255,255,.76) !important;
  border-color: rgba(168, 85, 247, .18) !important;
  color: #122033 !important;
}
.unified-message small,
.sai-chat-message small,
.sai2-chat-msg small,
.message-bubble small {
  color: rgba(51, 65, 85, .70) !important;
}
.unified-message-avatar {
  box-shadow: 0 10px 22px rgba(15,23,42,.12) !important;
  border: 2px solid rgba(255,255,255,.76) !important;
}

/* Rocket registration success */
.auth-rocket-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: radial-gradient(circle at 50% 80%, rgba(125,211,252,.18), transparent 36%);
  opacity: 0;
  animation: rocketOverlayIn 1.35s ease forwards;
}
.auth-rocket-card {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 24px 28px;
  border-radius: 28px;
  background: rgba(8, 18, 38, .78);
  border: 1px solid rgba(226,238,255,.18);
  color: #edf6ff;
  box-shadow: 0 28px 80px rgba(0,0,0,.34);
  backdrop-filter: blur(18px) saturate(145%);
  transform: translateY(18px) scale(.96);
  animation: rocketCardFloat 1.25s cubic-bezier(.18,.8,.2,1) forwards;
}
.auth-rocket-icon {
  font-size: 3rem;
  filter: drop-shadow(0 12px 18px rgba(125,211,252,.30));
  animation: rocketLaunch 1.15s cubic-bezier(.2,.82,.2,1) forwards;
}
.auth-rocket-title { font-size: 1.25rem; font-weight: 950; }
.auth-rocket-subtitle { color: rgba(237,246,255,.74); font-size: .92rem; }
.auth-modern-page.auth-rocket .auth-form-wrap {
  animation: authFormLaunch .95s cubic-bezier(.18,.8,.22,1) forwards;
}
.auth-modern-page.auth-rocket .auth-side {
  animation: authSideGlow .9s ease forwards;
}

@keyframes rocketOverlayIn {
  0% { opacity: 0; }
  12% { opacity: 1; }
  78% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes rocketCardFloat {
  0% { transform: translateY(18px) scale(.96); opacity: 0; }
  18% { opacity: 1; }
  72% { transform: translateY(-8px) scale(1); opacity: 1; }
  100% { transform: translateY(-28px) scale(.98); opacity: 0; }
}
@keyframes rocketLaunch {
  0% { transform: translateY(16px) rotate(-12deg) scale(.8); }
  38% { transform: translateY(-6px) rotate(6deg) scale(1.08); }
  100% { transform: translateY(-110px) rotate(18deg) scale(.72); opacity: 0; }
}
@keyframes authFormLaunch {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  65% { transform: translateY(-22px) scale(.985) rotate(-1.2deg); opacity: .78; }
  100% { transform: translateY(-120vh) scale(.82) rotate(-7deg); opacity: 0; }
}
@keyframes authSideGlow {
  0% { filter: brightness(1); }
  100% { filter: brightness(1.18) saturate(1.18); }
}

@media (max-width: 720px) {
  .auth-modern-page .input-with-action input { padding-right: 104px !important; }
  .auth-modern-page .input-with-action button { min-width: 82px !important; max-width: 90px !important; font-size: .78rem !important; }
  .sai-custom-select__menu { max-height: 220px !important; }
}

/* Final requested polish: stable trainer management tile, rounded card clipping, long rocket launch */
.portal-card,
.stat-card,
.overhaul-hero,
.overhaul-section-card,
.summary-item,
.notification-item,
.recommendation-card,
.team-user-card,
.unified-shell,
.unified-sidebar,
.unified-chat-main,
.auth-card {
  overflow: hidden !important;
  background-clip: padding-box !important;
  isolation: isolate !important;
}
.portal-card::before,
.portal-card::after,
.stat-card::before,
.stat-card::after,
.overhaul-hero::before,
.overhaul-hero::after,
.summary-item::before,
.summary-item::after,
.nav-pill::before,
.nav-pill::after,
.icon-action-btn::before,
.icon-action-btn::after {
  border-radius: inherit !important;
  pointer-events: none !important;
}
.portal-card::after,
.stat-card::after,
.summary-item::after,
.nav-pill::after,
.icon-action-btn::after {
  opacity: 0 !important;
  content: none !important;
}
.portal-grid,
.stats-grid,
.portal-nav,
.overhaul-grid {
  overflow: visible !important;
}
.management-overview-card {
  border: 1px solid rgba(148, 163, 184, .24) !important;
  background:
    linear-gradient(145deg, rgba(255,255,255,.88), rgba(241,245,249,.68)),
    radial-gradient(circle at 18% 0%, rgba(196,181,253,.20), transparent 42%),
    radial-gradient(circle at 95% 20%, rgba(125,211,252,.16), transparent 34%) !important;
  box-shadow: 0 22px 55px rgba(15,23,42,.10) !important;
}
.management-overview-card .management-tile-icon {
  width: 44px;
  height: 44px;
  border-radius: 18px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(196,181,253,.36), rgba(125,211,252,.24));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 14px 32px rgba(99,102,241,.12);
  margin-bottom: 10px;
}
.management-overview-card .secondary-btn {
  margin-top: 14px;
  background: rgba(255,255,255,.62) !important;
  color: #102033 !important;
  border-color: rgba(148,163,184,.28) !important;
}

.notification-item[data-notification-id^="notification"] .notification-content strong,
.notification-item .notification-content strong {
  color: #102033 !important;
}
.notification-item .badge.status-pending,
.notification-item .badge {
  background: rgba(196,181,253,.18) !important;
  color: #334155 !important;
  border-color: rgba(148,163,184,.24) !important;
}

/* 5-7 second registration rocket launch with smoke */
.auth-rocket-launch-overlay {
  background:
    radial-gradient(circle at 50% 88%, rgba(125,211,252,.28), transparent 30%),
    radial-gradient(circle at 50% 12%, rgba(196,181,253,.22), transparent 38%),
    linear-gradient(180deg, rgba(2,6,23,.88), rgba(15,23,42,.78)) !important;
  animation: rocketOverlayLong 6.8s ease forwards !important;
  overflow: hidden;
}
.auth-rocket-launch-overlay .auth-rocket-card {
  position: absolute;
  bottom: 9vh;
  left: 50%;
  width: min(520px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 22px 26px !important;
  background: rgba(255,255,255,.12) !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  color: #f8fbff !important;
  backdrop-filter: blur(22px) saturate(150%) !important;
  animation: rocketMessageFloat 6.4s cubic-bezier(.2,.76,.2,1) forwards !important;
  text-align: center;
}
.auth-rocket-launch-overlay .auth-rocket-title {
  font-size: clamp(1.35rem, 2.8vw, 2.15rem) !important;
  letter-spacing: -.03em;
}
.auth-rocket-launch-overlay .auth-rocket-subtitle {
  color: rgba(248,250,252,.86) !important;
  font-size: clamp(.95rem, 1.6vw, 1.12rem) !important;
  line-height: 1.45;
}
.rocket-launch-stage {
  position: absolute;
  left: 50%;
  bottom: 14vh;
  width: 170px;
  height: 260px;
  transform: translateX(-50%);
  animation: rocketStageLaunch 6.2s cubic-bezier(.18,.82,.16,1) forwards;
  z-index: 2;
}
.rocket-launch-stage .auth-rocket-icon {
  position: absolute;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%) rotate(-10deg);
  font-size: clamp(4rem, 9vw, 6.8rem) !important;
  filter: drop-shadow(0 20px 28px rgba(125,211,252,.38));
  animation: rocketShake 1.15s ease-in-out infinite alternate !important;
}
.rocket-flame {
  position: absolute;
  left: 50%;
  bottom: 42px;
  width: 28px;
  height: 74px;
  transform: translateX(-50%);
  border-radius: 50% 50% 46% 46%;
  background: linear-gradient(180deg, #fff7ad, #fb923c 45%, #ef4444 78%, rgba(239,68,68,0));
  filter: blur(.2px) drop-shadow(0 0 30px rgba(251,146,60,.64));
  animation: flamePulse .42s ease-in-out infinite alternate;
}
.rocket-smoke {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 108px;
  height: 50px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255,255,255,.72), rgba(226,232,240,.32) 54%, transparent 72%);
  filter: blur(1px);
  opacity: .78;
}
.smoke-a { animation: smokePuffA 1.25s ease-out infinite; }
.smoke-b { animation: smokePuffB 1.45s ease-out infinite .18s; }
.smoke-c { animation: smokePuffC 1.7s ease-out infinite .32s; }
.rocket-stars span {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,.78);
  box-shadow: 0 0 16px rgba(255,255,255,.72);
  animation: starTwinkle 2.2s ease-in-out infinite alternate;
}
.rocket-stars span:nth-child(1) { left: 12%; top: 18%; animation-delay: .1s; }
.rocket-stars span:nth-child(2) { left: 24%; top: 46%; animation-delay: .6s; }
.rocket-stars span:nth-child(3) { left: 43%; top: 12%; animation-delay: .3s; }
.rocket-stars span:nth-child(4) { left: 67%; top: 22%; animation-delay: .9s; }
.rocket-stars span:nth-child(5) { left: 82%; top: 51%; animation-delay: .45s; }
.rocket-stars span:nth-child(6) { left: 54%; top: 64%; animation-delay: .75s; }
.auth-modern-page.auth-rocket .auth-form-wrap {
  animation: authFormRocketLong 5.7s cubic-bezier(.18,.82,.16,1) forwards !important;
}
.auth-modern-page.auth-rocket .auth-side {
  animation: authSideGlowLong 5.7s ease forwards !important;
}
@keyframes rocketOverlayLong {
  0% { opacity: 0; }
  8% { opacity: 1; }
  88% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes rocketMessageFloat {
  0% { opacity: 0; transform: translate(-50%, 22px) scale(.96); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  74% { opacity: 1; transform: translate(-50%, -6px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -34px) scale(.98); }
}
@keyframes rocketStageLaunch {
  0% { transform: translateX(-50%) translateY(28px) scale(.86); opacity: 0; }
  10% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
  38% { transform: translateX(-50%) translateY(-34px) scale(1.04); opacity: 1; }
  58% { transform: translateX(-50%) translateY(-38vh) scale(.96); opacity: 1; }
  86% { transform: translateX(-50%) translateY(-112vh) scale(.72); opacity: .8; }
  100% { transform: translateX(-50%) translateY(-130vh) scale(.62); opacity: 0; }
}
@keyframes rocketShake {
  0% { transform: translateX(-50%) rotate(-11deg) translateY(0); }
  100% { transform: translateX(-50%) rotate(-7deg) translateY(-5px); }
}
@keyframes flamePulse {
  0% { height: 58px; width: 24px; opacity: .76; }
  100% { height: 88px; width: 34px; opacity: 1; }
}
@keyframes smokePuffA {
  0% { transform: translateX(-50%) scale(.55); opacity: .68; }
  100% { transform: translateX(-90%) translateY(24px) scale(1.65); opacity: 0; }
}
@keyframes smokePuffB {
  0% { transform: translateX(-50%) scale(.55); opacity: .60; }
  100% { transform: translateX(-18%) translateY(30px) scale(1.95); opacity: 0; }
}
@keyframes smokePuffC {
  0% { transform: translateX(-50%) scale(.52); opacity: .58; }
  100% { transform: translateX(-62%) translateY(36px) scale(2.15); opacity: 0; }
}
@keyframes starTwinkle {
  0% { opacity: .24; transform: scale(.8); }
  100% { opacity: .9; transform: scale(1.35); }
}
@keyframes authFormRocketLong {
  0% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
  28% { transform: translateY(-18px) scale(.99) rotate(-.8deg); opacity: .92; }
  54% { transform: translateY(-42vh) scale(.92) rotate(-5deg); opacity: .64; }
  100% { transform: translateY(-132vh) scale(.72) rotate(-12deg); opacity: 0; }
}
@keyframes authSideGlowLong {
  0% { filter: brightness(1) saturate(1); }
  42% { filter: brightness(1.18) saturate(1.18); }
  100% { filter: brightness(.86) saturate(.95); }
}

/* Hide leftover square artefacts around rounded dashboard cards */
#overviewPanel .portal-card,
#overviewPanel .stat-card,
#overviewPanel .summary-item,
.portal-card.span-6,
.overhaul-section-card {
  clip-path: inset(0 round 24px) !important;
}
#overviewPanel .summary-item { clip-path: inset(0 round 18px) !important; }
