/* ══════════════════════════════════════════════════════════════════════
   Gift System — Tile Grid Modal, Animation, Event Card
   ══════════════════════════════════════════════════════════════════════ */

/* ── Animations ── */
@keyframes giftFadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes giftSlideUp {
  from { opacity: 0; transform: translateY(16px) }
  to   { opacity: 1; transform: translateY(0) }
}

/* ── Overlay + shell now use shared modal classes from base.css ──
   .modal-overlay  → overlay
   .modal-wrapper.modal--sm  → card
   .modal-header / .modal-title / .modal-close  → header
   .modal-body--panel  → scrollable body
── */

/* ── Token balance (bottom) ── */
.gift-bal {
  text-align: center; font-size: 12px; color: var(--muted);
  padding: 10px 12px; border-radius: 8px;
  background: var(--bg3); margin-top: 14px;
  border-top: 1px solid var(--border2);
}
.gift-bal span { font-weight: 600; color: var(--cream); font-size: 13px }

/* ── Milestone info banner ── */
.gift-milestone-info {
  font-size: 12px; color: var(--text-secondary);
  padding: 8px 12px; border-radius: 8px; margin-bottom: 12px;
  background: color-mix(in srgb, var(--accent) 10%, var(--bg3));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border2));
}

/* ── Tier section ── */
.gift-sec { margin-bottom: 12px }

.gift-sec-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0 8px; position: sticky; top: 0;
  background: var(--bg2); z-index: 1;
}

