body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: #f4f4f4;
}

.loader {
    margin: auto;
    margin-top: 25px;
    background-image: url('/static/img/loader.gif');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 80px;
    height: 20px;
}

/* -------- HEADER ---------- */

.header {
    background: #8F2C31;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 9999;
    transition:
        padding 0.25s ease,
        height 0.25s ease;
}

.logo-link {
    display: inline-block;
}

.logo-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    transition: width 0.25s ease, height 0.25s ease;
    transform-origin: center center;
}

/* уменьшаем лого */
.header.header--compact .logo-img {
    width: 75px;
    height: 75px;
}

/* --------- TABS WIDGET (iOS STYLE) ---------- */

.tabs-widget {
    position: relative;
    width: 90%;
    margin: 25px auto;
    display: flex;
    justify-content: space-between;
}

.tabs-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 42px;
    background: #e5e5e5;
    border-radius: 22px;
}

.tab {
    flex: 1;
    z-index: 2;
    border: none;
    background: transparent;
    padding: 10px 0;
    border-radius: 22px;
    font-size: 15px;
    cursor: pointer;
    transition: 0.25s;
}

a.tab {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;     /* убираем подчёркивание */
    color: inherit;            /* не даём ссылочному цвету появляться */
    padding: 10px 0;           /* возвращаем отступ */
}

.tab,
a.tab {
    height: 42px;              /* одинаковая высота со светло-серым фоном */
    line-height: 42px;         /* идеальное вертикальное выравнивание текста */
    padding: 0;                /* убираем конфликтующий padding */
}

.tab.active {
    background: #8f2c31; /* обновлено */
    color: white;
}

.tab.active,
a.tab.active {
    height: 42px;
    line-height: 42px;
}

.tab,
a.tab {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
}

/* -------- CARDS -------- */

.channels {
    width: 90%;
    margin: 0 auto 40px;
}

.channel-card {
    display: flex;
    background: white;
    margin: 15px 0;
    border-radius: 14px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.channel-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 3px 10px rgba(0,0,0,0.28);
    margin-right: 15px;
}

.channel-info {
    flex: 1;
}

.channel-title {
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    color: #000;
}

.channel-username {
    display: inline-block;
    margin: 4px 0 10px;
    color: #0087ff;
    text-decoration: none;
}

/* -------- PARAMETERS -------- */

.params .param {
    margin-bottom: 4px;
    color: #444;
}

.params .value {
    font-weight: 700;
}

/* -------- PRICE -------- */

.price-row {
    margin-top: 12px;
    margin-bottom: 14px;
}

.price {
    font-size: 22px;      /* сделано крупнее */
    font-weight: 800;     /* ярче */
    color: #000;
}

.price-note {
    color: #999;
    margin-left: 6px;
}

/* -------- BUTTONS -------- */

.buttons {
    display: flex;
    gap: 10px;
}

.btn-buy {
    flex: 1;
    background: #e4464e;
    border: none;
    padding: 10px 0;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
}

a.btn-buy {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;    /* убираем подчёркивание */
    color: white;             /* предотвращает синий цвет для <a> */
    padding: 10px 0;          /* возвращаем отступы */
}

