/* --- СТИЛІ РОЗУМНОГО ПОШУКУ ТА СОРТУВАННЯ КАТЕГОРІЙ --- */

/* Анімація пульсації для онлайн-користувачів */
@keyframes pulse-green {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.text-success.bi-circle-fill {
    animation: pulse-green 2s infinite;
}

/* Розумний пошук у модалці */
.smart-search-results {
    max-height: 200px;
    overflow-y: auto;
    position: absolute;
    width: 100%;
    z-index: 3000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.cursor-move { cursor: grab; }
.cursor-move:active { cursor: grabbing; }

/* Обмежений скрол для обраних категорій */
#menu-selected-cats {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #eee;
    background: #fafafa;
}

/* Мінімальні правки для накладання модалок одна на одну */
.modal {
    background: rgba(0, 0, 0, 0.4); /* Власне затемнення для кожної модалки */
}

/* Якщо відкрито дві модалки одночасно */
.modal.show:nth-of-type(even) {
    z-index: 1061 !important;
}
.modal-backdrop.show:nth-of-type(even) {
    z-index: 1060 !important;
}

/* Рівні накладання вікон */
#auditModal { z-index: 1060; }
#filterValuesModal { z-index: 1070; }
#attrProductsModal { z-index: 1080; }
#productEditModal { z-index: 1100 !important; } /* Найвищий пріоритет */

/* Корекція фону (backdrop) для вкладених модалок */
.modal-backdrop.show:nth-of-type(even) {
    z-index: 1090 !important;
}

/* Вимикаємо стандартний фон Bootstrap, бо ми додали фон у саму .modal */
.modal-backdrop {
    display: none !important;
}

/* Дозволяємо скрол всередині модалок */
.modal-open {
    overflow: hidden !important;
}

/* --- СТИЛІ СКОЛУ МОДАЛОК --- */

/* Примусовий скрол для тіла модалки, якщо стандартний не спрацював */
.modal-dialog-scrollable .modal-body {
    max-height: 75vh;
    overflow-y: auto;
}

/* Щоб шапка таблиці не "з'їжджала" при скролі */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: white;
}

/* Стилі для тонкого скроллбара в таблицях */
.table-responsive::-webkit-scrollbar {
    width: 8px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: #cbd5e0;
    border-radius: 10px;
    border: 2px solid #ffffff;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f7fafc;
}

/* Фікси для шапки таблиці - прибираємо білі "щілини" при скролі */
.table-responsive thead th {
    border-top: none !important;
    border-bottom: 2px solid #333 !important;
    box-shadow: inset 0 1px 0 #212529, inset 0 -1px 0 #212529; /* Робить шапку монолітною */
}

/* Робимо список товарів вищим за список значень */
#attrProductsModal {
    z-index: 2100 !important;
}

/* Редактор товару — найвищий */
#productEditModal {
    z-index: 3000 !important;
}

/* --- СТИЛІ АУДИТУ ТОВАРІВ --- */

/* Робимо шапку таблиці в аудиті нерухомою при скролі */
#auditModal .sticky-top {
    position: sticky !important;
    background: white;
    z-index: 10;
}

/* Налаштування скролбару для аудиту */
#auditModal .modal-body::-webkit-scrollbar {
    width: 8px;
}

#auditModal .modal-body::-webkit-scrollbar-thumb {
    background-color: #cbd5e0;
    border-radius: 10px;
}

#auditModal .modal-body::-webkit-scrollbar-track {
    background: #f7fafc;
}

/* Колір рядків при наведенні в аудиті */
#audit-body tr:hover {
    background-color: #f0f7ff !important;
}

/* --- СТИЛІ РОЗУМНОГО КАЛЕНДАРЯ --- */

/* Стиль для дат, де Є товари (Блакитний) */
.has-products-day {
    background-color: #00d2ff !important;
    color: white !important;
    border-radius: 50% !important;
    font-weight: bold !important;
}

/* Стиль для дат, де НЕМАЄ товарів (Сірий) */
.flatpickr-day:not(.has-products-day):not(.prevMonthDay):not(.nextMonthDay) {
    color: #ccc;
}

