/* =================================================================
   Админская боковая панель
   Появляется слева если у юзера есть доступ хотя бы к одному
   пункту из admin-sidebar (см. apps/core/blocks.py).
   ================================================================= */

/* Когда панель видна — сдвигаем контент вправо */
.app-header.has-sidebar {
    margin-left: 260px;
    width: calc(100% - 260px);
    transition: margin-left 0.25s ease, width 0.25s ease;
}

.page-content.with-sidebar {
    margin-left: 260px;
    width: calc(100% - 260px);
    transition: margin-left 0.25s ease, width 0.25s ease;
}

/* Свёрнутая панель — контент занимает большую часть экрана */
body.sidebar-collapsed .app-header.has-sidebar,
body.sidebar-collapsed .page-content.with-sidebar {
    margin-left: 48px;
    width: calc(100% - 48px);
}

/* Сама панель */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: #1e293b;
    color: #f1f5f9;
    z-index: 50;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    transition: width 0.25s ease;
}

/* Свёрнутая панель — оставляем 48px видимой области (для кнопки) */
.admin-sidebar.collapsed {
    width: 48px;
}

.admin-sidebar.collapsed .admin-sidebar-name,
.admin-sidebar.collapsed .admin-sidebar-title,
.admin-sidebar.collapsed .admin-sidebar-badge {
    display: none;
}

.admin-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}

.admin-sidebar-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #cbd5e1;
}

.admin-sidebar-toggle {
    background: transparent;
    border: 1px solid #475569;
    color: #cbd5e1;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
    flex-shrink: 0;
}

.admin-sidebar-toggle:hover {
    background: #334155;
    color: #f1f5f9;
}

.admin-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

/* Секции в боковой панели (Администрирование / Документы) */
.admin-sidebar-section {
    margin-bottom: 4px;
}
.admin-sidebar-section:last-child {
    margin-bottom: 0;
}
.admin-sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}
.admin-sidebar-section-icon {
    font-size: 14px;
}
.admin-sidebar-section-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* При свёрнутой панели — прячем заголовки секций */
.admin-sidebar.collapsed .admin-sidebar-section-title {
    display: none;
}

.admin-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 2px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.admin-sidebar-link:hover {
    background: #334155;
    color: #f8fafc;
}

.admin-sidebar-link.active {
    background: #3b82f6;
    color: #ffffff;
    font-weight: 600;
}

.admin-sidebar-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.admin-sidebar-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-sidebar-badge {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Скрытая кнопка показать панель (видна только в collapsed) */
.admin-sidebar-show {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 49;
    background: #1e293b;
    color: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    display: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.admin-sidebar.collapsed ~ .admin-sidebar-show {
    display: block;
}

/* При свернутой панели — кнопка должна быть видна.
   Панель сдвигается влево на 210px, оставляя 50px видимой области,
   где и находится кнопка toggle. */
.admin-sidebar.collapsed .admin-sidebar-header {
    padding: 16px 8px;
    border-bottom-color: transparent;
}

.admin-sidebar.collapsed .admin-sidebar-toggle {
    width: 32px;
    height: 32px;
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
    font-size: 18px;
    margin: 0 auto;
}

.admin-sidebar.collapsed .admin-sidebar-toggle:hover {
    background: #2563eb;
}

/* Адаптив для мобильных */
@media (max-width: 768px) {
    .app-header.has-sidebar,
    .page-content.with-sidebar {
        margin-left: 0;
        width: 100%;
    }
    .admin-sidebar {
        transform: translateX(-260px);
    }
    .admin-sidebar.mobile-open {
        transform: translateX(0);
    }
}

/* Кнопки-фильтры на странице Документы (горизонтальный ряд) */
.docs-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}
.docs-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}
.docs-filter-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
}
.docs-filter-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}
