/* ═══════════════════════════════════════════════════════════════════════════
   🎭 STICKERS - Picker Popup + Timeline + Shop
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── دکمه 🎭 در reactionsContainer (ویژه برای trigger) ─── */
.sticker-trigger-btn {
    background: linear-gradient(135deg, rgba(168, 85, 247, .2), rgba(6, 182, 212, .2)) !important;
    border: 1.5px solid rgba(168, 85, 247, .45) !important;
    position: relative;
}
.sticker-trigger-btn::after {
    content: '+';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #a855f7;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 14px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.sticker-trigger-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(168, 85, 247, .35);
}

/* ─── Sticker Picker Popup (داخل tab-reactions، زیر grid) ─── */
.sticker-picker-popup {
    margin-top: 12px;
    background: linear-gradient(145deg, rgba(26, 26, 46, .98), rgba(20, 20, 36, .98));
    border: 1.5px solid rgba(168, 85, 247, .35);
    border-radius: 14px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, .45);
    overflow: hidden;
    animation: spPopIn .25s cubic-bezier(.16, 1, .3, 1);
    max-height: 340px;
    display: flex;
    flex-direction: column;
}
@keyframes spPopIn {
    0%   { opacity: 0; transform: translateY(-8px) scale(.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.sp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(168, 85, 247, .08);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.sp-title {
    flex: 1;
    font-weight: 800;
    font-size: 13px;
    color: #fff;
}
.sp-shop-btn, .sp-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    background: rgba(255, 255, 255, .05);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.sp-shop-btn:hover { background: rgba(168, 85, 247, .3); transform: scale(1.08); }
.sp-close-btn:hover { background: rgba(239, 68, 68, .3); transform: scale(1.08); }

.sp-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 140px;
}

.sp-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 10px;
    overflow-x: auto;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    scrollbar-width: thin;
}
.sp-tabs::-webkit-scrollbar { height: 3px; }
.sp-tabs::-webkit-scrollbar-thumb { background: rgba(168, 85, 247, .3); }

.sp-tab {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    border: 1.5px solid rgba(255, 255, 255, .06);
    background: rgba(255, 255, 255, .03);
    cursor: pointer;
    font-size: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    font-family: inherit;
}
.sp-tab:hover {
    background: rgba(168, 85, 247, .15);
    border-color: rgba(168, 85, 247, .3);
}
.sp-tab.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, .25), rgba(6, 182, 212, .25));
    border-color: rgba(168, 85, 247, .55);
    transform: scale(1.05);
}

.sp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 6px;
    padding: 10px;
    overflow-y: auto;
    max-height: 200px;
}

.sp-sticker-btn {
    aspect-ratio: 1;
    border-radius: 10px;
    border: 1.5px solid rgba(255, 255, 255, .05);
    background: rgba(255, 255, 255, .03);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s cubic-bezier(.16, 1, .3, 1);
    padding: 4px;
    font-family: inherit;
    overflow: hidden;
}
.sp-sticker-btn:hover {
    background: rgba(168, 85, 247, .15);
    border-color: rgba(168, 85, 247, .45);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 10px rgba(168, 85, 247, .25);
}
.sp-sticker-btn:active { transform: scale(.9); }
.sp-sticker-btn:disabled { opacity: .5; cursor: not-allowed; }
.sp-sticker-btn.sending {
    animation: spSending .7s infinite;
}
@keyframes spSending {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.15); }
}

.sp-sticker-emoji {
    font-size: 30px;
    line-height: 1;
}
.sp-sticker-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.sp-sticker-img.animated {
    /* انیمیشن برای GIF/APNG خودش از خود فایل میاد، ولی یک hover کوچک اضافه می‌کنیم */
    animation: spAnimHint 2.5s ease-in-out infinite;
}
@keyframes spAnimHint {
    0%, 80%, 100% { transform: scale(1) rotate(0); }
    88%           { transform: scale(1.08) rotate(-3deg); }
    94%           { transform: scale(1.08) rotate(3deg); }
}

.sp-loading, .sp-empty {
    text-align: center;
    padding: 30px 16px;
    color: rgba(255, 255, 255, .55);
    font-size: 12px;
}
.sp-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.sp-shop-link {
    padding: 8px 14px;
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    margin-top: 6px;
}
.sp-shop-link:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(168, 85, 247, .35); }

