/* Smile / Cup steam / Signal loaders — ported from schedule app */

/* ── SmileLoader (как в расписании) ── */
.smile-loader {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto 0.45rem;
  color: #2f2a26;
}

.smile-loader--xs {
  width: 36px;
  height: 36px;
  margin: 0;
}
.smile-loader--sm { width: 72px; height: 72px; }
.smile-loader--md { width: 96px; height: 96px; }
.smile-loader--lg { width: 116px; height: 116px; }
.smile-loader--xs .smile-loader__ring {
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.2px));
  filter: drop-shadow(0 2px 4px rgba(47, 138, 42, 0.18));
}

/* В кнопках смайлик размером с текст — не раздувает кнопку до 36/96px */
button .smile-loader,
.btn-prim .smile-loader,
.btn-sec .smile-loader,
.btn-primary .smile-loader,
.profile-panel__cta .smile-loader,
.auth-lite__submit .smile-loader,
.btn-busy .smile-loader {
  width: 1.15em;
  height: 1.15em;
  margin: 0;
  flex: 0 0 auto;
}
button .smile-loader .smile-loader__ring,
.btn-prim .smile-loader .smile-loader__ring,
.btn-sec .smile-loader .smile-loader__ring,
.btn-primary .smile-loader .smile-loader__ring,
.profile-panel__cta .smile-loader .smile-loader__ring,
.auth-lite__submit .smile-loader .smile-loader__ring,
.btn-busy .smile-loader .smile-loader__ring {
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.4px));
  filter: drop-shadow(0 1px 2px rgba(47, 138, 42, 0.18));
}
.chat-members-empty--wait {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.smile-loader__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-sizing: border-box;
  background:
    conic-gradient(
      from 0deg,
      var(--primary-dark, #2f8a2a) 0deg,
      #7ed275 90deg,
      rgba(76, 175, 69, 0.12) 150deg,
      rgba(76, 175, 69, 0.08) 360deg
    );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  animation: smile-spin 0.9s linear infinite;
  filter: drop-shadow(0 4px 10px rgba(47, 138, 42, 0.22));
}

.smile-loader__face {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  overflow: visible;
  color: #2f2a26;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95) 0%, transparent 42%),
    radial-gradient(circle at 70% 78%, rgba(47, 138, 42, 0.1) 0%, transparent 45%),
    linear-gradient(165deg, #ffffff 0%, #eef8eb 48%, #dcebda 100%);
  box-shadow:
    0 10px 22px rgba(47, 138, 42, 0.18),
    0 2px 4px rgba(28, 25, 23, 0.06),
    inset 0 2px 4px rgba(255, 255, 255, 0.85),
    inset 0 -6px 12px rgba(47, 138, 42, 0.1);
}

.smile-loader__eye {
  position: absolute;
  top: 34%;
  width: 11%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #1c1917;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.25);
}

.smile-loader__eye--left {
  left: 27%;
  animation: smile-blink 3.2s ease-in-out infinite;
}

.smile-loader__eye--right {
  right: 27%;
  animation: smile-wink 3.2s ease-in-out infinite;
}

.smile-loader__mouth {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 30%;
  height: auto;
  margin-left: -15%;
  display: block;
  overflow: visible;
  pointer-events: none;
  color: #2f2a26;
}
.smile-loader__mouth path {
  stroke: #2f2a26 !important;
  fill: none;
}

@keyframes smile-spin {
  to { transform: rotate(360deg); }
}

@keyframes smile-blink {
  0%, 38%, 46%, 100% {
    transform: scaleY(1);
    border-radius: 50%;
  }
  42% {
    transform: scaleY(0.12);
    border-radius: 40%;
  }
}

@keyframes smile-wink {
  0%, 55%, 100% {
    transform: scaleY(1);
    border-radius: 50%;
    height: auto;
  }
  58%, 68% {
    transform: scaleY(0.08) rotate(-8deg);
    border-radius: 40%;
  }
  72% {
    transform: scaleY(1);
    border-radius: 50%;
  }
}

/* ── CupSteamLoader ── */
.cup-steam {
  position: relative;
  width: 76px;
  height: 92px;
  margin: 0 auto 0.35rem;
}

.cup-steam--sm { width: 60px; height: 74px; }
.cup-steam--md { width: 76px; height: 92px; }
.cup-steam--lg { width: 88px; height: 106px; }

.cup-steam__vapour {
  position: absolute;
  top: 0;
  left: 50%;
  width: 42px;
  height: 40px;
  margin-left: -26px;
  pointer-events: none;
  overflow: visible;
}

.cup-steam__steam {
  position: absolute;
  bottom: 0;
  width: 14px;
  height: 40px;
  color: var(--accent, #4caf45);
  opacity: 0;
}

.cup-steam__steam path {
  stroke-dasharray: 56;
  stroke-dashoffset: 56;
}

.cup-steam__cup {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 54px;
  height: 50px;
  margin-left: -27px;
}

.cup-steam__rim {
  position: absolute;
  top: 0;
  left: 50%;
  width: 44px;
  height: 10px;
  margin-left: -22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f1f8e9 0%, #dcedc8 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -2px 3px rgba(76, 175, 69, 0.14);
  z-index: 2;
}

.cup-steam__body {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 40px;
  height: 30px;
  margin-left: -20px;
  border-radius: 0 0 14px 14px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.55) 0%, transparent 40%),
    linear-gradient(165deg, #a5d6a7 0%, #4caf45 45%, #388e3c 100%);
  box-shadow:
    0 6px 12px rgba(76, 175, 69, 0.25),
    inset 0 -3px 6px rgba(0, 0, 0, 0.12),
    inset 2px 0 4px rgba(255, 255, 255, 0.2);
  z-index: 1;
}

.cup-steam__handle {
  position: absolute;
  top: 10px;
  right: -1px;
  width: 15px;
  height: 18px;
  border: 3.5px solid #4caf45;
  border-left: 0;
  border-radius: 0 11px 11px 0;
  box-sizing: border-box;
  z-index: 0;
}

.cup-steam__saucer {
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 54px;
  height: 8px;
  margin-left: -27px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f1f8e9 0%, #c5e1a5 100%);
  box-shadow: 0 3px 8px rgba(76, 175, 69, 0.18);
  z-index: 0;
}

@keyframes cup-steam-fly {
  0% {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(0.88);
  }
  18% { opacity: 0.85; }
  55% {
    opacity: 0.7;
    transform: translate3d(0, -8px, 0) scale(1);
  }
  82% {
    opacity: 0.28;
    transform: translate3d(0, -18px, 0) scale(1.03);
  }
  100% {
    opacity: 0;
    transform: translate3d(0, -24px, 0) scale(1.06);
  }
}

.cup-steam__steam--1 {
  left: 2px;
  animation: cup-steam-fly 2.4s ease-in-out infinite;
}

.cup-steam__steam--2 {
  left: 14px;
  color: #81c784;
  animation: cup-steam-fly 2.4s ease-in-out 0.4s infinite;
}

.cup-steam__steam--3 {
  left: 26px;
  animation: cup-steam-fly 2.4s ease-in-out 0.8s infinite;
}

.cup-steam__steam--1 path {
  animation: cup-steam-draw 2.4s ease-in-out infinite;
}

.cup-steam__steam--2 path {
  animation: cup-steam-draw 2.4s ease-in-out 0.4s infinite;
}

.cup-steam__steam--3 path {
  animation: cup-steam-draw 2.4s ease-in-out 0.8s infinite;
}

@keyframes cup-steam-draw {
  0% {
    stroke-dashoffset: 56;
    opacity: 0.4;
  }
  30% {
    stroke-dashoffset: 8;
    opacity: 1;
  }
  70% {
    stroke-dashoffset: -8;
    opacity: 0.75;
  }
  100% {
    stroke-dashoffset: -28;
    opacity: 0;
  }
}

/* ── SignalLoader ── */
.signal-loader {
  position: relative;
  width: 75px;
  height: 100px;
  margin: 0 auto;
}

.signal-loader--sm {
  width: 56px;
  height: 74px;
  transform: scale(0.78);
  transform-origin: center top;
}

.signal-loader--md {
  width: 75px;
  height: 100px;
}

.signal-loader--lg {
  width: 90px;
  height: 120px;
  transform: scale(1.12);
  transform-origin: center top;
}

.signal-loader__bar {
  position: absolute;
  bottom: 0;
  width: 10px;
  height: 50%;
  background: linear-gradient(180deg, #81c784 0%, #4caf45 55%, #388e3c 100%);
  border-radius: 4px 4px 2px 2px;
  transform-origin: center bottom;
  box-shadow: 1px 1px 0 rgba(76, 175, 69, 0.2);
}

.signal-loader__bar:nth-child(1) {
  left: 0;
  transform: scale(1, 0.2);
  animation: signal-barUp1 4s infinite;
}

.signal-loader__bar:nth-child(2) {
  left: 15px;
  transform: scale(1, 0.4);
  animation: signal-barUp2 4s infinite;
}

.signal-loader__bar:nth-child(3) {
  left: 30px;
  transform: scale(1, 0.6);
  animation: signal-barUp3 4s infinite;
}

.signal-loader__bar:nth-child(4) {
  left: 45px;
  transform: scale(1, 0.8);
  animation: signal-barUp4 4s infinite;
}

.signal-loader__bar:nth-child(5) {
  left: 60px;
  transform: scale(1, 1);
  animation: signal-barUp5 4s infinite;
}

.signal-loader__ball {
  position: absolute;
  bottom: 10px;
  left: 0;
  width: 10px;
  height: 10px;
  background: #388e3c;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(76, 175, 69, 0.35);
  animation: signal-ball 4s infinite;
}

@keyframes signal-ball {
  0% { transform: translate(0, 0); }
  5% { transform: translate(8px, -14px); }
  10% { transform: translate(15px, -10px); }
  17% { transform: translate(23px, -24px); }
  20% { transform: translate(30px, -20px); }
  27% { transform: translate(38px, -34px); }
  30% { transform: translate(45px, -30px); }
  37% { transform: translate(53px, -44px); }
  40% { transform: translate(60px, -40px); }
  50% { transform: translate(60px, 0); }
  57% { transform: translate(53px, -14px); }
  60% { transform: translate(45px, -10px); }
  67% { transform: translate(37px, -24px); }
  70% { transform: translate(30px, -20px); }
  77% { transform: translate(22px, -34px); }
  80% { transform: translate(15px, -30px); }
  87% { transform: translate(7px, -44px); }
  90% { transform: translate(0, -40px); }
  100% { transform: translate(0, 0); }
}

@keyframes signal-barUp1 {
  0% { transform: scale(1, 0.2); }
  40% { transform: scale(1, 0.2); }
  50% { transform: scale(1, 1); }
  90% { transform: scale(1, 1); }
  100% { transform: scale(1, 0.2); }
}

@keyframes signal-barUp2 {
  0% { transform: scale(1, 0.4); }
  40% { transform: scale(1, 0.4); }
  50% { transform: scale(1, 0.8); }
  90% { transform: scale(1, 0.8); }
  100% { transform: scale(1, 0.4); }
}

@keyframes signal-barUp3 {
  0%, 100% { transform: scale(1, 0.6); }
}

@keyframes signal-barUp4 {
  0% { transform: scale(1, 0.8); }
  40% { transform: scale(1, 0.8); }
  50% { transform: scale(1, 0.4); }
  90% { transform: scale(1, 0.4); }
  100% { transform: scale(1, 0.8); }
}

@keyframes signal-barUp5 {
  0% { transform: scale(1, 1); }
  40% { transform: scale(1, 1); }
  50% { transform: scale(1, 0.2); }
  90% { transform: scale(1, 0.2); }
  100% { transform: scale(1, 1); }
}

/* Inline loading placeholder (chat / fetch) */
.e-learn-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  min-height: 220px;
  gap: 0.35rem;
}

.e-learn-loading__text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.empty-state .cup-steam,
.empty-state .smile-loader,
.empty-state .signal-loader {
  margin-bottom: 0.75rem;
}

/* Offline overlay */
.e-learn-offline {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(25, 40, 28, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.e-learn-offline--visible {
  opacity: 1;
  pointer-events: auto;
}

.e-learn-offline[hidden] {
  display: none !important;
}

.e-learn-offline__card {
  width: min(360px, 100%);
  text-align: center;
  padding: 1.75rem 1.35rem 1.5rem;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(76, 175, 69, 0.22);
  box-shadow: 0 20px 50px rgba(40, 80, 40, 0.18);
}

.e-learn-offline__title {
  margin-top: 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary, #1b2b1c);
}

.e-learn-offline__text {
  margin-top: 0.35rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text-muted, #5f7260);
}

html.theme-dark .e-learn-offline {
  background: rgba(15, 18, 32, 0.72);
}

html.theme-dark .e-learn-offline__card {
  background: var(--bg-card, #161b2e);
  border-color: var(--border, rgba(255,255,255,0.08));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  .smile-loader__ring,
  .smile-loader__eye,
  .cup-steam__steam,
  .cup-steam__steam path,
  .signal-loader__bar,
  .signal-loader__ball {
    animation: none !important;
  }

  .cup-steam__steam {
    opacity: 0.55;
    transform: translateY(-6px);
  }

  .cup-steam__steam path {
    stroke-dashoffset: 0;
  }

  .signal-loader__bar:nth-child(1) { transform: scale(1, 0.35); }
  .signal-loader__bar:nth-child(2) { transform: scale(1, 0.55); }
  .signal-loader__bar:nth-child(3) { transform: scale(1, 0.75); }
  .signal-loader__bar:nth-child(4) { transform: scale(1, 0.9); }
  .signal-loader__bar:nth-child(5) { transform: scale(1, 1); }
  .signal-loader__ball { bottom: 42px; left: 30px; }
}