/* Покращення вигляду інпуту в шапці */
#header-quick-date {
    max-width: 130px;
    background: transparent;
    cursor: pointer;
}

/* --- СТИЛІ ТЕМНОЇ ТЕМИ --- */
[data-bs-theme="dark"] {
    --bg-main: #0d1117;         /* Колір фону сторінки (як на GitHub) */
    --bg-card: #161b22;         /* Колір карток та модалок */
    --bg-input: #010409;        /* Колір полів вводу */
    --border-color: #30363d;    /* Колір меж */
    --text-main: #c9d1d9;       /* Основний текст */
    --text-bright: #ffffff;     /* Яскравий текст для полів */
    --accent-blue: #58a6ff;     /* Акцентний синій */
}

/* Примусові кольори для темної теми */
[data-bs-theme="dark"] body {
    background-color: var(--bg-main) !important;
    color: var(--text-main);
}

/* МОДАЛЬНІ ВІКНА: виправлення фону та заголовків */
[data-bs-theme="dark"] .modal-content {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main);
}

[data-bs-theme="dark"] .modal-header, 
[data-bs-theme="dark"] .modal-footer {
    border-color: var(--border-color) !important;
}

/* ПОЛЯ ВВОДУ: виправлення "чорного тексту на чорному" */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
    background-color: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-bright) !important; /* Яскраво-білий текст при вводі */
}

/* Колір тексту при фокусі на полі */
[data-bs-theme="dark"] .form-control:focus {
    background-color: var(--bg-input) !important;
    color: #fff !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

/* Підписи полів (labels) */
[data-bs-theme="dark"] label, 
[data-bs-theme="dark"] .form-label {
    color: var(--accent-blue) !important; /* Робимо назви полів блакитними для читабельності */
    font-weight: 600;
}

/* --- СТИЛІ АКОРДЕОНІВ ФІЛЬТРІВ --- */
.filter-group-item .cursor-pointer {
    cursor: pointer;
    transition: background 0.2s;
}

.filter-group-item .cursor-pointer:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

/* Анімація стрілочки при розгортанні */
.filter-group-item [aria-expanded="true"] i {
    transform: rotate(180deg);
}

.filter-group-item i {
    transition: transform 0.3s;
}

/* Обмежимо висоту блоку фільтрів, щоб не розтягувати Offcanvas */
#f-oc-filters {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 5px;
}

/* --- СТИЛІ ШВИДКОГО ПОШУКУ ФІЛЬТРІВ --- */
#filter-values-search {
    border-radius: 0 10px 10px 0;
    font-size: 0.9rem;
}

#filter-values-search:focus {
    background-color: #f0f7ff;
}

/* Підсвітка знайдених значень */
.form-check:not(.d-none) label {
    transition: color 0.3s;
}

/* Таблиці в темній темі */
[data-bs-theme="dark"] .table {
    color: var(--text-main) !important;
}

/* Вирівнювання таблиць у модалках */
#filter-val-body td {
    height: 50px;
    white-space: nowrap;
}

/* Ефект наведення на бейдж */
.hover-scale {
    transition: all 0.2s ease-in-out;
}
.hover-scale:hover {
    transform: scale(1.1);
    filter: brightness(0.9);
}

/* Текст в одну лінію */
.text-truncate-filter {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
}

/* Обмежуємо розтягування таблиці контентом */
#filterValuesModal table {
    table-layout: fixed !important;
    width: 100% !important;
}

/* Налаштування клітинок з текстом */
#filterValuesModal td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle !important;
}

/* Підсвітка при наведенні для кращої орієнтації */
#filter-val-body tr:hover {
    background-color: rgba(67, 97, 238, 0.05) !important;
}

/* Компактність для маленьких кнопок */
.btn-xs {
    padding: 0.1rem 0.4rem;
    font-size: 0.8rem;
}

[data-bs-theme="dark"] .table tr:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

/* Виправлення Summernote у темній темі */
[data-bs-theme="dark"] .note-editor.note-frame {
    border-color: var(--border-color) !important;
}
[data-bs-theme="dark"] .note-editable {
    background-color: #fff !important; /* Залишаємо білим для редагування контенту сайту */
    color: #000 !important;
}