.gift-tier {
  padding: 2px 8px; border-radius: 4px; font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .8px;
}
.gift-tier[data-tier="sweet"]      { background: rgba(212, 160, 216, .15); color: #d4a0d8 }
.gift-tier[data-tier="thoughtful"] { background: rgba(160, 136, 208, .15); color: #a088d0 }
.gift-tier[data-tier="special"]    { background: rgba(212, 168, 64, .15);  color: #d4a840 }
.gift-tier[data-tier="rare"]       { background: rgba(224, 64, 80, .15);   color: #e04050 }

.gift-cost {
  font-size: 10px; color: var(--muted); margin-left: auto;
}
.gift-free {
  padding: 2px 7px; border-radius: 4px; font-size: 9px; font-weight: 600;
  background: var(--green-bg); color: var(--green);
}

/* ── Tile grid ── */
.gift-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

/* ── Individual tile ── */
.gift-tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px 6px;
  border-radius: 10px; cursor: pointer;
  transition: background .15s, transform .1s;
  border: 1px solid transparent;
}
.gift-tile:hover {
  background: rgba(255, 255, 255, .05);
  border-color: var(--border2);
  transform: translateY(-1px);
}
.gift-tile:active { transform: scale(.96) }
.gift-tile.dim {
  opacity: .35; pointer-events: none; cursor: default;
}

/* ── Tile image / emoji ── */
.gift-tile-img {
  width: 52px; height: 52px; border-radius: 10px; overflow: hidden;
  background: var(--bg3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.gift-tile-img img {
  width: 100%; height: 100%; object-fit: cover;
}
.gift-tile-emoji {
  font-size: 24px; opacity: .5;
}

/* ── Tile name ── */
.gift-tile-name {
  margin-top: 5px; font-size: 10px; color: var(--dim);
  text-align: center; line-height: 1.2;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-weight: 400;
}

/* ── Tile status tags ── */
.gift-tile-tag {
  position: absolute; top: 4px; right: 4px;
  font-size: 8px; font-weight: 600; text-transform: uppercase;
  padding: 1px 5px; border-radius: 3px; letter-spacing: .4px;
}
.gift-tile-tag.sent {
  background: rgba(255, 255, 255, .08); color: var(--muted);
}
.gift-tile-tag.free {
  background: var(--green-bg); color: var(--green);
}

/* ── Hover tooltip ── */
.gift-tip {
  position: absolute; z-index: 2;
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: 8px; padding: 8px 10px;
  font-size: 11px; color: var(--dim); line-height: 1.35;
  width: 180px; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  animation: giftFadeIn .1s ease;
}
.gift-tip strong {
  display: block; color: var(--cream); font-weight: 500;
  font-size: 12px; margin-bottom: 3px;
}

/* ── Empty / loading ── */
.gift-empty, .gift-loading {
  text-align: center; padding: 40px 16px;
  color: var(--muted); font-size: 12px;
}

/* ── Confirm overlay ── */
.gift-confirm {
  position: absolute; inset: 0; z-index: 5;
  background: var(--black-60); border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  animation: giftFadeIn .15s ease;
}
.gift-confirm-box {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 14px; padding: 24px 22px; text-align: center;
  max-width: 260px;
}
.gift-confirm-box p {
  font-size: 14px; color: var(--cream); margin: 0 0 16px;
  font-family: var(--ff-display); font-weight: 400; line-height: 1.4;
}
/* ── Message textarea ── */
.gift-msg-input {
  width: 100%; box-sizing: border-box;
  margin-bottom: 14px; padding: 8px 10px;
  background: var(--bg3); border: 1px solid var(--border2); border-radius: 8px;
  color: var(--cream); font-size: 12px; font-family: var(--ff-body);
  resize: none; min-height: 52px; max-height: 90px;
  outline: none; transition: border-color .15s;
}
.gift-msg-input::placeholder { color: var(--muted) }
.gift-msg-input:focus { border-color: var(--rose) }

.gift-confirm-btns { display: flex; gap: 10px; justify-content: center }
.gift-btn-yes {
  padding: 8px 26px; border-radius: 8px; border: none;
  background: var(--rose); color: #fff; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .15s;
}
.gift-btn-yes:hover { background: var(--rose-d) }
.gift-btn-no {
  padding: 8px 22px; border-radius: 8px;
  border: 1px solid var(--border2); background: transparent;
  color: var(--muted); font-size: 13px; cursor: pointer;
  transition: all .15s;
}
.gift-btn-no:hover { color: var(--cream); border-color: var(--muted2) }

/* ── Heart animation ── */
.gift-hearts {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none; overflow: hidden;
}
.gift-heart {
  position: absolute; bottom: -30px;
  animation: heartRise 2.5s ease-out forwards;
}
@keyframes heartRise {
  0%   { transform: translateY(0) scale(1) rotate(0deg); opacity: 1 }
  50%  { opacity: 1 }
  100% { transform: translateY(-100vh) scale(.5) rotate(25deg); opacity: 0 }
}

/* ── Gift image lightbox ── */
.gift-lb-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0, 0, 0, .92);
  display: flex; align-items: center; justify-content: center;
  animation: giftFadeIn .15s ease;
  cursor: pointer;
}
.gift-lb-content {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; cursor: default; max-width: 90vw;
}
.gift-lb-img {
  max-width: 80vw; max-height: 70vh;
  object-fit: contain; border-radius: 8px;
}
.gift-lb-info {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center; max-width: 400px;
}
.gift-lb-name {
  font-family: var(--ff-display); font-size: 16px; color: #fff;
  font-weight: 500; letter-spacing: .3px;
}
.gift-lb-desc {
  font-size: 12px; color: rgba(255, 255, 255, .55); line-height: 1.35;
}
.gift-lb-counter {
  font-size: 11px; color: rgba(255, 255, 255, .35);
}
.gift-lb-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: rgba(255, 255, 255, .7);
  font-size: 28px; cursor: pointer; line-height: 1;
  transition: color .15s;
}
.gift-lb-close:hover { color: #fff }
.gift-lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255, 255, 255, .1); border: none;
  color: rgba(255, 255, 255, .8);
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.gift-lb-nav:hover { background: rgba(255, 255, 255, .2) }
.gift-lb-prev { left: 16px }
.gift-lb-next { right: 16px }

/* ── Gift event card (chat) ── */
.gift-event {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin: 10px auto; padding: 12px 18px; max-width: 340px;
  border: 1px solid rgba(212, 168, 64, .2); border-radius: 10px;
  background: rgba(212, 168, 64, .05); text-align: center;
}
.gift-event-top {
  display: flex; align-items: center; gap: 10px;
}
.gift-event-ico { font-size: 20px; flex-shrink: 0 }
.gift-event-info { display: flex; flex-direction: column; gap: 2px; text-align: left }
.gift-event-info strong { font-size: 12px; color: var(--cream); font-weight: 500 }
.gift-event-info span { font-size: 11px; color: #d4a840; font-weight: 400 }
.gift-event-msg {
  font-size: 11px; color: var(--dim); font-style: italic;
  line-height: 1.35; max-width: 280px; word-break: break-word;
}
