/* =============================================================
   Ferrum Ventus — Custom Stylesheet
   Поверх Bootstrap 5
   ============================================================= */

/* ---------- Шрифты (Локальная загрузка) ---------- */
/* Inter Variable (Cyrillic) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter-cyrillic-wght-normal.woff2') format('woff2-variations'),
         url('../fonts/inter-cyrillic-wght-normal.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* Inter Variable (Latin) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2-variations'),
         url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Bootstrap Icons (Локально) */
@font-face {
    font-family: 'bootstrap-icons';
    font-style: normal;
    font-weight: normal;
    font-display: block;
    src: url('../fonts/bootstrap-icons.woff2') format('woff2');
}

/* ---------- Переменные ---------- */
:root {
    --fv-sidebar-width: 240px;
    --fv-primary:       #2563eb;   /* синий */
    --fv-primary-dark:  #1d4ed8;
    --fv-surface:       #0f172a;   /* тёмный фон сайдбара */
    --fv-surface-2:     #1e293b;   /* чуть светлее */
    --fv-text-muted:    #94a3b8;
    --fv-accent:        #38bdf8;   /* голубой акцент */
    --fv-success:       #16a34a;
    --fv-warning:       #f59e0b;
    --fv-danger:        #ef4444;
    --fv-border:        #e2e8f0;
    --fv-body-bg:       #f8fafc;
    --fv-topbar-h:      60px;
    --fv-radius:        10px;
    --fv-transition:    0.18s ease;
}

/* ---------- Базовые стили ---------- */
*, *::before, *::after { box-sizing: border-box; }

[x-cloak] {
    display: none !important;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    background: var(--fv-body-bg);
    color: #1e293b;
}

/* ---------- Сайдбар ---------- */
.fv-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--fv-sidebar-width);
    height: 100vh;
    background: var(--fv-surface);
    z-index: 100;
    overflow-y: auto;
    transition: var(--fv-transition);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.fv-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px 18px;
    font-weight: 700;
    font-size: 17px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    letter-spacing: -0.3px;
}

.fv-sidebar-logo .bi {
    font-size: 24px;
    color: var(--fv-accent);
}

.fv-nav {
    list-style: none;
    margin: 12px 0 0;
    padding: 0 10px;
}

.fv-nav li { margin-bottom: 2px; }

.fv-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 7px;
    color: var(--fv-text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: background var(--fv-transition), color var(--fv-transition);
}

.fv-nav-link .bi { font-size: 16px; flex-shrink: 0; }

.fv-nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.fv-nav-link.active {
    background: var(--fv-primary);
    color: #fff;
}

.fv-sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    color: var(--fv-text-muted);
    font-size: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ---------- Основной контент ---------- */
