/* ===== МАГАЗИН (portal_shop.css) ===== */

.user-balance {
    display: flex;
    gap: 20px;
    background: rgba(0,0,0,0.3);
    padding: 10px 20px;
    border-radius: 40px;
    border: 2px solid #b8860b;
    font-size: 18px;
    font-weight: 600;
}

.balance-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffd966;
}

.balance-item img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Сетка товаров */
.items-grid,
.gifts-grid,
.shop-items-selector .items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

/* Карточка товара */
.item-card,
.gift-card {
    background: linear-gradient(145deg, rgba(44,30,21,0.95), rgba(26,17,12,0.95));
    border: 2px solid #8b5a2b;
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.item-card.selectable {
    cursor: pointer;
}

.item-card.selectable:hover {
    border-color: #ffd700;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.7), 0 0 20px rgba(255,215,0,0.3);
}

.item-card.selected {
    border-color: #ffd700;
    box-shadow: 0 0 0 2px #ffd700, 0 10px 25px #000;
    background: linear-gradient(145deg, #5a3e2b, #3f2e22);
}

.item-preview {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    border: 2px solid #b8860b;
    margin-bottom: 10px;
    background-size: cover;
    background-position: center;
    background-color: #2b1e0e;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.item-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.item-name {
    font-size: 14px;
    font-weight: 600;
    color: #ffd966;
    margin-bottom: 8px;
    line-height: 1.3;
    min-height: 36px;
}

.item-price {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.price {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.5);
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.price.coins {
    color: #ffd966;
    border: 1px solid #ffd966;
}

.price.diamonds {
    color: #a0d6ff;
    border: 1px solid #a0d6ff;
}

.price img {
    width: 16px;
    height: 16px;
}

.free {
    color: #4caf50;
    font-weight: 600;
    background: rgba(76,175,80,0.2);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 13px;
}

.owned {
    color: #4caf50;
    font-size: 13px;
    font-weight: 600;
    background: rgba(76,175,80,0.2);
    padding: 3px 10px;
    border-radius: 20px;
}

.buy-small,
.gift-send-btn {
    background: linear-gradient(145deg, #a0522d, #8b4513);
    border: 2px solid #b8860b;
    border-radius: 30px;
    padding: 5px 15px;
    color: #ffd966;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 5px;
    width: 100%;
}

.buy-small:hover,
.gift-send-btn:hover {
    background: linear-gradient(145deg, #8b4513, #5d2906);
    border-color: #ffd700;
    color: #fff;
    transform: scale(1.02);
}

/* Стили для подарков */
.gifts-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    margin-top: 20px;
}

.gift-card {
    padding: 20px 10px;
}

.gift-icon {
    font-size: 48px;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 8px gold);
}

.gift-card h4 {
    color: #ffd966;
    font-size: 16px;
    margin-bottom: 8px;
}

.gift-details {
    font-size: 13px;
    color: #b8a58e;
    margin-bottom: 10px;
    min-height: 40px;
}

.gift-reward {
    background: rgba(255,215,0,0.1);
    padding: 3px 8px;
    border-radius: 20px;
    margin: 3px 0;
}

.gift-price {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.gift-send-btn {
    width: auto;
    padding: 8px 20px;
}

/* Убедимся, что селектор достаточно специфичен */
.profile-page .shop-items-selector {
    width: 100%;
    overflow-x: auto; /* горизонтальный скролл на очень узких экранах */
}

.profile-page .items-grid {
    display: grid !important; /* принудительно включаем grid */
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 15px !important;
}

.profile-page .item-card {
    min-width: 150px;
    width: 100%;
    box-sizing: border-box;
}

/* Вкладки магазина */
.shop-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    border: 1px solid #8b5a2b;
}

.shop-tabs .tab-button {
    padding: 10px 20px;
    background: linear-gradient(145deg, #3f2e22, #2b1e0e);
    border: 2px solid #b8860b;
    border-radius: 30px;
    color: #fff8e7;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-tabs .tab-button.active {
    background: linear-gradient(145deg, #b8860b, #8b5a2b);
    color: #1f140c;
    border-color: #ffd700;
    box-shadow: 0 0 15px gold;
}

/* Карточка товара в магазине */
.shop-item {
    background: linear-gradient(145deg, rgba(44,30,21,0.98), rgba(26,17,12,0.98));
    border: 2px solid #8b5a2b;
    border-radius: 16px;
    padding: 20px 15px;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 5px 15px #000;
}

.shop-item:hover {
    border-color: #ffd700;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px #000, 0 0 20px rgba(255,215,0,0.2);
}

.shop-item.owned {
    opacity: 0.9;
    border-color: #4caf50;
}

.item-preview {
    width: 120px;
    height: 120px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    border: 2px solid #b8860b;
    overflow: hidden;
}

.smiles-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    padding: 10px;
}

.preview-smile {
    font-size: 24px;
}

.stickers-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    padding: 5px;
}

.preview-sticker {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.shop-item h3 {
    font-size: 18px;
    color: #ffd966;
    margin-bottom: 8px;
}

.item-description {
    font-size: 13px;
    color: #b8a58e;
    margin-bottom: 12px;
    line-height: 1.4;
}

.owned-badge {
    display: inline-block;
    background: rgba(76,175,80,0.2);
    color: #4caf50;
    border: 1px solid #4caf50;
    border-radius: 20px;
    padding: 5px 15px;
    font-weight: 600;
    font-size: 14px;
}

.buy-btn {
    background: linear-gradient(145deg, #a0522d, #8b4513);
    border: 2px solid #b8860b;
    border-radius: 30px;
    padding: 8px 25px;
    color: #ffd966;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: auto;
    margin-top: 5px;
}

.buy-btn:hover {
    background: linear-gradient(145deg, #8b4513, #5d2906);
    border-color: #ffd700;
    color: #fff;
    transform: scale(1.02);
}

.sold-out {
    opacity: 0.6;
    filter: grayscale(0.3);
    border-color: #666;
}
.sold-out-badge {
    display: inline-block;
    background: #8b0000;
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}
.no-data {
    color: #b8a58e;
    text-align: center;
    padding: 20px;
}
/* Модальное окно для предпросмотра образов */
#avatarPreviewModal .modal-body {
    background: rgba(0,0,0,0.8);
    border-radius: 12px;
}
#avatarPreviewModal img {
    border: 3px solid #b8860b;
    background: #1f140c;
    object-fit: contain;
}


/* Простое модальное окно для изображений */
.modal_image_div {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    border-radius: 12px;
    padding: 12px;
    z-index: 10001;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    border: 2px solid #b8860b;
    max-width: 98vw;
    max-height: 98vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal_close_simple {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.7);
    border: 2px solid #b8860b;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}
.modal_close_simple:hover {
    background: #b8860b;
}
.modal_close_simple .closeButton span {
    background-color: #ffd966;
}
.modal_close_simple:hover .closeButton span {
    background-color: #1f140c;
}

/* ===== УНИКАЛЬНЫЕ И ОБЫЧНЫЕ ОБРАЗЫ (АВАТАРЫ) ===== */
.avatar-container {
    padding: 0;
}

.avatar-preview-section {
    margin-bottom: 30px;
    text-align: center;
}

.avatar-preview-frame {
    background: rgba(0,0,0,0.4);
    border-radius: 20px;
    padding: 20px;
    border: 2px solid #8b5a2b;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.5), 0 10px 25px rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: inline-block;
    width: auto;
    max-width: 100%;
}

.avatar-full-preview {
    max-width: 490px;
    max-height: 450px;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.avatar-preview-frame.no-avatar {
    padding: 60px 20px;
    color: #b8a58e;
    font-size: 1.2rem;
    text-align: center;
}

.avatar-thumbnails-wrapper {
    margin-bottom: 20px;
}

.avatar-thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    padding: 10px;
    max-height: 350px;
    overflow-y: auto;
    background: rgba(0,0,0,0.2);
    border-radius: 16px;
    border: 1px solid #8b5a2b;
    scrollbar-width: thin;
    scrollbar-color: #b8860b #2b1e0e;
}

.avatar-thumbnails-grid::-webkit-scrollbar {
    width: 8px;
}
.avatar-thumbnails-grid::-webkit-scrollbar-track {
    background: #2b1e0e;
    border-radius: 10px;
}
.avatar-thumbnails-grid::-webkit-scrollbar-thumb {
    background: #b8860b;
    border-radius: 10px;
    border: 1px solid #8b5a2b;
}

.avatar-thumbnail-card {
    background: linear-gradient(145deg, rgba(44,30,21,0.95), rgba(26,17,12,0.95));
    border: 2px solid #8b5a2b;
    border-radius: 14px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 5px 12px rgba(0,0,0,0.4), inset 0 0 15px rgba(212,175,55,0.05);
    backdrop-filter: blur(2px);
    min-height: 180px; /* чтобы поместились кнопки */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.avatar-thumbnail-card:hover {
    border-color: #ffd700;
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.6), 0 0 15px rgba(255,215,0,0.3);
}

.avatar-thumbnail-card.active {
    border-color: #27ae60;
    box-shadow: 0 0 15px rgba(46,204,113,0.4);
}

.avatar-thumbnail-card.sold-out {
    opacity: 0.7;
    filter: grayscale(0.3);
    cursor: default;
    pointer-events: none;
}
.avatar-thumbnail-card.sold-out:hover {
    transform: none;
    border-color: #8b5a2b;
}

.avatar-thumbnail-card.owned {
    border-color: #4caf50;
}

.avatar-thumbnail-image {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0,0,0,0.4);
    border: 1px solid #b8860b;
    margin-bottom: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-thumbnail-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.avatar-lock-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.8);
    color: #ffd966;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 1px solid #8b5a2b;
}

.sold-out-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #8b0000;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 1px solid #ff6666;
}

.avatar-thumbnail-overlay {
    padding: 5px;
}

.avatar-thumbnail-action {
    font-size: 0.8rem;
    color: #ffd966;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.avatar-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.portal-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 40px;
    transition: all 0.2s;
    border: 2px solid transparent;
    cursor: pointer;
    font-family: inherit;
    min-width: 150px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 0 #3a281a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.portal-btn-primary {
    background: linear-gradient(145deg, #b8860b, #8b5a2b);
    color: #1f140c;
    border-color: #d4af37;
}

.portal-btn-primary:hover {
    background: linear-gradient(145deg, #8b5a2b, #b8860b);
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #3a281a, 0 0 15px gold;
}

.owned-badge {
    display: inline-block;
    background: rgba(76,175,80,0.2);
    color: #4caf50;
    border: 1px solid #4caf50;
    border-radius: 20px;
    padding: 4px 10px;
    font-weight: 600;
    font-size: 11px;
    margin-top: 5px;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .avatar-thumbnails-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }
    .avatar-full-preview {
        max-width: 100%;
        max-height: 300px;
    }
    .portal-btn {
        padding: 8px 20px;
        font-size: 14px;
        min-width: 120px;
    }
}

/* Информационная панель образа (название, описание, цена) */
.avatar-info-panel {
    margin-top: 15px;
    padding: 12px 15px;
    background: rgba(0,0,0,0.5);
    border-radius: 12px;
    border: 1px solid #8b5a2b;
    text-align: center;
    backdrop-filter: blur(8px);
}

.avatar-title-preview {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffd966;
    margin: 0 0 8px 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.avatar-desc-preview {
    font-size: 0.85rem;
    color: #f0e6d2;
    margin: 0 0 10px 0;
    line-height: 1.4;
    max-height: 80px;
    overflow-y: auto;
}

.avatar-price-preview {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.avatar-price-preview .price {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.5);
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
}

.avatar-price-preview .price.coins {
    color: #ffd966;
    border: 1px solid #ffd966;
}

.avatar-price-preview .price.diamonds {
    color: #a0d6ff;
    border: 1px solid #a0d6ff;
}

.avatar-price-preview .price img {
    width: 18px;
    height: 18px;
}

.avatar-price-preview .free {
    background: rgba(76,175,80,0.2);
    color: #4caf50;
    border: 1px solid #4caf50;
    border-radius: 30px;
    padding: 5px 15px;
    font-weight: 600;
}
/* Кнопки для образов */
.avatar-actions-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}
.avatar-action-btn {
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    border: 1px solid #b8860b;
    background: linear-gradient(145deg, #3f2e22, #2b1e0e);
    color: #ffd966;
    cursor: pointer;
    transition: all 0.2s;
}
.avatar-action-btn:hover {
    background: #b8860b;
    color: #1f140c;
    border-color: #ffd700;
}
.hide-face-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.status-badge.enabled {
    background: rgba(46,204,113,0.2);
    color: #2ecc71;
    border: 1px solid #2ecc71;
}
.status-badge.disabled {
    background: rgba(231,76,60,0.2);
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.avatar-preview-section {
    width: 100%;
    text-align: center;
    margin-bottom: 30px;
}
.avatar-preview-frame {
    background: rgba(0,0,0,0.4);
    border-radius: 20px;
    padding: 20px;
    border: 2px solid #8b5a2b;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.5), 0 10px 25px rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 200px;
}
.avatar-full-preview {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    display: block;
    object-fit: contain;
}