/* ==========================================================================
   BTPro v24 — дизайн-слой темы
   Подключается ПОСЛЕДНИМ (после Bootstrap и MDB), поэтому перекрывает их без !important.
   1. Токены   2. База   3. Сетка страницы   4. Шапка   5. Блоки
   6. Компоненты Bootstrap/MDB   7. Подвал   8. Адаптив   9. Печать
   ========================================================================== */

/* 1. Токены ---------------------------------------------------------------- */
:root {
    --tp-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --tp-bg: #e2e3e4;
    --tp-surface: #ffffff;
    --tp-surface-2: #f6f7f9;
    --tp-border: #e3e6eb;
    --tp-border-strong: #d2d7de;
    --tp-text: #1d2330;
    --tp-text-2: #4b5563;
    --tp-muted: #6b7280;
    --tp-accent: #2563eb;
    --tp-accent-hover: #1d4ed8;
    --tp-accent-soft: #eaf1ff;

    --tp-radius: 14px;
    --tp-radius-sm: 10px;
    --tp-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --tp-shadow-lg: 0 10px 28px rgba(16, 24, 40, .14);

    --tp-gap: 16px;
    --tp-side: 240px;
    --tp-max: 1600px;
    --tp-nav-h: 60px;
}

/* 2. База ------------------------------------------------------------------ */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    font-family: var(--tp-font);
    font-size: .9375rem;
    color: var(--tp-text);
    background-color: var(--tp-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--tp-accent); }
a:hover { color: var(--tp-accent-hover); }

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--tp-accent);
    outline-offset: 2px;
}

::selection { background: rgba(37, 99, 235, .18); }

.main-content-wrapper { min-width: 0; }

/* Информационная строка администрации под шапкой */
.tp-info {
    display: block;
    width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.5;
    font-size: .85rem;
}

/* 3. Сетка страницы -------------------------------------------------------- */
.tp-page {
    padding: 0 var(--tp-gap) var(--tp-gap);
}

.tp-layout {
    display: flex;
    align-items: flex-start;
    gap: var(--tp-gap);
    max-width: var(--tp-max);
    margin: 0 auto;
}

.tp-left,
.tp-right {
    flex: 0 0 var(--tp-side);
    width: var(--tp-side);
    min-width: 0;
}

.tp-center {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: var(--tp-gap);
}

.tp-main  { order: 1; flex: 1 1 auto; min-width: 0; }
.tp-right { order: 2; }

/* Чат — одна колонка контента без правой колонки */
.tp-chat { display: block; }

/* Пустая колонка не съедает место (в режиме перетаскивания блоков остаётся — в неё можно бросить блок) */
.tp-right:not(:has(.blockPP, .bl_zone)) { display: none; }

.tp-content { overflow-wrap: break-word; }

/* 4. Шапка ----------------------------------------------------------------- */
.navbar-white { min-height: var(--tp-nav-h); }

.nb-container {
    max-width: var(--tp-max);
    padding-left: var(--tp-gap);
    padding-right: var(--tp-gap);
    flex-wrap: wrap;
}

.nb-brand { margin-right: 1.25rem; min-width: 0; white-space: nowrap; }

.navbar-white .nav-link i { font-size: 1rem; }

.nb-icon-btn--sm { width: 28px; height: 28px; font-size: .9rem; }

.nb-avatar {
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid var(--nb-border);
}
.nb-avatar img {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 50%;
}
.nb-avatar i { font-size: 1.05rem; }

/* Выпадающие меню шапки: style.css подключён до Bootstrap, поэтому размеры и отступы задаём здесь */
.nb-dropdown      { min-width: 300px; padding: 0; }
.nb-metrics-drop  { min-width: 280px; padding: 0; }

