/* ============================
   БАЗА: LIGHT + ОБЩИЙ UI
============================ */

/* Светлая тема (базовая) */

body.theme-light {
    background: #f5f6f8;
    color: #111827;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Хэдер над таблицей серверов (можно использовать и в других местах) */
.so-tech-header {
    display: flex;
    flex-direction: column;
    padding: 12px 15px;
    margin-bottom: 8px;
}

/* Верхняя часть header: заголовок и элементы управления */
.so-tech-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Блок с меню и надписью о контексте */
.so-tech-header-menu {
    width: 100%;
    margin-top: 10px;
}

.so-tech-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.so-tech-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.so-tech-subtitle {
    margin: 0;
    font-size: 12px;
    opacity: 0.75;
}

.so-tech-header-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Правое меню "Настройки" */
.settings-menu-wrapper {
    position: relative;
}

.settings-menu-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    transition: all 0.18s ease;
    user-select: none;
}

.settings-menu-btn:hover {
    background-color: rgba(15, 23, 42, 0.04);
    border-color: rgba(148, 163, 184, 0.5);
}

.settings-menu-btn:active {
    transform: scale(0.98);
}

.settings-menu-btn.active {
    background-color: rgba(15, 23, 42, 0.06);
    border-color: rgba(148, 163, 184, 0.6);
}

.settings-menu-btn-text {
    line-height: 1;
}

.settings-menu-btn-arrow {
    font-size: 10px;
    color: #666;
    transition: transform 0.2s ease;
    line-height: 1;
}

.settings-menu-btn.active .settings-menu-btn-arrow {
    transform: rotate(180deg);
}

.settings-menu-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    overflow: hidden;
}

.settings-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.settings-menu-item {
    display: block;
    padding: 10px 16px;
    color: #111827;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f0f0f0;
}

.settings-menu-item:last-child {
    border-bottom: none;
}

.settings-menu-item:hover {
    background-color: #f5f5f5;
    color: #111827;
}

.settings-menu-item:active {
    background-color: #e8e8e8;
}

.settings-menu-item-text {
    display: block;
    line-height: 1.4;
}

/* Кнопки-иконки (выход, смена темы, интеграции и т.п.) */
.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    padding: 0;
    transition:
        transform 0.15s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease;
}

.icon-btn img,
.icon-btn-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: block;
    transition: filter 0.2s ease, transform 0.15s ease;
}

/* Hover для светлой темы – лёгкий, без агрессии */
.icon-btn:hover {
    background-color: rgba(15, 23, 42, 0.04);
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.35);
}

.icon-btn:active {
    transform: scale(0.94);
}

/* Блок информации о пользователе */
.user-info-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    min-width: 120px;
}

.user-org {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.user-org-root {
    color: #dc3545;
    font-weight: 700;
}

.user-name {
    color: #666;
    font-size: 11px;
}

/* Выпадающее меню выбора организации для root */
.user-org-selector {
    position: relative;
    margin-bottom: 2px;
}
.user-org-selector-current {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    user-select: none;
}
.user-org-selector-current:hover {
    background-color: rgba(15, 23, 42, 0.05);
}
.user-org-text {
    font-weight: 600;
}
.user-org-arrow {
    font-size: 10px;
    color: #666;
    transition: transform 0.2s ease;
}
.user-org-selector-current.active .user-org-arrow {
    transform: rotate(180deg);
}
.user-org-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    min-width: 200px;
}
.user-org-dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.user-org-dropdown-item:last-child {
    border-bottom: none;
}
.user-org-dropdown-item:hover {
    background-color: #f5f5f5;
}
.user-org-dropdown-item.selected {
    background-color: #e3f2fd;
    font-weight: 600;
}
.user-org-hint {
    font-size: 10px;
    color: #999;
    font-weight: normal;
    margin-left: 8px;
}
.user-org-action {
    font-size: 11px;
    color: #4a90e2;
    font-weight: 500;
    margin-left: auto;
    padding-left: 12px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}
.user-org-dropdown-item:hover .user-org-action {
    opacity: 1;
    color: #357abd;
}

/* Авто-инверсия иконок:
   в light теме выключена, в dark переопределяем */
body.theme-light .theme-auto-invert {
    filter: none;
}

/* Уведомление о работе в контексте организации */
.org-context-notice {
    font-size: 0.9em;
    color: #666;
    margin: 5px 0 15px 0;
    font-style: italic;
    line-height: 1.4;
}

/* Плавный переход между темами (цвета/бордеры) */
body.theme-transition,
body.theme-transition * {
    transition:
        background-color .45s ease,
        color .45s ease,
        border-color .45s ease;
}

/* ============================
   СТИЛИЗАЦИЯ КОЛОНКИ "ACTIVE" В ТАБЛИЦАХ
   Общее правило на уровне шаблона
============================ */

/* Ячейка "Активен" - Да (зеленый) */
.so-smart-table__cell--active-yes {
    color: #155724;
    font-weight: 600;
    position: relative;
    padding-left: 24px;
}

.so-smart-table__cell--active-yes::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

/* Ячейка "Активен" - Нет (красный) */
.so-smart-table__cell--active-no {
    color: #721c24;
    font-weight: 600;
    position: relative;
    padding-left: 24px;
}

.so-smart-table__cell--active-no::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

/* Ячейка "Активен" - NULL (не определено, серый) */
.so-smart-table__cell--active-null {
    color: #6c757d;
    font-weight: 500;
    font-style: italic;
}

/* Стили для контента страниц */
.page-content {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.page-content h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #111827;
}

.page-description {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.page-description p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #374151;
}

.page-description ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.page-description li {
    margin-bottom: 8px;
    line-height: 1.6;
    color: #374151;
}

.placeholder-content {
    background: #ffffff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