/* ─── Timeline: Sticker Event Render (استیکر در تایم‌لاین - بدون کادر اضافه) ─── */
.timeline-sticker-box {
    margin-top: 4px;
    padding: 0;
    background: transparent;
    border: none;
    display: inline-block;
    min-height: 0;
}
.timeline-sticker-emoji {
    font-size: 36px;
    line-height: 1;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .3));
    animation: stickerPop .45s cubic-bezier(.34, 1.56, .64, 1);
    display: inline-block;
}
@keyframes stickerPop {
    0%  { transform: scale(.3); opacity: 0; }
    60% { transform: scale(1.15); opacity: 1; }
    100%{ transform: scale(1); }
}
.timeline-sticker-img {
    max-width: 80px;
    max-height: 80px;
    object-fit: contain;
    animation: stickerPop .45s cubic-bezier(.34, 1.56, .64, 1);
    display: inline-block;
    vertical-align: middle;
}
.timeline-sticker-img.animated {
    filter: drop-shadow(0 2px 6px rgba(168, 85, 247, .25));
}

/* ─── Sticker Shop Modal (خرید پک) ─── */
.sticker-shop-modal {
    max-width: 700px !important;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}
.shop-modal-header {
    text-align: center;
    padding: 8px 0 18px;
}
.shop-modal-icon {
    font-size: 44px;
    margin-bottom: 6px;
}
.shop-modal-header h2 {
    margin: 4px 0 6px;
    font-size: 20px;
}
.shop-modal-header p {
    color: rgba(255, 255, 255, .6);
    font-size: 12px;
}

.sticker-shop-packs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    min-height: 140px;
}

.pack-card {
    position: relative;
    padding: 18px 16px 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .02));
    border: 1.5px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all .2s cubic-bezier(.16, 1, .3, 1);
}
.pack-card:hover {
    transform: translateY(-2px);
    border-color: rgba(168, 85, 247, .35);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
}
.pack-card.premium {
    background: linear-gradient(145deg, rgba(251, 191, 36, .08), rgba(168, 85, 247, .08));
    border-color: rgba(251, 191, 36, .3);
}

.pack-owned-badge, .pack-premium-badge {
    position: absolute;
    top: 8px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 9.5px;
    font-weight: 800;
    color: #fff;
}
.pack-owned-badge {
    right: 8px;
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 2px 6px rgba(16, 185, 129, .35);
}
.pack-premium-badge {
    left: 8px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a2e;
    box-shadow: 0 2px 6px rgba(251, 191, 36, .35);
}

.pack-name { font-size: 15px; font-weight: 800; color: #fff; margin-top: 10px; }
.pack-desc { font-size: 11px; color: rgba(255, 255, 255, .55); line-height: 1.6; }
.pack-preview {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px 6px;
    background: rgba(0, 0, 0, .15);
    border-radius: 8px;
    min-height: 48px;
    align-items: center;
}
.pack-preview-item { font-size: 22px; line-height: 1; }
.pack-preview-img { width: 32px; height: 32px; object-fit: contain; }
.pack-count { font-size: 11px; color: rgba(255, 255, 255, .5); text-align: left; }

.pack-buy-btn {
    padding: 9px 12px;
    border-radius: 10px;
    border: none;
    font-weight: 800;
    font-size: 12.5px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    color: #fff;
    margin-top: 4px;
}
.pack-buy-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(168, 85, 247, .4);
}
.pack-buy-btn.free { background: linear-gradient(135deg, #10b981, #059669); }
.pack-buy-btn.free:hover:not(:disabled) { box-shadow: 0 5px 14px rgba(16, 185, 129, .4); }
.pack-buy-btn.owned, .pack-buy-btn:disabled {
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .5);
    cursor: not-allowed;
}
.pack-card.premium .pack-buy-btn:not(.owned):not(:disabled) {
    background: linear-gradient(135deg, #fbbf24, #a855f7);
}

/* ─── Responsive ─── */
@media (max-width: 500px) {
    .sticker-shop-packs { grid-template-columns: 1fr; }
    .sp-grid { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
    .sp-sticker-emoji { font-size: 26px; }
    .timeline-sticker-emoji { font-size: 30px; }
    .timeline-sticker-img { max-width: 64px; max-height: 64px; }
}

/* ─── مدال تایید ارسال استیکر ─── */
.sticker-confirm-modal {
    max-width: 340px !important;
    text-align: center;
    padding: 20px;
}
.confirm-title {
    font-size: 15px;
    font-weight: 700;
    color: rgba(255, 255, 255, .85);
    margin: 6px 0 14px;
}
.confirm-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    margin: 0 auto 10px;
    background: linear-gradient(145deg, rgba(168, 85, 247, .1), rgba(6, 182, 212, .06));
    border: 1px solid rgba(168, 85, 247, .25);
    border-radius: 14px;
}
.confirm-sticker-emoji {
    font-size: 80px;
    line-height: 1;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .3));
}
.confirm-sticker-img {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
}
.confirm-name {
    color: rgba(255, 255, 255, .6);
    font-size: 12px;
    margin: 6px 0 18px;
}
.confirm-actions {
    display: flex;
    gap: 8px;
}
.confirm-actions .auth-btn { flex: 1; }
