/* =============================================================
   Background module — slim theme
   ============================================================= */

:root {
    --bg-card:        rgb(36, 39, 49);
    --bg-card2:       rgb(44, 47, 60);
    --bg-border:      rgb(55, 59, 74);
    --bg-primary:     rgb(251, 71, 75);
    --bg-primary-dim: rgba(251, 71, 75, 0.18);
    --bg-text:        rgb(165, 169, 180);
    --bg-text-bright: rgb(220, 222, 230);
    --bg-success:     rgb(36, 227, 77);
    --bg-radius:      10px;
    --bg-radius-sm:   6px;
    --bg-transition:  0.22s ease;
}

/* ── Страница /background ────────────────────────────────────── */
.bg-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: var(--bg-radius);
    margin-bottom: 20px;
}

.bg-page-header__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bg-text-bright);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

.bg-page-header__title i {
    color: var(--bg-primary);
    margin-right: 8px;
}

.bg-page-header__hint {
    font-size: 0.8125rem;
    color: var(--bg-text);
}

/* ── Сетка фонов ────────────────────────────────────────────── */
.bg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

@media (max-width: 575px) {
    .bg-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* ── Карточка фона ──────────────────────────────────────────── */
.bg-item {
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: var(--bg-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--bg-transition), border-color var(--bg-transition), box-shadow var(--bg-transition);
}

.bg-item:hover {
    transform: translateY(-3px);
    border-color: var(--bg-primary);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 0 1px var(--bg-primary);
}

.bg-item--active {
    border-color: var(--bg-success) !important;
    box-shadow: 0 0 0 2px var(--bg-success), 0 8px 24px rgba(36,227,77,0.2) !important;
}

.bg-item--locked {
    opacity: 0.85;
}

/* Превью */
.bg-item__preview {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background-size: cover;
    background-position: center;
    background-color: var(--bg-card2);
}

.bg-item--locked .bg-item__preview {
    filter: blur(3px) brightness(0.6);
}

.bg-item__lock,
.bg-item__check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.bg-item__lock  { color: rgba(255,255,255,0.7); }
.bg-item__check { color: var(--bg-success); }

/* Название */
.bg-item__name {
    padding: 10px 12px 4px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--bg-text-bright);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Кнопки карточки */
.bg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 6px 10px 10px;
    padding: 7px 12px;
    border-radius: var(--bg-radius-sm);
    border: 1px solid transparent;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity var(--bg-transition), filter var(--bg-transition);
    text-align: center;
}

.bg-btn--apply {
    background: var(--bg-success);
    color: rgb(27, 29, 36);
    border-color: var(--bg-success);
}

.bg-btn--apply:hover { filter: brightness(1.1); }

.bg-btn--remove {
    background: transparent;
    color: var(--bg-text);
    border-color: var(--bg-border);
}

.bg-btn--remove:hover {
    border-color: var(--bg-primary);
    color: var(--bg-primary);
}

.bg-btn--buy {
    background: var(--bg-primary);
    color: #fff;
    border-color: var(--bg-primary);
}

.bg-btn--buy:hover { opacity: 0.85; }

.bg-btn.w-100 { width: calc(100% - 20px); }

/* ── Виджет в профиле ───────────────────────────────────────── */
.bg-widget {
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: var(--bg-radius);
    padding: 16px;
}

.bg-widget__title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--bg-text-bright);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
}

/* В виджете профиля — 3 колонки */
.bg-widget .bg-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

/* ── Фон профиля (.profile-page-top-background) ─────────────── */
.profile-page-top-background {
    transition: background-image 0.5s ease, opacity 0.5s ease;
}

/* ── Текущий фон — полоса статуса ───────────────────────────── */
.bg-current-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card2);
    border: 1px solid var(--bg-border);
    border-radius: var(--bg-radius-sm);
    margin-bottom: 20px;
    font-size: 0.8125rem;
    color: var(--bg-text);
}

.bg-current-bar__preview {
    flex: 0 0 48px;
    height: 32px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--bg-border);
}

.bg-current-bar__label { color: var(--bg-text-bright); font-weight: 600; }

/* ── Лоадер ─────────────────────────────────────────────────── */
.bg-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    color: var(--bg-text);
    font-size: 0.875rem;
    gap: 8px;
}
