/* Gift Center — solution2 */

/* ===== ВИДЖЕТ ПРОФИЛЯ ===== */
.gift-widget {
    background: #2d2d37;
    border: 1px solid #393946;
    border-radius: 18px;
    padding: 14px 16px 18px;
    margin-bottom: 20px;
    overflow: visible;
}

.gift-widget-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,.07);
    padding-bottom: 11px;
    margin-bottom: 13px;
    gap: 8px;
}

.gift-widget-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.gift-widget-title i { font-size: 17px; color: #f5c518; }

.gift-widget-count {
    font-size: 11px;
    font-weight: 700;
    background: rgba(245,197,24,.12);
    color: #f5c518;
    border-radius: 999px;
    padding: 1px 8px;
}

.gift-total {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(46,204,113,.10);
    color: #4fea9f;
    border: 1px solid rgba(46,204,113,.18);
    border-radius: 999px;
    padding: 1px 8px;
    white-space: nowrap;
    position: relative;
    cursor: help;
}

.gift-total i {
    font-size: 13px;
}

.gift-total::before,
.gift-total::after {
    position: absolute;
    left: 50%;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
    z-index: 100002;
}

.gift-total::before {
    content: attr(data-tooltip);
    bottom: calc(100% + 9px);
    transform: translate(-50%, 4px);
    min-width: max-content;
    max-width: 220px;
    padding: 7px 10px;
    background: rgba(13,13,20,.97);
    border: 1px solid rgba(245,197,24,.22);
    border-radius: 9px;
    color: rgba(255,255,255,.86);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 10px 28px rgba(0,0,0,.45);
    backdrop-filter: blur(8px);
}

.gift-total::after {
    content: '';
    bottom: calc(100% + 4px);
    transform: translate(-50%, 4px) rotate(45deg);
    width: 9px;
    height: 9px;
    background: rgba(13,13,20,.97);
    border-right: 1px solid rgba(245,197,24,.22);
    border-bottom: 1px solid rgba(245,197,24,.22);
}

.gift-total:hover::before,
.gift-total:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.gift-total:hover::after {
    transform: translate(-50%, 0) rotate(45deg);
}

.gift-total--modal {
    margin-left: 2px;
}

.gift-widget-head-right { display: flex; align-items: center; gap: 7px; }

/* ===== КНОПКИ ===== */
.gift-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(90deg, #f5c518, #d4920a);
    color: #1a1000;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s, transform .15s;
    padding: 0 14px;
    height: 34px;
    white-space: nowrap;
}

.gift-btn-primary:hover   { opacity: .88; transform: translateY(-1px); }
.gift-btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.gift-btn-sm  { height: 28px; font-size: 12px; padding: 0 11px; }

.gift-btn-all {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,.06);
    border: 1px solid #393946;
    color: rgba(255,255,255,.5);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    height: 28px;
    padding: 0 11px;
    transition: color .15s, border-color .15s, background .15s;
}

.gift-btn-all:hover { color: #fff; border-color: #f5c518; background: rgba(245,197,24,.06); }

/* ===== МИНИ-СЕТКА (5 подарков в профиле) ===== */
.gift-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    overflow: visible;
}

.gift-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px;
    color: rgba(255,255,255,.25);
    font-size: 13px;
}

.gift-empty i { font-size: 20px; }

