/* ============================================================
   ОБЩИЕ СТИЛИ
   ============================================================ */
body {
    background-color: #f8f9fa;
}

.username-nav {
    color: rgba(255, 255, 255, 0.85);
    cursor: default;
}

.card {
    border-radius: 0.375rem;
}

.table-responsive {
    overflow-x: auto;
}

/* ============================================================
   ТАБЛИЦЫ
   ============================================================ */
table th,
table td {
    padding: 10px !important;
}

.objects-table .actions-cell {
    white-space: nowrap;
}
.objects-table .actions-cell .btn {
    display: inline-block;
    margin-right: 0.25rem;
}

/* Адаптив для таблиц */
@media (max-width: 768px) {
    .objects-table .actions-cell {
        white-space: normal;
    }
    .acts-table td:last-child,
    .journal-table td:last-child {
        white-space: normal;
    }
}

/* Специфичные таблицы (АОСР, АООК) */
.acts-table td,
.acts-table th,
.acts-table-critical td,
.acts-table-critical th {
    text-align: center;
    vertical-align: middle;
}
.acts-table td:nth-child(4),
.acts-table th:nth-child(4),
.acts-table-critical td:nth-child(4),
.acts-table-critical th:nth-child(4) {
    text-align: left;
}

/* ============================================================
   НАВИГАЦИЯ
   ============================================================ */

.navbar .container-fluid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* Выравнивание всех элементов навигации по вертикали */
.navbar-nav {
    align-items: center;  /* центрируем все li по вертикали */
}

.navbar-nav .nav-link,
.navbar-nav .username-nav {
    display: flex;
    align-items: center;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    line-height: 1.5;
}

/* Аватарка внутри навигации */
.navbar-nav img.rounded-circle {
    flex-shrink: 0;   /* чтобы не сжималась */
    display: inline-block;
    vertical-align: middle;
}

/* Уведомления (колокольчик) */
.navbar .nav-link .bi-bell {
    font-size: 1.2rem;
}

/* Имя пользователя */
.username-nav {
    display: flex;
    align-items: center;
    line-height: 1.5;
}

/* Компактный режим для средних экранов */
@media (min-width: 992px) and (max-width: 1350px) {
    .navbar-nav .nav-link {
        padding-left: 0.6rem !important;
        padding-right: 0.6rem !important;
        font-size: 0.9rem;
    }
    .navbar-brand {
        font-size: 1rem;
        white-space: normal;
        max-width: 130px;
        line-height: 1.2;
    }
    .username-nav {
        font-size: 0.85rem;
        max-width: 140px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
    }
}

@media (max-width: 992px) {
    .navbar-collapse {
        background-color: #212529;
        padding: 0.75rem;
        border-radius: 0.5rem;
        margin-top: 0.5rem;
    }
    .navbar-nav .nav-item {
        text-align: center;
    }
    .username-nav {
        max-width: none;
        white-space: normal;
        text-align: center;
    }
}

/* ============================================================
   ХЛЕБНЫЕ КРОШКИ
   ============================================================ */
.breadcrumb .breadcrumb-item {
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 768px) {
    .breadcrumb .breadcrumb-item {
        max-width: 120px;
    }
}

/* ============================================================
   КНОПКИ
   ============================================================ */
.btn-lg {
    max-width: 100%;
}
@media (max-width: 576px) {
    .btn-lg.me-2 {
        margin-right: 0 !important;
    }
    .btn-lg.ms-2 {
        margin-left: 0 !important;
    }
}

/* ============================================================
   УВЕДОМЛЕНИЯ (КОЛОКОЛЬЧИК)
   ============================================================ */
.nav-link .bi-bell {
    color: #f8f9fa;        /* светло-серый, видно на тёмном фоне */
    transition: transform 0.2s ease, color 0.2s ease;
}
.nav-link .bi-bell:hover {
    color: #ffffff;
    transform: scale(1.1);
}