.fv-main {
    margin-left: var(--fv-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Топ-бар ---------- */
.fv-topbar {
    height: var(--fv-topbar-h);
    display: flex;
    align-items: center;
    padding: 0 28px;
    background: #fff;
    border-bottom: 1px solid var(--fv-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.fv-page-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #0f172a;
    letter-spacing: -0.3px;
}

/* ---------- Контент ---------- */
.fv-content {
    flex: 1;
    padding: 24px 28px;
}

/* ---------- Карточки ---------- */
.fv-card {
    background: #fff;
    border-radius: var(--fv-radius);
    border: 1px solid var(--fv-border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    overflow: hidden;
}

.fv-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--fv-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
}

.fv-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.fv-card-body { padding: 20px; }

/* ---------- Таблицы ---------- */
.fv-table-wrap {
    overflow-x: auto;
    border-radius: var(--fv-radius);
    border: 1px solid var(--fv-border);
    background: #fff;
}

.fv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

.fv-table thead th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    padding: 10px 14px;
    border-bottom: 1px solid var(--fv-border);
    position: sticky;
    top: 0;
}

.fv-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.fv-table tbody tr:last-child td { border-bottom: none; }

.fv-table tbody tr:hover { background: #f8fafc; }

/* Закрепление первого столбца в таблицах */
.fv-table th:first-child,
.fv-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    box-shadow: 1px 0 0 var(--fv-border);
}

.fv-table th:first-child {
    background: #f8fafc;
    z-index: 20;
}

.fv-table td:first-child {
    background: #fff;
}

.fv-table tbody tr:hover td:first-child {
    background: #f8fafc;
}

/* ---------- Кнопки ---------- */
.btn-fv {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background var(--fv-transition), transform 0.08s;
    text-decoration: none;
}

.btn-fv:active { transform: scale(0.97); }

.btn-fv-primary { background: var(--fv-primary); color: #fff; }
.btn-fv-primary:hover { background: var(--fv-primary-dark); color: #fff; }

.btn-fv-outline {
    background: transparent;
    border: 1px solid var(--fv-border);
    color: #475569;
}
.btn-fv-outline:hover { background: #f1f5f9; color: #0f172a; }

.btn-fv-danger { background: var(--fv-danger); color: #fff; }
.btn-fv-danger:hover { background: #dc2626; color: #fff; }

/* ---------- Кнопки действий в строках таблиц (Row/Table Actions) ---------- */
.btn-table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--fv-text-muted);
    font-size: 18px; /* Соответствует fs-5 для иконок bi */
    cursor: pointer;
    transition: background-color var(--fv-transition), color var(--fv-transition), transform 0.08s ease;
    text-decoration: none;
}

.btn-table-action:active {
    transform: scale(0.92);
}

.btn-table-action:hover {
    background-color: var(--fv-text-muted);
    color: #fff;
}

.btn-table-action-primary {
    color: var(--fv-primary);
}
.btn-table-action-primary:hover {
    background-color: var(--fv-primary);
    color: #fff;
}

.btn-table-action-success {
    color: var(--fv-success);
}
.btn-table-action-success:hover {
    background-color: var(--fv-success);
    color: #fff;
}

.btn-table-action-danger {
    color: var(--fv-danger);
}
.btn-table-action-danger:hover {
    background-color: var(--fv-danger);
    color: #fff;
}

.btn-table-action-warning {
    color: var(--fv-warning);
}
.btn-table-action-warning:hover {
    background-color: var(--fv-warning);
    color: #fff;
}

.btn-table-action-info {
    color: #0284c7;
}
.btn-table-action-info:hover {
    background-color: #0284c7;
    color: #fff;
}

/* Разрешаем выпадающим спискам в адаптивных таблицах отображаться поверх границ */
.table-responsive-visible {
    overflow: visible !important;
}

/* ---------- Бейджи статусов ---------- */
.fv-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.fv-badge-draft     { background: #f1f5f9; color: #64748b; }
.fv-badge-active    { background: #e2f5ea; color: #15803d; }
.fv-badge-completed { background: #dbeafe; color: #2563eb; }
.fv-badge-archived  { background: #f3f4f6; color: #6b7280; }

/* ---------- Формы ---------- */
.fv-form-label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.fv-form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
    transition: border-color var(--fv-transition), box-shadow var(--fv-transition);
    outline: none;
}

.fv-form-control:focus {
    border-color: var(--fv-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ---------- Заглушка-страница ---------- */
.fv-stub {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    color: #94a3b8;
    text-align: center;
    gap: 12px;
}

.fv-stub .bi { font-size: 48px; color: #cbd5e1; }

.fv-stub h2 { font-size: 18px; font-weight: 600; color: #64748b; margin: 0; }

/* ---------- Финансовые значения ---------- */
.fv-positive { color: var(--fv-success); font-weight: 600; }
.fv-negative { color: var(--fv-danger);  font-weight: 600; }
.fv-neutral  { color: #64748b; }

/* ---------- Адаптив ---------- */
@media (max-width: 767.98px) {
    .fv-sidebar { width: 240px; transform: translateX(-280px); }
    .fv-sidebar.sidebar-open { transform: translateX(0); }
    .fv-main { margin-left: 0; }
    .fv-content { padding: 16px; }
}

.fv-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 95;
}

[x-cloak] { display: none !important; }

/* ---------- Стилизация табов проекта (Flat Underline) ---------- */
.nav-tabs {
    border-bottom: 2px solid var(--fv-border);
}

.nav-tabs .nav-link {
    color: #64748b; /* Серый цвет для неактивных табов */
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    transition: color var(--fv-transition), border-color var(--fv-transition);
    background-color: transparent;
}

.nav-tabs .nav-link:hover {
    color: #0f172a;
    border-color: transparent;
    background-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--fv-primary) !important; /* Синий цвет для активного таба */
    border: none;
    border-bottom: 2px solid var(--fv-primary) !important;
    background-color: transparent !important;
    font-weight: 600;
}

.nav-tabs .nav-link .bi {
    font-size: 15px;
    vertical-align: middle;
}

/* Синхронизация бейджей внутри табов */
.nav-tabs .nav-link .badge {
    background-color: #e2e8f0 !important;
    color: #475569 !important;
    font-weight: 600;
    margin-left: 6px;
    font-size: 11px;
    transition: background var(--fv-transition), color var(--fv-transition);
}

.nav-tabs .nav-link.active .badge {
    background-color: var(--fv-primary) !important;
    color: #fff !important;
}

/* Сворачиваемый мобильный фильтр: показать/скрыть текст ссылки */
[aria-expanded="false"] .collapsed-show {
    display: inline;
}
[aria-expanded="false"] .collapsed-hide {
    display: none;
}
[aria-expanded="true"] .collapsed-show {
    display: none;
}
[aria-expanded="true"] .collapsed-hide {
    display: inline;
}

/* Прокрутка табов на мобильных экранах */
.nav-tabs-scrollable {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}
.nav-tabs-scrollable::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}
.nav-tabs-scrollable .nav-item {
    flex-shrink: 0;
}

/* Стили для визуального разделения матрицы обязательств */
.matrix-separator {
    border-left: 2px solid #94a3b8 !important;
}
.matrix-group-header th {
    background-color: #f1f5f9 !important;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: #475569 !important;
    text-transform: uppercase;
    border-bottom: 2px solid #cbd5e1 !important;
}