/* Сайдбар категорій */
[data-bs-theme="dark"] #tree-container {
    background-color: #0d1117 !important;
    border-right: 1px solid var(--border-color) !important;
}

/* Виправлення розмірів для модалки категорій */
#filterCatsModal .modal-dialog {
    max-width: 500px;
}

/* Робимо так, щоб це вікно було ПОВЕРХ вікна значень фільтрів */
#filterCatsModal {
    z-index: 2150 !important;
}

/* Фікс для фону при двох відкритих модалках */
.modal-backdrop:nth-of-type(even) {
    z-index: 2140 !important;
}

/* --- ВИПРАВЛЕННЯ Z-INDEX ДЛЯ РЕДАКТОРА КАТЕГОРІЇ --- */
/* Воно має бути вище за вікно списку категорій (яке має z-index 2150) */
#editCategoryModal {
    z-index: 2300 !important;
}

/* Якщо виникають проблеми з фоном (затемненням) */
.modal-backdrop.show:nth-of-type(3) {
    z-index: 2290 !important;
}

[data-bs-theme="dark"] .category-row:hover {
    background-color: #161b22;
}

/* Виправлення для bg-white в темній темі */
[data-bs-theme="dark"] .bg-white {
    background-color: #21252900 !important; /* Повна прозорість */
}

/* Також, щоб картки не зливалися, можна додати прозорість для їхніх шапок */
[data-bs-theme="dark"] .card-header.bg-white {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-bottom: 1px solid var(--border-color);
}

/* --- Додайте це до існуючого блоку [data-bs-theme="dark"] --- */
[data-bs-theme="dark"] .bg-light {
    --bs-bg-opacity: 1;
    background-color: rgb(6 6 6 / 69%) !important; /* Напівпрозорий темний фон */
    color: var(--text-main) !important;
}

/* Виправлення кольору тексту в шапках таблиць, які використовують bg-light */
[data-bs-theme="dark"] thead.table-light, 
[data-bs-theme="dark"] .table-light th {
    background-color: rgb(6 6 6 / 69%) !important;
    color: var(--accent-blue) !important; /* Робимо текст у шапці акцентним */
    border-color: var(--border-color);
}

/* Порада щодо «Глазіка» - робимо іконки яскравішими */
[data-bs-theme="dark"] .btn-link, 
[data-bs-theme="dark"] .bi {
    filter: brightness(1.2); /* Робимо іконки трохи яскравішими */
}

/* Дозволяємо скрол для всього сайту, але заблокуємо його пізніше ТІЛЬКИ для категорій */
body, html {
    height: auto; 
    min-height: 100vh;
    margin: 0;
    overflow-y: auto; /* Дозволяємо вертикальну прокрутку */
    background-color: #f4f7f9;
}

/* Дозволяємо скрол тільки на сторінці товарів */
body.products-page {
    overflow-y: auto !important;
}

/* Робимо фіксовану шапку таблиці, щоб вона не зникала при скролі */
.table-responsive {
    overflow: visible !important;
}

/* Hover ефект для зображень категорій */
.img-thumbnail:hover {
    filter: brightness(0.8);
    transition: 0.3s;
}

#load-more-sentinel {
    min-height: 100px;
    padding: 20px;
}

/* Прибираємо обмеження стандартного контейнера Bootstrap */
.container, .container-lg, .container-md {
    max-width: 100% !important;
    padding: 0 !important;
}

.main-wrapper {
    display: flex;
    height: calc(100vh - 56px); /* Висота мінус навбар */
    width: 100%;
}

/* ЛІВА ПАНЕЛЬ - КАТЕГОРІЇ */
#tree-container {
    width: 350px; /* Початкова ширина */
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    z-index: 10;
    flex-shrink: 0; /* Забороняємо стискатися самому по собі */
}

/* Основна кнопка додавання (кругла) */
.btn-add-main {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px; /* Квадратна з м'якими кутами */
    background-color: #4361ee;
    border: none;
    transition: all 0.2s;
}

