/* ═══════════════════════════════════════════════════════
   gifts.css — Система подарков Pulse
   ═══════════════════════════════════════════════════════ */


/* ──────────────────────────────────────────────────────
   БАЗОВЫЕ АНИМАЦИИ ИКОНОК
   ────────────────────────────────────────────────────── */

@keyframes gft-bounce {
  0%,100% { transform: translateY(0) scale(1); }
  40%     { transform: translateY(-8px) scale(1.15); }
  60%     { transform: translateY(-4px) scale(1.08); }
}
@keyframes gft-spin {
  0%   { transform: rotate(0deg)   scale(1); }
  50%  { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes gft-pulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.25); }
}
@keyframes gft-shake {
  0%,100% { transform: rotate(0deg); }
  20%     { transform: rotate(-12deg) scale(1.1); }
  40%     { transform: rotate(12deg) scale(1.15); }
  60%     { transform: rotate(-8deg) scale(1.1); }
  80%     { transform: rotate(8deg); }
}
@keyframes gft-launch {
  0%   { transform: translateY(0)   scale(1); }
  30%  { transform: translateY(-14px) scale(0.9) rotate(-15deg); }
  60%  { transform: translateY(-6px)  scale(1.1) rotate(5deg); }
  100% { transform: translateY(0)   scale(1) rotate(0); }
}
@keyframes gft-glow {
  0%,100% { filter: drop-shadow(0 0 0px gold); transform: scale(1); }
  50%     { filter: drop-shadow(0 0 10px gold) drop-shadow(0 0 20px gold); transform: scale(1.15); }
}
@keyframes gft-march8 {
  0%   { transform: translateY(0)    rotate(0deg)   scale(1); }
  20%  { transform: translateY(-12px) rotate(-10deg) scale(1.2); }
  40%  { transform: translateY(-8px)  rotate(8deg)  scale(1.15); }
  60%  { transform: translateY(-14px) rotate(-6deg) scale(1.22); }
  80%  { transform: translateY(-6px)  rotate(4deg)  scale(1.1); }
  100% { transform: translateY(0)    rotate(0deg)   scale(1); }
}

.gft-anim-bounce  { animation: gft-bounce  1.6s ease-in-out infinite; display: inline-block; }
.gft-anim-spin    { animation: gft-spin    2s   linear    infinite;   display: inline-block; }
.gft-anim-pulse   { animation: gft-pulse   1.2s ease-in-out infinite; display: inline-block; }
.gft-anim-shake   { animation: gft-shake   1.4s ease-in-out infinite; display: inline-block; }
.gft-anim-launch  { animation: gft-launch  1.8s ease-in-out infinite; display: inline-block; }
.gft-anim-glow    { animation: gft-glow    1.8s ease-in-out infinite; display: inline-block; }
.gft-anim-march8  { animation: gft-march8  1.6s ease-in-out infinite; display: inline-block; }


/* ──────────────────────────────────────────────────────
   ШТОРКА ОТПРАВКИ ПОДАРКА
   ────────────────────────────────────────────────────── */

.gift-send-overlay { z-index: 600 !important; }

.gift-sheet {
  max-height: 88vh !important;
  display: flex;
  flex-direction: column;
}

.gift-sheet-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 18px 14px;
  flex-shrink: 0;
}
.gift-sheet-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.3px;
}
.gift-sheet-bal {
  font-size: 13px;
  font-weight: 800;
  color: #f0d060;
  background: rgba(240,208,60,.13);
  border: 1.5px solid rgba(240,208,60,.3);
  border-radius: 20px;
  padding: 5px 14px;
  box-shadow: 0 0 12px rgba(240,208,60,.1);
}

/* Сетка каталога */
.gift-catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 12px 14px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 360px) {
  .gift-catalog-grid { grid-template-columns: repeat(3, 1fr); }
}