/* Уведомления */
.nb-notif-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 16px;
}
.nb-notif-link {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    padding: 5px 0;
    color: var(--nb-text) !important;
    text-decoration: none !important;
}
.nb-notif-link:hover { color: #fff !important; }
.nb-notif-link i { color: var(--nb-text-muted); }

/* Поиск открывается поверх всей шапки — одинаково на компьютере и телефоне */
.nb-search-bar,
.nb-search-bar.nb-search-open {
    position: absolute;
    inset: 0;
    z-index: 5;
    align-items: center;
    justify-content: center;
    padding: 0 var(--tp-gap);
    background: var(--nb-bg);
}
.nb-search-bar.nb-search-open { display: flex; }
.nb-search-inner { max-width: 760px; height: 42px; }
.nb-search-input { -webkit-appearance: none; appearance: none; }
.nb-search-input::-webkit-search-cancel-button { display: none; }

/* Кнопки для гостей */
.nb-guest {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.nb-auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    border: 1px solid var(--nb-border);
    border-radius: var(--nb-radius-pill);
    font-size: .85rem;
    font-weight: 600;
    color: var(--nb-text) !important;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.nb-auth-btn:hover { background: var(--nb-hover-bg); border-color: var(--nb-accent); }
.nb-auth-btn--primary {
    background: var(--nb-accent);
    border-color: var(--nb-accent);
    color: #fff !important;
}
.nb-auth-btn--primary:hover { background: #3b7bea; border-color: #3b7bea; }

/* Статистика пользователя в мобильном меню */
.nb-mobile-stat {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--nb-border);
    border-radius: var(--nb-radius);
    background: var(--nb-surface);
    font-size: .82rem;
    color: var(--nb-text-muted) !important;
    text-decoration: none !important;
}
.nb-mobile-stat__item { display: inline-flex; align-items: center; gap: 4px; }
.nb-mobile-stat strong { color: var(--nb-text); font-weight: 700; }

/* 5. Блоки ----------------------------------------------------------------- */
.tp-block {
    background: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: var(--tp-radius);
    box-shadow: var(--tp-shadow);
    margin-bottom: var(--tp-gap);
}

.tp-block > .howOff2 {
    z-index: 2;
    padding: 6px 8px;
    color: var(--tp-muted);
    cursor: grab;
}

.tp-block .blocktitles {
    padding: 12px 14px 2px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--tp-muted);
}
.tp-block .blocktitles:empty { display: none; }

.tp-block__body {
    padding: 8px 10px 10px;
    min-width: 0;
    overflow-wrap: break-word;
}

/* Карточки, у которых уже есть своё оформление, внутри блока становятся «плоскими» */
.tp-block .sb-login-card { max-width: none; padding: 6px 4px; background: transparent; }
.tp-block .dj-card-wrap  { max-width: none; }
.tp-block .dj-card       { padding: 6px 4px; box-shadow: none; background: transparent; }
.tp-block .sb-wrapper    { width: auto; max-width: none; padding: 2px 0; border: 0; box-shadow: none; }
.tp-block .prs-wrap      { max-width: none; border: 0; border-radius: 0; box-shadow: none; }
.tp-block .psc-wrap      { border: 0; padding: 8px 4px; }

/* Центральные блоки (новости, слайдер) */
.tp-content > .blockPP,
.tp-content > .bl_zone > .blockPP { margin-bottom: var(--tp-gap); }

/* Ручка перетаскивания бесполезна на сенсорных экранах */
@media (hover: none) {
    .howOff2 { display: none !important; }
}

/* 6. Компоненты Bootstrap/MDB ---------------------------------------------- */
.btn:not(.btn-rounded):not(.btn-floating):not(.btn-close) {
    border-radius: var(--tp-radius-sm);
}
.btn {
    text-transform: none;
    letter-spacing: .01em;
    font-weight: 600;
}

.dropdown-menu {
    border: 1px solid var(--tp-border);
    border-radius: 12px;
    box-shadow: var(--tp-shadow-lg);
}

.modal-content { border-radius: var(--tp-radius); }
.alert         { border-radius: var(--tp-radius-sm); }

.form-control,
.form-select { border-radius: var(--tp-radius-sm); }

/* 7. Подвал ---------------------------------------------------------------- */
.tp-footer {
    background: var(--nb-bg);
    border-top: 1px solid var(--nb-border);
    color: var(--nb-text-muted);
    font-size: .82rem;
}
.tp-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    max-width: var(--tp-max);
    margin: 0 auto;
    padding: 16px var(--tp-gap);
}
.tp-footer a {
    color: var(--nb-text-muted);
    text-decoration: none;
    transition: color .15s;
}
.tp-footer a:hover { color: var(--nb-text); }
.tp-footer .ri-copyright-line { margin-right: 6px; vertical-align: -2px; }

/* 8. Адаптив --------------------------------------------------------------- */

/* Ноутбук / планшет горизонтально: правая колонка уходит под контент */
@media (max-width: 1279.98px) {
    .tp-center { flex-direction: column; align-items: stretch; }
    .tp-right {
        width: auto;
        flex: none;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: var(--tp-gap);
        align-items: start;
    }
    .tp-right > .tp-block { margin-bottom: 0; }
}