.btn-add-main:hover {
    background-color: #3046bc;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

/* Кнопка "Полагодити дерево" */
.btn-link-warning {
    color: #f59e0b;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 6px;
    transition: 0.2s;
}

.btn-link-warning:hover {
    background: #fef3c7;
    color: #d97706;
}

/* Компактні кнопки тулбара */
.btn-sm {
    font-size: 0.8rem;
    font-weight: 500;
}

/* Ефект наведення на рядок категорії */
.category-row {
    padding: 4px 8px;
    margin: 1px 0;
    border-radius: 6px;
}

.cursor-pointer {
    cursor: pointer;
}

.hover-scale {
    transition: transform 0.2s;
}

.hover-scale:hover {
    transform: scale(1.1);
    filter: brightness(1.1);
}

/* Робимо так, щоб редактор товару завжди був зверху будь-яких інших вікон */
#productEditModal {
    z-index: 3000 !important;
}
.modal-backdrop:nth-of-type(even) {
    z-index: 2999 !important;
}

.tree-header {
    padding: 1rem;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
}

/* Розумний пошук: контейнер результатів */
.smart-search-results {
    max-height: 250px; /* Обмежуємо висоту малого вікна */
    overflow-y: auto;  /* Власний скрол */
    position: absolute;
    width: 100%;
    z-index: 2000;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    margin-top: -1px;
}

/* Елемент результату */
.search-item {
    padding: 10px 15px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
}

.search-item:hover {
    background-color: #eef2ff;
}

.search-item .cat-id {
    font-family: monospace;
    font-size: 0.75rem;
    color: #6c757d;
}

.search-item .cat-name-hit {
    font-weight: 500;
    color: #333;
}

/* Стиль для фільтрів, які можна перетягувати */
#selected-filters .badge {
    cursor: grab; /* Курсор у вигляді руки */
    user-select: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

#selected-filters .badge:active {
    cursor: grabbing;
}

/* Колірне виділення елемента, який ми зараз тягнемо */
.sortable-ghost {
    opacity: 0.4;
    background-color: #4361ee !important;
}

.sortable-chosen {
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.tree-content {
    flex-grow: 1;
    overflow-y: auto; /* Скрол тільки для дерева */
    padding: 0.5rem;
}

/* ПРАВА ПАНЕЛЬ - ТОВАРИ */
#products-container {
    flex-grow: 1;
    overflow-y: auto; /* Скрол тільки для товарів */
    padding: 1.5rem;
    background: #f8fafc;
    display: none;
    transition: all 0.5s ease;
}

#products-container.active {
    display: block;
}

/* СТИЛЬ РЯДКА КАТЕГОРІЇ */
.category-row {
    position: relative;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}

.category-row:hover {
    background-color: #f1f5f9;
}

.cat-name-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    overflow: hidden;
}

.cat-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    margin-right: 10px;
    font-size: 0.9rem;
}

/* FTP менеджер стилі */
/* Робимо область файлів скрольованою */
.ftp-manager-container {
    height: calc(100vh - 180px); /* Вираховуємо висоту під екран */
    overflow-y: auto;
    background: white;
}

/* Фіксуємо шапку таблиці */
.ftp-manager-container thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 10;
    border-bottom: 2px solid #dee2e6;
}

/* Підсвітка при наведенні */
.ftp-item-row:hover {
    background-color: #f1f5f9;
    cursor: pointer;
}

/* Анімація для іконки щита */
.spinner-ripple {
    display: inline-block;
    position: relative;
    animation: ripple 2s infinite ease-in-out;
}

@keyframes ripple {
    0% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.8; }
}

/* Фікс для Summernote у модальних вікнах */
.note-editor.note-frame {
    border: 1px solid #dee2e6 !important;
    background: #fff !important;
}

/* Примусово тримаємо тулбар редактора зверху поля вводу, а не екрана */
.note-toolbar {
    position: relative !important;
    top: 0 !important;
    z-index: 1 !important;
}

/* Покращення модалок */
.modal-content {
    border: none;
    overflow: hidden;
}

.img-thumbnail {
    border: 2px solid #f1f5f9;
    transition: all 0.3s;
}
.img-thumbnail:hover {
    border-color: #4361ee;
    transform: scale(1.02);
}