/* ===== АНИМАЦИЯ ПОЯВЛЕНИЯ ===== */
@keyframes gift-pop {
    0%   { opacity: 0; transform: scale(0.4) rotate(-8deg); }
    55%  { opacity: 1; transform: scale(1.12) rotate(3deg); }
    75%  { transform: scale(0.94) rotate(-1deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes gift-glow-common {
    0%,100% { box-shadow: 0 0 0 0 rgba(79,160,255,0); }
    40%     { box-shadow: 0 0 22px 6px rgba(79,160,255,.55); }
}
@keyframes gift-glow-rare {
    0%,100% { box-shadow: 0 0 0 0 rgba(174,104,255,0); }
    40%     { box-shadow: 0 0 22px 6px rgba(174,104,255,.55); }
}
@keyframes gift-glow-epic {
    0%,100% { box-shadow: 0 0 0 0 rgba(245,197,24,0); }
    40%     { box-shadow: 0 0 22px 6px rgba(245,197,24,.65); }
}

.gift-card--new {
    animation: gift-pop .52s cubic-bezier(.34,1.56,.64,1) both;
}
.gift-card--new.rarity-common { animation: gift-pop .52s cubic-bezier(.34,1.56,.64,1) both, gift-glow-common .9s ease .15s both; }
.gift-card--new.rarity-rare   { animation: gift-pop .52s cubic-bezier(.34,1.56,.64,1) both, gift-glow-rare   .9s ease .15s both; }
.gift-card--new.rarity-epic   { animation: gift-pop .52s cubic-bezier(.34,1.56,.64,1) both, gift-glow-epic   .9s ease .15s both; }

/* ===== КАРТОЧКА ПОДАРКА ===== */
.gift-card {
    border: none;
    border-radius: 14px;
    padding: 0;
    min-width: 0;
    cursor: pointer;
    transition: transform .18s, box-shadow .18s;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: transparent;
}

.gift-card:hover { transform: translateY(-4px); }

.gift-card.rarity-common:hover .gift-card-img-wrap { box-shadow: 0 6px 20px rgba(79,160,255,.35); }
.gift-card.rarity-rare:hover   .gift-card-img-wrap { box-shadow: 0 6px 20px rgba(174,104,255,.35); }
.gift-card.rarity-epic:hover   .gift-card-img-wrap { box-shadow: 0 6px 20px rgba(245,197,24,.35); }

.gift-card-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: box-shadow .18s;
    background: #1a1a24;
    flex-shrink: 0;
}

/* цветная полоска редкости снизу картинки */
.gift-card-img-wrap::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 0 0 12px 12px;
    z-index: 1;
}
.gift-card.rarity-common .gift-card-img-wrap::after { background: linear-gradient(90deg,#4fa0ff,#7ec8ff); }
.gift-card.rarity-rare   .gift-card-img-wrap::after { background: linear-gradient(90deg,#ae68ff,#d4a0ff); }
.gift-card.rarity-epic   .gift-card-img-wrap::after { background: linear-gradient(90deg,#f5c518,#ffd95a); }

.gift-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    transition: transform 220ms ease;
    padding: 4px;
    box-sizing: border-box;
}

.gift-card:hover .gift-card-img { transform: scale(1.08); }

/* подпись под картинкой */
.gift-card-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,.55);
    text-align: center;
    line-height: 1.2;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
}

/* ===== ТУЛТИП ===== */
.gift-tooltip {
    position: fixed;
    z-index: 100000;
    background: rgba(13,13,20,.97);
    border: 1px solid #393946;
    border-radius: 10px;
    padding: 9px 12px;
    display: none;
    min-width: 140px;
    pointer-events: none;
    box-shadow: 0 8px 28px rgba(0,0,0,.5);
    backdrop-filter: blur(8px);
    font-size: 12px;
    line-height: 1.55;
}

.gift-tooltip.show { display: block; }
.gift-tooltip b    { display: block; font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 3px; }
.gift-tooltip span { display: block; color: rgba(255,255,255,.4); }

/* ===== МОДАЛЫ (общие) ===== */
.gift-modal {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: none;
    overflow: hidden;
    padding: 20px 16px;
    box-sizing: border-box;
}

.gift-modal.show { display: flex; align-items: flex-start; justify-content: center; }

.gift-modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(5px);
    z-index: -1;
}

.gift-modal-window {
    position: relative;
    width: min(560px, 100%);
    max-height: calc(100vh - 40px);
    margin: 0 auto;
    background: #2d2d37;
    border: 1px solid #393946;
    border-radius: 20px;
    overflow: clip;
    box-shadow: 0 24px 64px rgba(0,0,0,.7);
    display: flex;
    flex-direction: column;
}

.gift-modal-window--wide { width: min(700px, 100%); }

.gift-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

.gift-modal-head span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.gift-modal-head span i { color: #f5c518; font-size: 18px; }

.gift-modal-head-count {
    font-size: 12px;
    background: rgba(245,197,24,.12);
    color: #f5c518;
    border-radius: 999px;
    padding: 1px 9px;
    font-weight: 700;
}

.gift-modal-close {
    width: 30px; height: 30px;
    border: 1px solid #393946;
    border-radius: 8px;
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.4);
    cursor: pointer;
    font-size: 19px;
    display: flex; align-items: center; justify-content: center;
    transition: color .15s, border-color .15s;
    flex-shrink: 0;
}

.gift-modal-close:hover { color: #fff; border-color: #f5c518; }

/* ===== МОДАЛ: ВСЕ ПОДАРКИ (грид) ===== */
.gift-modal-all-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    padding: 18px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #393946 transparent;
}

.gift-modal-all-grid::-webkit-scrollbar { width: 5px; }
.gift-modal-all-grid::-webkit-scrollbar-thumb { background: #393946; border-radius: 3px; }

/* ===== МОДАЛ: ОТПРАВИТЬ ПОДАРОК ===== */
.gift-send-section {
    padding: 16px 18px 0;
}

.gift-send-section:last-of-type { padding-bottom: 0; }

.gift-send-section-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gift-send-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: currentColor;
    opacity: .15;
}

.gift-send-section-title.rarity-common { color: #4fa0ff; }
.gift-send-section-title.rarity-rare   { color: #ae68ff; }
.gift-send-section-title.rarity-epic   { color: #f5c518; }

/* Грид подарков для покупки — 5 колонок на ПК */
.gift-send-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: #393946 transparent;
}

.gift-send-grid::-webkit-scrollbar { width: 5px; }
.gift-send-grid::-webkit-scrollbar-thumb { background: #393946; border-radius: 3px; }

/* карточка-опция */
.gift-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: #1e1e27;
    border: none;
    border-radius: 14px;
    padding: 8px 6px 10px;
    min-width: 0;
    box-sizing: border-box;
    cursor: pointer;
    text-align: center;
    transition: box-shadow .18s, transform .18s;
    position: relative;
}

.gift-option:hover { transform: translateY(-2px); }

.gift-option.rarity-common:hover, .gift-option.rarity-common.active { box-shadow: 0 0 0 3px rgba(79,160,255,.35); }
.gift-option.rarity-rare:hover,   .gift-option.rarity-rare.active   { box-shadow: 0 0 0 3px rgba(174,104,255,.35); }
.gift-option.rarity-epic:hover,   .gift-option.rarity-epic.active   { box-shadow: 0 0 0 3px rgba(245,197,24,.35); }

.gift-option.active::after {
    content: '';
    position: absolute;
    top: 5px; right: 7px;
    font-size: 12px;
    color: #4fea9f;
    font-weight: 900;
}

.gift-option-disabled { opacity: .38; cursor: not-allowed; }
.gift-option-disabled:hover { transform: none; }

.gift-option-img {
    width: 100%;
    aspect-ratio: 1;
    box-sizing: border-box;
    border-radius: 9px;
    overflow: hidden;
    display: block;
}

.gift-option-img img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 200ms;
}

.gift-option:hover .gift-option-img img { transform: scale(1.06); }

.gift-option-name  {
    width: 100%;
    min-width: 0;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gift-option-price { font-size: 10px; color: #f5c518; font-weight: 700; }
.gift-option-stock { font-size: 10px; color: rgba(255,255,255,.28); }
.gift-option-sold  {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.55);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: rgba(255,255,255,.5);
}

/* Подвал формы отправки — sticky снизу */
.gift-send-footer {
    border-top: 1px solid rgba(255,255,255,.07);
    padding: 14px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    background: #2d2d37;
    position: sticky;
    bottom: 0;
}

.gift-send-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.04);
    border: 1px solid #393946;
    border-radius: 12px;
    padding: 10px 12px;
    min-height: 52px;
}

.gift-send-selected-hint { font-size: 13px; color: rgba(255,255,255,.25); }

.gift-send-sel-img {
    width: 36px; height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.gift-send-sel-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gift-send-sel-info b  { font-size: 13px; color: #fff; }
.gift-send-sel-info span { font-size: 11px; color: rgba(255,255,255,.35); }

.gift-send-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.gift-send-msg {
    background: rgba(255,255,255,.06);
    border: 1px solid #393946;
    border-radius: 10px;
    color: #fff;
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
    outline: none;
    transition: border-color .15s;
    width: 100%;
    box-sizing: border-box;
}

.gift-send-msg::placeholder { color: rgba(255,255,255,.22); }
.gift-send-msg:focus { border-color: #f5c518; }

.gift-btn-send { height: 38px; padding: 0 18px; font-size: 13px; }

.gift-send-result {
    font-size: 13px;
    min-height: 18px;
    font-weight: 600;
}

.gift-send-result.ok  { color: #4fea9f; }
.gift-send-result.err { color: #ff6b6b; }

/* ===== ПРЕВЬЮ ===== */
.gift-preview {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: none;
    align-items: center;
    justify-content: center;
}

.gift-preview.show { display: flex; }

.gift-preview-bg {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.8);
    backdrop-filter: blur(6px);
}

.gift-preview-window {
    position: relative;
    width: min(300px, calc(100% - 32px));
    background: #2d2d37;
    border: 1px solid #393946;
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 24px 60px rgba(0,0,0,.65);
    z-index: 1;
}

/* кнопки действий в превью */
.gift-preview-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.gift-btn-sell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    height: 40px;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s, transform .15s;
}

.gift-btn-sell:hover    { opacity: .88; transform: translateY(-1px); }
.gift-btn-sell:disabled { opacity: .4;  cursor: not-allowed; transform: none; }

.gift-preview-close {
    position: absolute;
    top: 10px; right: 10px;
    width: 26px; height: 26px;
    border: 1px solid #393946;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.4);
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: color .15s, border-color .15s;
}

.gift-preview-close:hover { color: #fff; border-color: #f5c518; }

.gift-preview-img-wrap {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #12121a;
}

.gift-preview-img-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.gift-preview-name {
    margin-top: 12px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.gift-preview-meta {
    margin-top: 6px;
    font-size: 12px;
    color: rgba(255,255,255,.4);
    line-height: 1.65;
}

.gift-preview-meta b   { color: rgba(255,255,255,.7); }
.gift-preview-msg {
    margin-top: 8px;
    font-style: italic;
    color: rgba(255,255,255,.65);
    background: rgba(245,197,24,.08);
    border-left: 2px solid #f5c518;
    padding: 6px 10px;
    border-radius: 0 8px 8px 0;
}

@media (max-width: 760px) {
    .gift-grid {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 4px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .gift-grid::-webkit-scrollbar { display: none; }
    .gift-card { flex: 0 0 76px; }
    .gift-send-grid { grid-template-columns: repeat(3, 1fr); }
    .gift-modal-all-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
    .gift-send-form { grid-template-columns: 1fr; }
    .gift-btn-send { width: 100%; justify-content: center; }
}