.gift-cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px 10px;
  border-radius: 20px;
  border: 2px solid transparent;
  background: var(--bg2);
  cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s, box-shadow .15s;
  position: relative;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.gift-cat-item:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.gift-cat-item:active { transform: scale(.90); box-shadow: none; }
.gift-cat-item.selected {
  border-color: var(--acc);
  background: var(--acc-dim);
  box-shadow: 0 0 0 3px rgba(88,166,255,.18), 0 6px 18px rgba(88,166,255,.15);
}
.gift-cat-item.gift-limited {
  background: linear-gradient(145deg, rgba(255,105,135,.13), rgba(255,180,100,.09));
  border-color: rgba(255,105,135,.35);
}
.gift-cat-item.gift-limited.selected {
  border-color: #ff6987;
  background: rgba(255,105,135,.2);
  box-shadow: 0 0 0 3px rgba(255,105,135,.2), 0 6px 18px rgba(255,105,135,.2);
}
.gift-cat-emoji {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
}
.gift-cat-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--t1);
  text-align: center;
  line-height: 1.2;
}
.gift-cat-price {
  font-size: 11px;
  font-weight: 800;
  color: var(--acc);
  background: rgba(88,166,255,.1);
  border-radius: 10px;
  padding: 2px 7px;
}
.gift-coin { font-size: 9px; opacity: .8; }

.gift-limited-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: linear-gradient(135deg, #ff6987, #ff922b);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(255,105,135,.5);
  letter-spacing: .3px;
}

/* Футер шторки */
.gift-sheet-footer {
  flex-shrink: 0;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gift-selected-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.gift-sel-emoji  { font-size: 26px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.2)); }
.gift-sel-price  { margin-left: auto; color: var(--acc); font-weight: 800; font-size: 15px; }

.gift-msg-inp {
  min-height: 42px !important;
  max-height: 80px !important;
  font-size: 14px !important;
  resize: none;
}
.gift-anon-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--t1);
  cursor: pointer;
}
.gift-anon-row small { color: var(--t2); font-size: 11px; }


/* ──────────────────────────────────────────────────────
   АНИМАЦИЯ ОТПРАВКИ (оверлей)
   ────────────────────────────────────────────────────── */