/* Пунктирна рамка для порожніх фільтрів */
.border-dashed {
    border: 2px dashed #dee2e6 !important;
}

/* Налаштування вкладок мов */
.input-group-text.small {
    font-size: 0.75rem;
    font-weight: 700;
    background-color: #f8fafc;
    color: #64748b;
    border: 2px solid #e2e8f0;
}

.form-control-sm, .form-select-sm {
    border-radius: 8px;
}

.form-control, .form-select {
    border-width: 2px;
}

/* Розумний пошук результатів */
.smart-search-results {
    max-height: 200px;
    overflow-y: auto;
    border-radius: 10px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    background: white;
    border: 1px solid #e2e8f0;
    position: absolute;
    width: 100%;
    z-index: 3000;
}

/* Щоб картинки в описі не розривали вікно */
.note-editable img {
    max-width: 100% !important;
    height: auto !important;
}

/* Фікс для прокрутки, коли модалка відкрита */
body.modal-open {
    overflow: hidden !important;
}

/* КНОПКИ ДІЙ - ТЕПЕР ВОНИ СПРАВА І НЕ ПЕРЕКРИВАЮТЬ */
.action-btns {
    display: flex;
    gap: 2px;
    background: #f1f5f9; /* Фон щоб кнопки було видно */
    padding: 2px 5px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.category-row:hover .action-btns {
    opacity: 1;
}

/* КРАСИВА ТАБЛИЦЯ */
.content-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Додаткові стилі */
.toggle-icon i {
    transition: transform 0.2s;
    display: inline-block;
}

.toggle-icon[aria-expanded="true"] i {
    transform: rotate(90deg);
}

.row-danger-soft {
    background-color: #fff5f5 !important;
}

.img-thumb-mini {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}

.bi-eye {
    font-size: 1.1rem;
    cursor: pointer;
}

/* Мінімальна ширина для колонок ціни та кнопок, щоб вони не зникали */
#products-body td:nth-child(3) { min-width: 120px; } /* Ціна */
#products-body td:nth-child(4) { min-width: 80px; }  /* К-сть */
#products-body td:last-child { min-width: 60px; }   /* Кнопка Ред. */

/* Щоб назва товару не розтягувала таблицю безкінечно */
.fw-bold.small {
    display: block;
    max-width: 400px; /* Обмеження ширини назви */
    white-space: normal;
    word-wrap: break-word;
}

/* Оновлений контейнер для форм авторизації */
.auth-page-wrapper {
    display: flex;
    align-items: flex-start; /* Вирівнювання по верхньому краю для скролу */
    justify-content: center;
    min-height: 100vh;
    padding: 60px 20px; /* Більше відступів зверху і знизу */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.auth-card-compact {
    width: 100%;
    max-width: 450px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: none;
    margin-bottom: 50px; /* Відступ знизу, щоб кнопка не липла до краю */
}

.auth-header-blue {
    background: #4361ee;
    color: white;
    padding: 25px;
    border-radius: 16px 16px 0 0;
    text-align: center;
}

/* Відступи для полів */
.form-group-custom {
    margin-bottom: 1.2rem;
}

.form-label-small {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: 5px;
    display: block;
}

/* Кнопка входу внизу */
.login-link-btn {
    color: #4361ee;
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s;
}

.login-link-btn:hover {
    text-decoration: underline;
    color: #3046bc;
}

/* Таймер пробного периода */
#trial-timer-wrapper {
    min-width: 130px;
    transition: all 0.5s;
}

#trial-timer-wrapper.border-danger {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* Пульсація таймера */
.animate-pulse-red {
    border-color: #dc3545 !important;
    color: #dc3545 !important;
    animation: timer-pulse 2s infinite;
}

@keyframes timer-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 0 15px rgba(220, 53, 69, 0.4); }
    100% { transform: scale(1); }
}

/* Картки тарифів */
.pricing-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1) !important;
    background-color: #f8faff;
}

.pricing-card {
    border: 1px solid #f0f0f0 !important;
}

/* --- DRAGBAR (РОЗДІЛЬНИК) --- */
#dragbar {
    width: 5px;
    cursor: col-resize; /* Курсор як в Екселі */
    background-color: #f1f5f9;
    border-right: 1px solid #e2e8f0;
    flex-shrink: 0;
    transition: background-color 0.2s;
}

