/* ============================================================
   GET_SYSTEM.CSS - ГЛОБАЛЬНЫЕ СТИЛИ PORTAL24
   ============================================================ */

/* ============ P24 HEADER (Жесткая флекс-структура) ============ */
.p24-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important; /* Прижимает левую и правую часть по краям */
    flex-wrap: nowrap !important; /* Запрещает перенос элементов на новую строку */
    gap: 12px;
    padding: 8px 16px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 1030;
    transition: background-color 0.3s, border-color 0.3s;
    width: 100%;
}

.p24-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

/* Обертка для левой части (лого + меню) */
.p24-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Обертка для правой части (виджеты + кнопки) */
.p24-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.p24-global-search {
    position: relative;
    display: flex;
    align-items: center;
    background: #f1f3f5;
    border-radius: 10px;
    padding: 6px 12px;
    gap: 8px;
    transition: background-color 0.3s;
}

.p24-global-search i { color: #6c757d; }

.p24-global-search input {
    border: 0;
    background: transparent;
    outline: 0;
    flex: 1;
    font-size: 14px;
}

.p24-search-shortcut {
    font-size: 11px;
    color: #6c7c8d;
    border: 1px solid #dee2e6;
    padding: 1px 6px;
    border-radius: 4px;
    background: #fff;
}

/* ============ P24 LAYOUT (САЙДБАР + КОНТЕНТ) ============ */
.p24-layout {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: stretch;
}

.p24-layout-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e9ecef;
    padding: 16px 12px;
    transition: background-color 0.3s, border-color 0.3s;
}

.p24-layout-content {
    background: #f8f9fa;
    min-height: calc(100vh - 56px);
    flex-grow: 1;
    transition: background-color 0.3s;
}

/* ============ P24 SIDEBAR ============ */
.p24-sidebar { width: 100%; }

.p24-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.p24-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #495057;
    font-size: 14px;
    transition: all .15s ease;
}

.p24-sidebar .nav-link:hover {
    background: #f1f3f5;
    color: #2563eb;
}

.p24-sidebar .nav-link.active {
    background: #e7f0ff;
    color: #2563eb;
    font-weight: 600;
}

.p24-sidebar-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f8f9fa;
    font-size: 13px;
    margin-bottom: 8px;
    transition: background-color 0.3s;
}

/* ============ HEADER WIDGETS ============ */
#header-widgets {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: #495057;
    white-space: nowrap;
}

.header-widget {
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.2s ease;
}

.header-widget:hover { opacity: 0.7; }
.header-widget b { color: #2563eb; }

/* ============ OFF-CANVAS ============ */
.p24-offcanvas { max-width: 280px; }

.p24-offcanvas .nav-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: #495057;
    font-size: 14px;
}

.p24-offcanvas .nav-link:hover {
    background: #f1f3f5;
    color: #2563eb;
}

/* ============ ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ ============ */
#theme_switcher, #theme_switcher_mobile {
    user-select: none;
    cursor: pointer;
}

#theme_switcher .form-check-input,
#theme_switcher_mobile .form-check-input {
    cursor: pointer;
    width: 2.5em;
    height: 1.4em;
    margin-top: 0.15em;
}

#theme_switcher .form-check-label,
#theme_switcher_mobile .form-check-label {
    cursor: pointer;
    font-size: 1.1rem;
    color: #6c757d;
    transition: color 0.3s;
}

[data-bs-theme="dark"] #theme_switcher .form-check-label,
[data-bs-theme="dark"] #theme_switcher_mobile .form-check-label {
    color: #ffc107;
}

/* ============ PRELOADER ============ */
.preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    transition: opacity .35s ease, visibility .35s ease;
}

.preloader__image {
    width: 80px;
    height: 80px;
    color: #2563eb;
    animation: p24-spin 1.2s linear infinite;
}

.preloader.preloader--hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@keyframes p24-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============ РЕЖИМ ДЛЯ СЛАБОВИДЯЩИХ ============ */
body.body-vision {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-size: 1.25rem !important;
}

body.body-vision .p24-hero-new,
body.body-vision .p24-header,
body.body-vision .p24-layout-content,
body.body-vision .p24-group-card,
body.body-vision .p24-service-card-mini,
body.body-vision .p24-ai-card-hero {
    background: #ffffff !important;
    background-image: none !important;
    box-shadow: none !important;
    border: 2px solid #000000 !important;
}

body.body-vision h1, body.body-vision h2, body.body-vision h3,
body.body-vision h4, body.body-vision h5, body.body-vision h6,
body.body-vision p, body.body-vision span, body.body-vision a,
body.body-vision div, body.body-vision .p24-hero-title {
    color: #000000 !important;
}

body.body-vision a {
    text-decoration: underline !important;
    color: #0000cc !important;
    font-weight: bold !important;
}

body.body-vision button, body.body-vision .btn {
    border: 2px solid #000 !important;
    font-size: 1.1rem !important;
    font-weight: bold !important;
}

body.body-vision i.bi { color: #000 !important; }

body.body-vision .p24-chip {
    border: 1px solid #000 !important;
    background: #fff !important;
    color: #000 !important;
}

/* ============================================================
   ТЕМНАЯ ТЕМА (ГЛОБАЛЬНЫЕ ЭЛЕМЕНТЫ)
   ============================================================ */
[data-bs-theme="dark"] body {
    background-color: #0f172a;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .p24-header {
    background-color: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
}

[data-bs-theme="dark"] .p24-header .text-dark,
[data-bs-theme="dark"] .p24-header .btn-link {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .p24-header .btn-link:hover {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .p24-global-search {
    background: #334155 !important;
}

[data-bs-theme="dark"] .p24-global-search input {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .p24-search-shortcut {
    background: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
}

[data-bs-theme="dark"] .p24-layout-sidebar {
    background: #1e293b;
    border-right-color: #334155;
}

[data-bs-theme="dark"] .p24-layout-content {
    background: #0f172a;
}

[data-bs-theme="dark"] .p24-sidebar .nav-link {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .p24-sidebar .nav-link:hover,
[data-bs-theme="dark"] .p24-sidebar .nav-link.active {
    background: #334155;
    color: #60a5fa;
}

[data-bs-theme="dark"] .p24-sidebar-widget {
    background: #334155;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .header-widget,
[data-bs-theme="dark"] .header-widget a {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .header-widget b {
    color: #60a5fa;
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1e293b;
    border-color: #334155;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #334155;
    color: #ffffff;
}

[data-bs-theme="dark"] .dropdown-divider {
    border-color: #334155;
}

[data-bs-theme="dark"] #page-footer {
    background-color: #1e293b !important;
    border-top: 1px solid #334155 !important;
    color: #cbd5e1 !important;
}

[data-bs-theme="dark"] #page-footer a {
    color: #60a5fa !important;
}

[data-bs-theme="dark"] #page-footer .text-muted {
    color: #94a3b8 !important;
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */
@media (max-width: 991.98px) {
    .p24-layout-sidebar { display: none; }
    .p24-layout-content { min-height: auto; }
    #header-widgets { gap: 8px; font-size: 0.75rem; }
    .header-widget[title="Курсы валют"] { display: none !important; }
    #btn_accessible_version, #btn_fullscreen { display: none !important; }
    #theme_switcher { display: none !important; }
}

@media (max-width: 575.98px) {
    .p24-header {
        padding: 8px 10px; /* Уменьшаем отступы на очень маленьких экранах */
    }
    #header-widgets {
        display: none; /* Скрываем виджеты на телефонах, чтобы не ломать шапку */
    }
}