.gift-sent-anim-wrap {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.gift-sent-anim-wrap.visible { opacity: 1; }

.gift-burst-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(88,166,255,.12) 0%, transparent 70%);
  animation: giftBgPulse .6s ease-out;
}
@keyframes giftBgPulse {
  from { transform: scale(.4); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

.gift-burst-emoji {
  font-size: 80px;
  line-height: 1;
  animation: giftEmojiBurst .6s cubic-bezier(.34,1.56,.64,1) forwards;
  z-index: 2;
}
@keyframes giftEmojiBurst {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  60%  { transform: scale(1.3) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.gift-sent-label {
  margin-top: 20px;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.5);
  z-index: 2;
  animation: fadeUp .4s ease .3s both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* Конфетти */
.gift-confetti { position: absolute; inset: 0; pointer-events: none; }
.gift-conf {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--c);
  left: calc(30% + var(--i) * 3%);
  top: 50%;
  animation: confettiFly 1.8s cubic-bezier(.2,.8,.3,1) calc(var(--i) * 0.06s) both;
}
@keyframes confettiFly {
  0%   { transform: translate(0,0) rotate(0deg) scale(0); opacity: 1; }
  60%  { opacity: 1; }
  100% {
    transform:
      translate(calc(cos(calc(var(--i) * 22.5deg)) * 140px),
                calc(sin(calc(var(--i) * 22.5deg)) * 160px - 60px))
      rotate(calc(var(--i) * 45deg)) scale(1);
    opacity: 0;
  }
}


/* ── АНИМАЦИЯ 8 МАРТА ────────────────────────────────── */

/* Лепестки вокруг главного эмодзи */
.gift-petals { position: absolute; inset: 0; pointer-events: none; }
.gift-petal {
  position: absolute;
  font-size: 22px;
  left: 50%; top: 50%;
  transform-origin: 0 0;
  animation: petalFly 2s cubic-bezier(.2,.8,.3,1) calc(var(--i) * 0.1s) both;
}
@keyframes petalFly {
  0%   { transform: translate(-50%,-50%) rotate(0deg) scale(0); opacity: 1; }
  50%  { opacity: 1; }
  100% {
    transform:
      translate(
        calc(-50% + cos(calc(var(--i) * 30deg)) * 120px),
        calc(-50% + sin(calc(var(--i) * 30deg)) * 130px - 20px)
      )
      rotate(calc(var(--i) * 60deg + 180deg))
      scale(0.6);
    opacity: 0;
  }
}

/* Специальный burst для 8 марта */
.gift-sent-anim-wrap:has(.gft-anim-march8) .gift-burst-bg {
  background: radial-gradient(circle at 50% 50%,
    rgba(255,105,135,.2) 0%,
    rgba(255,180,100,.1) 40%,
    transparent 70%);
}
.gift-sent-anim-wrap:has(.gft-anim-march8) .gift-sent-label {
  background: linear-gradient(90deg, #ff6987, #ff922b, #ff6987);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 22px;
  text-shadow: none;
}


/* ──────────────────────────────────────────────────────
   ТОСТ ПОЛУЧЕНИЯ ПОДАРКА
   ────────────────────────────────────────────────────── */

.gift-recv-toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  z-index: 9000;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 360px;
}
.gift-recv-toast.visible {
  transform: translateX(-50%) translateY(0);
}
.gift-recv-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border3);
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.gift-recv-emoji { font-size: 36px; flex-shrink: 0; }
.gift-recv-body  { flex: 1; min-width: 0; }
.gift-recv-title { font-size: 11px; font-weight: 800; color: var(--acc); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 2px; }
.gift-recv-name  { font-size: 15px; font-weight: 700; }
.gift-recv-from  { font-size: 12px; color: var(--t2); margin-top: 1px; }
.gift-recv-msg   { font-size: 12px; color: var(--t2); margin-top: 3px; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* ──────────────────────────────────────────────────────
   ПОДАРКИ НА ПРОФИЛЕ
   ────────────────────────────────────────────────────── */

.gift-profile-section {
  padding: 12px 16px;
}
.gift-profile-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--acc);
  margin-bottom: 10px;
}
.gift-profile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 360px) {
  .gift-profile-grid { grid-template-columns: repeat(3, 1fr); }
}
.gift-profile-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--bg2);
  border-radius: 14px;
  padding: 10px 6px 8px;
  border: 1px solid var(--border);
  position: relative;
  text-align: center;
  transition: background .12s;
  cursor: default;
}
.gift-profile-emoji { font-size: 26px; line-height: 1; }
.gift-profile-name  { font-size: 10.5px; font-weight: 700; color: var(--t1); }
.gift-profile-from  { font-size: 10px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.gift-profile-msg   { font-size: 9.5px; color: var(--t3); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.gift-hide-btn {
  position: absolute;
  top: 4px; right: 4px;
  font-size: 9px;
  font-weight: 700;
  color: var(--t3);
  background: var(--bg3);
  border: none;
  border-radius: 6px;
  padding: 2px 5px;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.gift-hide-btn:active { background: var(--bg4); }

.gift-profile-loading,
.gift-profile-empty {
  text-align: center;
  padding: 16px;
  color: var(--t2);
  font-size: 13px;
}

/* Кнопка "Подарить" на профиле пользователя */
.gift-profile-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1.5px solid rgba(255,105,135,.4);
  background: rgba(255,105,135,.08);
  color: #ff6987;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.gift-profile-btn:hover  { background: rgba(255,105,135,.15); }
.gift-profile-btn:active { transform: scale(.94); }