#dragbar:hover, #dragbar.active {
    background-color: #4361ee; /* Підсвітка при наведенні */
}

/* Корекція навбару */
.navbar {
    padding: 0.5rem 1.5rem;
    min-height: 64px;
}

.navbar-nav .nav-link {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

/* Виправлення відриву правого меню */
.navbar-collapse {
    justify-content: space-between;
}

/* Стилізація оголошення, щоб воно не штовхало верстку криво */
.announcement-bar {
    position: relative;
    z-index: 1060;
    border: none;
    border-radius: 0;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Головний контейнер контенту */
.main-content-area {
    padding: 20px;
    background-color: #f4f7f9;
    min-height: calc(100vh - 64px);
}

/* Картка-заглушка (як у месенджерах) */
.empty-state-card {
    background: white;
    border-radius: 16px;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    padding: 80px 40px;
    max-width: 800px;
    margin: 40px auto;
}

/* Корекція випадаючих списків */
.dropdown-menu {
    border: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 8px;
    padding: 0.6rem 1rem;
}

/* Коли тягнемо, забороняємо виділення тексту на сторінці */
body.resizing {
    user-select: none;
    cursor: col-resize;
}

/* === CatPro Neo Dashboard Theme === */
body {
    font-family: 'Manrope', system-ui, -apple-system, Segoe UI, sans-serif;
}

.cp-topbar {
    background: linear-gradient(90deg, #161a2b 0%, #1c2238 50%, #161a2b 100%) !important;
    border-bottom: 1px solid rgba(150, 163, 255, 0.22);
    min-height: 68px;
}

.cp-app-layout {
    display: flex;
    min-height: calc(100vh - 68px);
    background:
        radial-gradient(circle at 20% 0%, rgba(103, 92, 255, 0.16), transparent 35%),
        radial-gradient(circle at 80% 100%, rgba(103, 185, 255, 0.14), transparent 32%),
        #e8e9f3;
}

.cp-sidebar {
    width: 250px;
    background: linear-gradient(180deg, #1a1f33 0%, #121625 100%);
    border-right: 1px solid rgba(140, 154, 255, 0.16);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 68px;
    height: calc(100vh - 68px);
    z-index: 1030;
    transition: transform .24s ease;
}

.cp-sidebar-head {
    padding: 10px 8px 16px;
    border-bottom: 1px solid rgba(140, 154, 255, 0.16);
    margin-bottom: 10px;
}

.cp-sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.cp-side-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #d6dcff;
    border-radius: 12px;
    padding: 11px 12px !important;
    margin-bottom: 5px;
    font-weight: 600;
    transition: all .2s ease;
}

.cp-side-nav .cp-side-sub-link {
    padding-left: 24px !important;
    margin-left: 8px;
    font-size: 0.92rem;
    font-weight: 500;
    opacity: 0.9;
}

.cp-side-nav .nav-link:hover {
    color: #fff;
    background: rgba(107, 70, 255, 0.22);
}

.cp-side-nav .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, #6c45ff, #4b2acb);
    box-shadow: 0 6px 16px rgba(82, 54, 220, 0.32);
}

.cp-side-parent .cp-group-toggle {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #aab4ea;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cp-side-parent .cp-group-toggle:hover {
    background: rgba(140, 154, 255, 0.18);
    color: #fff;
}

.cp-side-parent .cp-group-toggle i {
    transition: transform .2s ease;
}

.cp-side-parent.cp-group-collapsed .cp-group-toggle i {
    transform: rotate(-90deg);
}

.cp-collapsed-hidden {
    display: none !important;
}

.cp-nav-config-btn {
    border-color: rgba(156, 169, 255, 0.3) !important;
    color: #dce2ff !important;
}

.cp-nav-config-btn:hover {
    background: rgba(107, 124, 255, 0.2) !important;
}

.cp-main-wrap {
    flex: 1;
    min-width: 0;
}

.cp-desktop-side-toggle {
    display: none;
}

@media (min-width: 1400px) {
    .cp-desktop-side-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 82px;
        left: 232px;
        width: 28px;
        height: 28px;
        border: 1px solid rgba(125, 142, 220, 0.35);
        border-radius: 999px;
        background: rgba(24, 29, 49, 0.95);
        color: #dfe6ff;
        z-index: 1036;
        transition: left .24s ease, background .2s ease;
    }

    .cp-desktop-side-toggle:hover {
        background: rgba(38, 45, 73, 0.98);
    }

    body.cp-sidebar-collapsed-desktop .cp-sidebar {
        position: fixed;
        left: 0;
        top: 68px;
        transform: translateX(-105%);
        box-shadow: 0 16px 40px rgba(10, 13, 27, 0.45);
    }

    body.cp-sidebar-collapsed-desktop .cp-desktop-side-toggle {
        left: 8px;
    }
}

.main-content-area {
    padding: 22px;
    min-height: calc(100vh - 68px);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.58) 0%, rgba(255, 255, 255, 0.4) 100%);
}