/* Телефон и планшет: одна колонка, контент первым */
@media (max-width: 991.98px) {
    :root { --tp-gap: 12px; }

    .tp-layout { flex-direction: column; align-items: stretch; }
    .tp-center { order: 1; }
    .tp-left   { order: 2; width: auto; flex: none; }

    .tp-left .container-area {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: var(--tp-gap);
        align-items: start;
    }
    .tp-left .container-area > .tp-block { margin-bottom: 0; }

    /* Широкие таблицы и старые макеты прокручиваются внутри контента, а не всей страницей */
    .tp-main { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    .tp-main iframe,
    .tp-main video,
    .tp-main embed,
    .tp-main object,
    .tp-main textarea,
    .tp-main select,
    .tp-main input { max-width: 100%; }

    .tp-main pre { white-space: pre-wrap; word-break: break-word; }

    /* Вложенные колонки внутри страниц (details.php, userdetails.php) — друг под другом.
       !important нужен, чтобы перекрыть inline-стили width/padding в разметке страниц. */
    .tp-main .cool-lg-3,
    .tp-main .cool-r-2 {
        float: none !important;
        width: auto !important;
        padding: 0 !important;
        margin-bottom: var(--tp-gap);
    }
    .tp-main .cool-lg-6  { padding: 0 !important; }
    .tp-main .cool-center { margin-right: 0 !important; }

    .leftcolumn,
    .rightcolumn { width: 100% !important; }

    .rpv6-layout-new { grid-template-columns: 1fr; padding: 0; }
    .rpv6-sidebar-new { position: static; }
    .aw-acp-grid { grid-template-columns: repeat(2, 1fr); }

    /* Шапка: иконки рядом с логотипом, разделы — в выпадающем меню */
    .nb-actions {
        margin: 0 0 0 auto;
        padding: 0;
        border-top: 0;
        flex-wrap: nowrap;
        gap: 2px;
    }
    .navbar-white .navbar-toggler { margin-left: 6px; }
    .navbar-white .navbar-collapse { padding: 8px 0 14px; }
    #nb-nav-links .nav-link { padding: .7rem .8rem !important; font-size: .95rem; }
    .navbar-white .nav-link.active::after { display: none; }

    /* Поля ввода от 16px — иначе iOS увеличивает страницу при фокусе */
    input[type="text"],
    input[type="search"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input:not([type]),
    textarea,
    select { font-size: 16px !important; }
}

@media (max-width: 575.98px) {
    .tp-page { padding-left: 10px; padding-right: 10px; }
    .nb-container { padding-left: 10px; padding-right: 10px; }

    .nb-brand { margin-right: .5rem; font-size: .95rem; }
    .nb-brand img.img-zum { width: 22px; height: 22px; }
    .nb-icon-btn { width: 36px; height: 36px; }
    .nb-avatar img { width: 30px; height: 30px; }

    /* В .navbar Bootstrap не использует Popper — на узком экране меню уведомлений растягиваем по ширине под шапкой */
    .nb-actions .nb-dropdown[data-bs-popper] {
        position: fixed;
        top: calc(var(--tp-nav-h) - 2px);
        left: 10px;
        right: 10px;
        min-width: 0;
    }
    .navbar-white .navbar-toggler { padding: 4px 7px; }
    .navbar-white .navbar-toggler-icon { width: 1.25em; height: 1.25em; }

    .nb-auth-btn { height: 34px; padding: 0 12px; font-size: .8rem; }
    .nb-auth-btn i { display: none; }

    .tp-left .container-area { grid-template-columns: 1fr; }
    .tp-right { grid-template-columns: 1fr; }

    /* Картинки из BB-кодов имеют inline max-width: 500px — на узком экране ограничиваем шириной контента */
    .plsresizeme,
    .plsresizeme2 { max-width: 100% !important; height: auto !important; }
}

@media (prefers-reduced-motion: reduce) {
    .ngoo { animation: none !important; }
}

/* 9. Печать ---------------------------------------------------------------- */
@media print {
    .navbar, .tp-left, .tp-right, .tp-footer, .howOff2 { display: none !important; }
    .tp-page { padding: 0; }
    .tp-main { overflow: visible; }
    body, .main-content-wrapper { background: #fff !important; }
}