.btn-more {
    flex: 1;
    background: #e6e6e6;
    border: none;
    padding: 10px 0;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

a.btn-more {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;    /* убираем подчёркивание */
    color: #333;              /* фиксируем цвет */
    padding: 10px 0;          /* возвращаем отступы */
}

.channel-description {
    background: #fafafa;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.45;
    color: #333;
    margin: 12px 0 16px 0;
    border: 1px solid #eee;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05),
                0 2px 6px rgba(0,0,0,0.04);

    display: flex;
    gap: 10px;
    align-items: flex-start;
}

/* --------- CatalogueBot: новые стили карточки канала (namespace cb-) --------- */

/* Card container */
.cb-channel-card {
  border-radius: 14px;
  overflow: hidden;
  background: transparent; /* body sections inside set their own backgrounds */
  margin: 18px 0;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  border: 0;
}

/* Header area (avatar + title + username) */
.cb-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #fafafa; /* subtle top band */
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

/* Avatar */
.cb-avatar {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  flex-shrink: 0;
}

/* Header texts */
.cb-header-texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cb-title {
  font-size: 16px;
  font-weight: 700;
  color: #111;
  text-decoration: none;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-title span {
    color: #e4464e;
}

.cb-username {
  margin-top: 4px;
  font-size: 13px;
  color: #1e90ff;
  text-decoration: none;
  opacity: 0.95;
}

.cb-network {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.95;
}

/* Body (white background) */
.cb-card-body {
  background: #ffffff;
  padding: 14px 16px 18px 16px;
}

/* Params (values bold) */
.cb-params {
  font-size: 14px;
  color: #444;
  margin-bottom: 12px;
}

.cb-params div { margin-bottom: 2px; }
.cb-val { font-weight: 700; margin-left: 2px; }

/* Description block */
.cb-description {
  background: #fbfbfb;
  border-radius: 10px;
  padding: 12px 14px;
  color: #333;
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 12px;
  border: 1px solid #efefef;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03), 0 4px 8px rgba(0,0,0,0.02);
}

/* Price row: make price prominent */
.cb-price-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.cb-price {
  font-size: 20px;
  font-weight: 800;
  color: #111;
}
.cb-price-note {
  color: #8f8f8f;
  font-size: 13px;
}

/* Центровка блока цены */
.cb-price-row {
    text-align: center;
    margin: 15px 0;
}

/* Цена — увеличенная и заметная */
.cb-price {
    font-size: 24px;      /* крупнее */
    font-weight: 700;     /* жирный */
}

/* Примечание — оставляем как есть */
.cb-price-note {
    font-size: 14px;
    color: #999;
    margin-left: 6px;
}

/* Buttons layout:
   centered, two controls take most of width with small gap
*/
.cb-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

/* Generic button style — supports <a> and <button> */
.cb-btn,
a.cb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  border: 0;
  cursor: pointer;
  min-width: 140px;
  box-sizing: border-box;
}

/* Buy button — green (keeps existing green used on site) */
.cb-buy {
  background: #e4464e;
  color: #fff;
}

/* Wallet icon color matched via currentColor */
.cb-icon-wallet { width: 18px; height: 18px; display:inline-block; vertical-align:middle; }

/* More button — subtle */
.cb-more {
  background: #efefef;
  color: #222;
  font-weight: 600;
}

/* Responsive tweaks */
@media (max-width: 520px) {
  .cb-card-header { padding: 12px; gap: 10px; }
  .cb-avatar { width: 48px; height: 48px; }
  .cb-description { font-size: 13px; padding: 10px; }
  .cb-btn, a.cb-btn { min-width: 120px; padding: 10px 12px; }
}

/* Small utility to avoid conflicts: if page already sets .cb-btn as button-specific,
   the following enforces <a> appearance identical to <button> */
a.cb-btn { display: inline-flex; }

/* Увеличиваем общий базовый размер текста внутри карточки */
.cb-channel-card {
    font-size: 17px; /* было около 14–15px, теперь крупнее */
    line-height: 1.45;
}

/* Название канала — выразительнее */
.cb-title {
    font-size: 20px;
    font-weight: 700;
}

/* Username */
.cb-username {
    font-size: 15px;
}

/* Параметры */
.cb-params div {
    font-size: 16px;
}

.cb-val {
    font-weight: 700;
}

/* Кнопки — сохраняем вид как есть, но текст делаем немного крупнее */
.cb-btn {
    font-size: 17px;
}

/* Контейнер списка */
.cb-subchannels {
    margin: 18px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Элемент дочернего канала */
.cb-subchannel-item {
    display: flex;
    align-items: center;
    background: #f7f7f7;
    border-radius: 10px;
    padding: 10px;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: transform 0.12s ease;
    cursor: pointer;
}

.cb-subchannel-item:hover {
    transform: translateY(-2px);
}

/* Аватар дочернего канала */
.cb-sub-avatar {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
    flex-shrink: 0;
}

/* Текстовое содержимое */
.cb-sub-info {
    margin-left: 12px;
    display: flex;
    flex-direction: column;
}

/* Название */
.cb-sub-title {
    font-size: 16px;
    font-weight: 700;
    color: #000;
    text-decoration: none;
}

/* Username */
.cb-sub-username {
    font-size: 14px;
    color: #3b82f6;
    text-decoration: none;
    margin-top: 2px;
}

/* --- Кнопка фильтра в хедере --- */
.cb-header-filter-btn img {
    width: 22px;
    height: 22px;
    cursor: pointer;
}

/* --- Оверлей --- */
.cb-filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: .3s ease;
    z-index: 99990;
}

.cb-filter-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- Панель --- */
.cb-filter-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    background: #8f2c31;
    z-index: 99999;
    padding: 20px 18px 12px 18px;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;

    transform: translateX(-100%);
    transition: transform .15s ease-out;
}

.cb-filter-panel.active {
    transform: translateX(0);
}

/* --- Заголовок панели --- */
.cb-filter-header {
    display: flex;
    align-items: center;
    margin-bottom: 18px;
}

.cb-filter-close {
    font-size: 22px;
    color: #fff;
    cursor: pointer;
    margin-right: 10px;
}

.cb-filter-title {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
}

/* --- Контент панели --- */
.cb-filter-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.cb-filter-section {
    margin-bottom: 18px;
}

.cb-filter-label {
    color: #fff;
    font-size: 15px;
    margin-bottom: 8px;
}

.cb-filter-row {
    display: flex;
    gap: 10px;
}