.main-content-area .card,
.main-content-area .table-responsive,
.main-content-area .alert:not(.announcement-bar),
.main-content-area .nav-pills,
.main-content-area .list-group {
    border: 1px solid rgba(89, 107, 179, 0.11) !important;
    box-shadow: 0 9px 28px rgba(59, 69, 113, 0.08) !important;
    border-radius: 16px !important;
}

.main-content-area .table {
    margin-bottom: 0;
}

.main-content-area .table thead th {
    background: #f5f7ff;
}

.cp-sidebar-overlay {
    display: none;
}

@media (max-width: 1399.98px) {
    .cp-sidebar {
        position: fixed;
        left: 0;
        top: 68px;
        transform: translateX(-105%);
        transition: transform .24s ease;
        box-shadow: 0 16px 40px rgba(10, 13, 27, 0.45);
    }

    body.cp-sidebar-open .cp-sidebar {
        transform: translateX(0);
    }

    .cp-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 68px 0 0 0;
        background: rgba(10, 11, 20, 0.46);
        opacity: 0;
        visibility: hidden;
        transition: .2s ease;
        z-index: 1025;
    }

    body.cp-sidebar-open .cp-sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    .main-content-area {
        padding: 16px;
    }
}

@media (max-width: 767.98px) {
    .cp-topbar .navbar-brand {
        font-size: 1rem;
    }

    .cp-topbar .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .main-content-area {
        padding: 12px;
    }
}

/* Shared page header block (like mockups) */
.cp-page-shell {
    border-radius: 18px;
    overflow: hidden;
}

.cp-proj-modal {
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,248,255,.96));
    border: 1px solid rgba(95, 112, 181, 0.17) !important;
}

.cp-proj-modal-head {
    background: linear-gradient(90deg, #1c2035 0%, #2b2f49 100%);
    color: #fff;
}

.cp-page-head {
    background:
        radial-gradient(circle at 85% 22%, rgba(117, 158, 255, 0.28) 0 18px, transparent 19px),
        radial-gradient(circle at 79% 26%, rgba(160, 186, 255, 0.38) 0 9px, transparent 10px),
        linear-gradient(180deg, #f4f5ff 0%, #eef0fb 100%);
    border: 1px solid rgba(97, 113, 187, 0.14);
    border-radius: 16px;
    padding: 22px 24px;
    margin-bottom: 16px;
}

.cp-page-head h1,
.cp-page-head h2,
.cp-page-head h3,
.cp-page-head h4 {
    margin: 0;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: #1b2038;
}

.cp-page-sub {
    margin-top: 8px;
    color: #646c8f;
    font-weight: 500;
}

.cp-soft-panel {
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(91, 108, 179, 0.14);
    border-radius: 16px;
}

.cp-metric-card {
    border: 1px solid rgba(91, 108, 179, 0.12) !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 247, 255, 0.92));
}

.cp-metric-card .h2,
.cp-metric-card h1,
.cp-metric-card h2 {
    letter-spacing: -0.5px;
}