#notif-badge {
    font-weight: 600;
    background-color: #dc3545 !important; /* красный фон */
    color: #fff !important;
    border: 2px solid #fff; /* белая граница для контраста */
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
    min-width: 12px;
    line-height: 1;
    padding: 0.25rem 0.4rem;
    font-size: 0.45rem;
}
/* ============================================================
   ФОРУМ – обрезание длинных описаний
   ============================================================ */

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Для мобильных можно убрать обрезание */
@media (max-width: 576px) {
    .text-truncate {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}

/* ============================================================
   ФОРУМ – ОБЩИЕ СТИЛИ
   ============================================================ */
.forum-link {
    color: #253e14;
    text-decoration: none;
    font-weight: 600;
}
.forum-link:hover {
    color: #0087be;
    text-decoration: underline;
}

.forum-link-secondary {
    color: #253e14;
    text-decoration: none;
}
.forum-link-secondary:hover {
    color: #0087be;
    text-decoration: underline;
}

.post-content img {
    max-width: 100%;
    height: auto;
}
.post-content a {
    color: #253e14;
    text-decoration: underline;
}
.post-content a:hover {
    color: #0a58ca;
    text-decoration: underline;
}


/* Кнопка копирования кода */
.copy-code-btn {
    font-family: inherit;
    opacity: 0.8;
}
.copy-code-btn:hover {
    opacity: 1;
}
.post-content pre {
    position: relative;
}
/* ============================================================
   ФОРУМ – ТАБЛИЦЫ
   ============================================================ */
.forum-table th {
    background-color: #f1f3f5;
    border-bottom: 2px solid #dee2e6;
}
.forum-table td {
    vertical-align: middle;
    border-bottom: 1px solid #e9ecef;
}
.forum-table tr:hover {
    background-color: #f8f9fa;
}

/* Мобильная информация о последнем сообщении */
@media (max-width: 767px) {
    .forum-table td .d-md-none small {
        display: block;
        margin-top: 0.25rem;
        line-height: 1.4;
    }
    .forum-table td .d-md-none small a {
        font-weight: 500;
    }
}

/* ============================================================
   ФОРУМ – БЕЙДЖИ
   ============================================================ */
.badge-pin {
    background-color: #ffc107;
    color: #212529;
}
.badge-closed {
    background-color: #6c757d;
    color: #fff;
}
.badge-hot {
    background-color: #0dcaf0;
    color: #212529;
}

/* ============================================================
   ФОРУМ – КАРТОЧКА ПОСТА (двухколоночный макет)
   ============================================================ */
.forum-post .row.g-0 {
    height: 100%;
}

.post-author-card {
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
}

.post-body {
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
}

.forum-post .col-md-3,
.forum-post .col-lg-2,
.post-body .col-md-9,
.post-body .col-lg-10 {
    display: flex;
    flex-direction: column;
}

.post-body .card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.post-body .card-body .post-content {
    flex: 1 1 auto;
}
.post-body .card-body .mt-2 {
    margin-top: auto !important;
    padding-top: 0.5rem;
}

@media (max-width: 767px) {
    .post-author-card {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
}

/* ============================================================
   ФОРУМ – ЦИТАТЫ
   ============================================================ */
.forum-post blockquote,
.post-content blockquote {
    background: #f8f9fa;
    border-left: 4px solid #6c757d;
    padding: 0.75rem 1.25rem;
    margin: 1rem 0;
    border-radius: 0 4px 4px 0;
    color: #495057;
    font-size: 0.95rem;
    line-height: 1.6;
}
.forum-post blockquote p:last-child,
.post-content blockquote p:last-child {
    margin-bottom: 0;
}
.forum-post blockquote blockquote,
.post-content blockquote blockquote {
    background: #e9ecef;
    border-left-color: #adb5bd;
    margin: 0.5rem 0 0.5rem 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* ============================================================
   ФОРУМ – ПОЛЕ КОДА
   ============================================================ */
/* Стили для блоков кода в сообщениях форума и других markdown-полях */
.markdown-body pre,
.post-content pre,
.forum-post pre {
    background-color: #6c757d !important; /* bg-secondary */
    color: #f8f9fa !important;            /* text-light */
    border-radius: 0.25rem !important;    /* rounded */
    padding: 1rem !important;             /* p-3 */
    overflow-x: auto;
}

/* Дополнительно для самого кода внутри pre */
.markdown-body pre code,
.post-content pre code,
.forum-post pre code {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
}
/*

    code {
        background: #1e293b;
        color: #e2e8f0;
        padding: 0.2rem 0.5rem;
        border-radius: 6px;
        font-size: 0.9rem;
        font-family: "Fira Code", "JetBrains Mono", monospace;
    }
    pre {
        background: #0f172a;
        color: #e2e8f0;
        padding: 1.2rem;
        border-radius: 12px;
        overflow-x: auto;
        font-size: 0.9rem;
        line-height: 1.5;
        margin: 1rem 0;
        position: relative;
    }
    pre code {
        background: transparent;
        padding: 0;
        color: inherit;
        font-size: inherit;
    }*/

/* ============================================================
   ФОРУМ – ТАБЛИЦЫ MARKDOWN
   ============================================================ */
.post-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    font-size: 0.95rem;
}
.post-content th,
.post-content td {
    border: 1px solid #dee2e6;
    padding: 0.5rem;
    text-align: left;
}
.post-content th {
    background-color: #f1f3f5;
    font-weight: 600;
}
.post-content tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* ============================================================
   ФОРУМ – ПАНЕЛЬ MARKDOWN
   ============================================================ */
.editor-toolbar {
    flex-wrap: wrap;
}
.editor-toolbar button {
    flex: 0 0 auto;
}
.editor-toolbar .table {
    width: auto !important;
}

/* ============================================================
   КАРТОЧКИ УЧАСТНИКОВ
   ============================================================ */
.participants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.participant-card {
    margin: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}
.participant-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   ОБЩАЯ АДАПТИВНОСТЬ
   ============================================================ */
@media (max-width: 1200px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm {
        max-width: 100% !important;
    }
}

@media (max-width: 768px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    .btn-sm {
        display: block;
        width: 100%;
        margin-bottom: 0.25rem;
    }
    .btn-lg {
        display: block;
        /*width: 100%;*/
        margin: 0.5rem 0;
    }
}

/* ============================================================
   АНИМАЦИЯ ДЛЯ БЕЙДЖА УВЕДОМЛЕНИЙ
   ============================================================ */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}