.cb-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
}

/* --- Чекбоксы --- */
.cb-check-row {
    display: flex;
    align-items: center;
    color: #fff;
    margin-bottom: 7px;
    cursor: pointer;
    font-size: 15px;
}

.cb-check-row input {
    display: none;
}

.cb-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 4px;
    margin-right: 10px;
    position: relative;
}

.cb-check-row input:checked + .cb-checkbox::after {
    content: "";
    position: absolute;
    inset: 3px;
    background: #fff;
    border-radius: 2px;
}

/* --- Радиокнопки --- */
.cb-radio-row {
    display: flex;
    align-items: center;
    color: #fff;
    margin-bottom: 7px;
    cursor: pointer;
    font-size: 15px;
}

.cb-radio-row input {
    display: none;
}

.cb-radio {
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 50%;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-radio::after {
    content: "";
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    opacity: 0;
    transition: opacity .2s ease;
}

.cb-radio-row input:checked + .cb-radio::after {
    opacity: 1;
}

/* --- Кнопка Найти --- */
.cb-filter-button-container {
    margin-top: 12px;
}

.cb-btn-primary {
    background: #ffffff;
    color: #8f2c31;
    width: 100%;
    padding: 12px 0;
    font-size: 17px;
    border-radius: 10px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.cb-header-filter-btn {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 10001;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-filter-numeric-sections {
    margin-top: -5px;
    padding-bottom: 10px;
}

/* Контейнер секции */
.cb-filter-section {
    margin-bottom: 16px;
}

/* Заголовок свернутой секции */
.cb-filter-section-title {
    font-size: 16px;
    color: #ffffff;
    cursor: pointer;
    padding: 4px 0;
    display: inline-block;
    transition: color 0.2s ease;
}

.cb-filter-section--collapsed {
    margin-bottom: 6px;
}

.cb-filter-section--collapsed .cb-filter-section-title {
    /* Свернутая: белая, пунктирное подчёркивание */
    color: #ffffff;
    border-bottom: 1px dashed rgba(255,255,255,0.7);
}

.cb-filter-section--expanded .cb-filter-section-title {
    border-bottom: none;
    margin-bottom: 3px;
}

/* Тело секции (блок с инпутами) */
.cb-filter-section-body {
    overflow: hidden;
    max-height: 500px;
    opacity: 1;
    transition:
        max-height 0.25s ease,
        opacity 0.25s ease;
}

.cb-filter-section--collapsed .cb-filter-section-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

/* Контейнер сортировки */
.cb-sort {
    display: flex;
    /*justify-content: space-between;*/
    align-items: left;
    margin: 12px 0 18px 0;
    padding: 0 12px;
}

/* Элемент сортировки */
.cb-sort-item {
    display: flex;
    align-items: center;
    margin-right: 10px;
    gap: 4px;
    cursor: pointer;
    color: #a5a5a5; /* неактивный серый */
    font-size: 15px;
    transition: color 0.25s ease;
    user-select: none;
}

/* Активная — голубая */
.cb-sort-item.active {
    color: #3399ff; /* как username */
}

/* Иконка */
.cb-sort-arrow {
    width: 16px;
    height: 16px;
    transform: rotate(0deg);
    transition: transform 0.25s ease;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Если повернута вверх */
.cb-sort-item.active.asc .cb-sort-arrow {
    transform: rotate(180deg);
}


/* Контейнер бейджей — теперь отдельный элемент под заголовком */
.cb-filter-section-badges {
    display: inline-flex;
    gap: 6px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Сам бейдж */
.cb-filter-badge {
    background: rgba(255,255,255,0.15);
    color: #ffffff;
    padding: 2px 6px;
    font-size: 12px;
    border-radius: 6px;
    display: inline-block;
    cursor: pointer;
    user-select: none;
    line-height: 1.2;
}

/* ----- Empty results block (restored, centered, high-contrast) ----- */

#cb-empty-results,
.cb-empty-results {
    width: 100%;
    display: flex;
    justify-content: center;   /* строго по центру горизонтально */
    margin-top: 40px;
    margin-bottom: 40px;
}

.cb-empty-inner {
    background: #f7f7f7;                  /* светлый серый фон */
    border: 1px solid #e1e1e1;
    border-radius: 18px;
    padding: 28px 34px;
    text-align: center;
    max-width: 360px;

    box-shadow: 0 4px 12px rgba(0,0,0,0.10);
    animation: cb-empty-fadeIn 0.25s ease;
}

.cb-empty-emoji {
    font-size: 42px;
    line-height: 1;
    margin-bottom: 10px;
}

.cb-empty-text {
    font-size: 22px;
    color: #333;                          /* контрастный читаемый цвет */
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* лёгкое появление */
@keyframes cb-empty-fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cb-description-full,
.cb-subchannels {
    display: none;
}