.main-content-area .btn-primary {
    background: linear-gradient(135deg, #6d42ff, #4c2fd4);
    border-color: #5a38e7;
}

.main-content-area .btn-primary:hover {
    background: linear-gradient(135deg, #5f38e5, #4428c1);
    border-color: #4f30cf;
}

.main-content-area .form-control,
.main-content-area .form-select {
    border-radius: 11px;
}

/* Final visual polish */
:root {
    --cp-ink: #171c33;
    --cp-muted: #69709a;
    --cp-border: rgba(95, 112, 181, 0.18);
    --cp-primary: #6040ff;
    --cp-primary-2: #4a2ed2;
}

.main-content-area {
    color: var(--cp-ink);
}

.main-content-area h1,
.main-content-area h2,
.main-content-area h3,
.main-content-area h4,
.main-content-area h5 {
    letter-spacing: -0.02em;
}

.main-content-area .text-muted {
    color: var(--cp-muted) !important;
}

.cp-topbar .navbar-brand {
    font-size: 1.75rem;
    letter-spacing: 0.2px;
}

.cp-brand {
    display: inline-flex;
    align-items: center;
}

.cp-brand-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 8px;
}

.cp-brand-logo-top {
    width: 56px;
    height: 56px;
}

.cp-brand-logo-side {
    width: 76px;
    height: 76px;
}

/* avoid duplicated brand (topbar + sidebar) */
@media (min-width: 1400px) {
    .cp-topbar .cp-brand {
        display: none !important;
    }
}

@media (max-width: 1399.98px) {
    .cp-sidebar-head {
        display: none;
    }
}

.cp-topbar .navbar-nav .nav-link {
    border-radius: 10px;
    transition: background .2s ease, color .2s ease;
}

.cp-topbar .navbar-nav .nav-link:hover {
    background: rgba(139, 154, 255, 0.12);
}

.cp-topbar .btn-primary {
    border-radius: 999px;
    font-weight: 700;
}

.cp-side-nav .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 1rem;
}

.main-content-area .card {
    backdrop-filter: blur(2px);
}

.main-content-area .card-header {
    border-top-left-radius: 16px !important;
    border-top-right-radius: 16px !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 248, 255, 0.94));
    border-bottom: 1px solid var(--cp-border) !important;
}

.main-content-area .btn {
    border-radius: 12px;
    font-weight: 700;
}

.main-content-area .btn-outline-success,
.main-content-area .btn-outline-primary,
.main-content-area .btn-light,
.main-content-area .btn-outline-dark,
.main-content-area .btn-outline-info {
    border-color: var(--cp-border);
}

.main-content-area .input-group-text {
    border-color: var(--cp-border);
    background: #f7f8ff;
}

.main-content-area .form-control,
.main-content-area .form-select {
    border: 1px solid var(--cp-border);
    background: rgba(255, 255, 255, 0.93);
}

.main-content-area .form-control:focus,
.main-content-area .form-select:focus {
    border-color: rgba(96, 64, 255, 0.38);
    box-shadow: 0 0 0 .2rem rgba(96, 64, 255, 0.12);
}

.main-content-area .table {
    --bs-table-bg: transparent;
}

.main-content-area .table thead th {
    color: #2b3150;
    font-size: .88rem;
    font-weight: 800;
    border-bottom-color: rgba(95, 112, 181, 0.3);
}

.main-content-area .table tbody td {
    border-color: rgba(95, 112, 181, 0.14);
    vertical-align: middle;
}

.main-content-area .table tbody tr {
    transition: background .16s ease;
}

.main-content-area .table tbody tr:hover {
    background: rgba(104, 86, 255, 0.05);
}

.main-content-area .badge {
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.main-content-area .offcanvas {
    border-right: 1px solid var(--cp-border);
    background: linear-gradient(180deg, #f8f9ff, #eef1fa);
}

.main-content-area .offcanvas-header {
    border-bottom: 1px solid var(--cp-border);
}

/* subtle reveal */
@keyframes cp-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.main-content-area .card,
.main-content-area .cp-page-head {
    animation: cp-fade-up .28s ease both;
}

@media (max-width: 991.98px) {
    .cp-page-head {
        padding: 18px 16px;
    }

    .main-content-area .card-header {
        padding: 12px 14px !important;
    }
}
