@import url('https://fonts.bunny.net/css2?family=Montserrat+Alternates:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.bunny.net/css2?family=Montserrat:wght@400;500;600&display=swap');

:root {
  --bs-body-font-family: 'Roboto', sans-serif;
  --bs-body-color: #333; /* Темно-серый цвет текста */
  --bs-body-bg: #f8f9fa; /* Общий фон страницы */
  --bs-primary: #6B5B95; /* фиолетовый основной цвет для кнопок, ссылок и т.д. */
  --bs-primary-rgb: 107, 91, 149;
  --bs-danger: #d32f2f; /* красный цвет для штрафов/опасности */
  --bs-danger-rgb: 211, 47, 47;
  --bs-success: #4CAF50; /* Зеленый для статусов "решено" */
  --bs-warning: #FFC107; /* Желтый для статусов "новый" */
  --bs-info: #2196F3;    /* Синий для информационных блоков */
  --bs-list-group-bg: auto !important;
  --header-height: 60px;
}

html {
  scroll-padding-top: var(--header-height);
}

/* Общие стили для body, если требуется дополнительно */
body {
  line-height: 1.6;
  background-color: #ececec;
}

a {
  color: var(--bs-primary);
  text-decoration: none;
}
a:hover {
  color: darken(var(--bs-primary), 10%); /* Sass darken не будет работать здесь. Нужен JS или заранее определить */
  text-decoration: underline;
}

.modal-backdrop {
    z-index: 1040;  
}

/* Стили для Селект2 */
.select2-container--open {
    /* Чтобы выпадающий список был выше всех модальных окон (Modal z-index: ~1050) */
    z-index: 1060 !important; 
}

.modal-content .select2-container {
    z-index: 1055; /* Должен быть выше модала (1050), но ниже выпадающего списка */
}

.modal-content .select2-container--open {
    z-index: 9999 !important; 
}

/* ==================== HEADER STYLES ==================== */
.main-header {
  width: 100%;
  height: 60px;
  display: flex;
  flex-direction: row;
  align-items: center;
  background-color: #3e3e3e;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2222;
  padding: 0 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  justify-content: space-between;
}

.main-header .logo-link {
  color: #fff;
  font-size: 1.8rem;
  font-weight: bold;
  text-decoration: none;
  z-index: 9999;
}

.page_title {
  font-weight: 600;
}

.main-header .header-nav {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-left: -15vh;
}

.main-header .nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
}

.main-header .nav-list li {
  margin-left: 40px;
}

.main-header .nav-list li:first-child {
  margin-left: 0;
}

.main-header .nav-list .nav-link {
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.main-header .nav-list .nav-link:hover,
.main-header .nav-list .nav-link:focus {
  color: #fd8a26;
}

.header_navi {
  text-decoration: none;
  color: #FFF;
  font-size: 16px;
  font-weight: 600;
  margin-left: auto;
}

.header_navi:hover {
  color: #fd8a26;
}

.header_navi svg:hover{
  fill: #fd8a26;
}

.alert {
  color: red;
}

/* ==================== CONTENT SPACING ==================== */
/* Добавляем отступ для body, чтобы контент не скрывался за фиксированным хедером */
.header-spacer {
  height: 60px;
  width: 100%;
  display: block;
}

/* Стили для каждого блока штрафа */
.fine-item {
  border: 1px solid #dee2e6; /* Тонкая рамка */
  border-radius: .25rem;
  background-color: #fff;
  box-shadow: 0 .125rem .25rem rgba(0,0,0,.075); /* Небольшая тень */
}

/* ==================== HIERARCHY STYLES ==================== */

.hierarchy-card {
  border: 1px solid #dee2e6;
  border-radius: .25rem;
  background-color: #fff;
  box-shadow: 0 .125rem .25rem rgba(0,0,0,.075);
  margin-bottom: 1rem; /* Отступ между карточками */
}

.hierarchy-level-1 {
  /* Нет отступа слева, это самый верхний уровень */
  max-width: 400px; /* Ограничим ширину для верхних уровней */
}

.hierarchy-level-2 {
  /* ms-4 отступ слева, Bootstrap класс для margin-left: 1.5rem */
  max-width: 400px;
  position: relative; /* Для возможных линий иерархии */
}

.hierarchy-level-3 {
  /* ms-5 отступ слева, Bootstrap класс для margin-left: 3rem */
  position: relative;
  padding-left: 1rem; /* Добавим небольшой padding для визуальной границы */
  border-left: 2px solid #ccc; /* Левая линия для уровня 3 */
  margin-bottom: 2rem;
}
.hierarchy-level-3 h4 {
  margin-left: -1rem; /* Компенсируем padding для заголовка уровня 3 */
  padding-left: 1rem;
}

.hierarchy-group {
  /* Общая группа для руководителя уровня 3 и его прямых подчиненных */
  margin-bottom: 2rem;
  padding-top: 1rem;
  border-top: 1px dashed #eee; /* Разделительная линия между группами */
}
.hierarchy-group:first-child {
  border-top: none; /* Убираем верхнюю линию для первой группы */
  padding-top: 0;
}


.hierarchy-manager-card {
  background-color: #e0f2f7; /* Цвет фона для карточек руководителей 3 уровня */
  border-color: #a7d9ee;
  max-width: 350px;
}

.hierarchy-level-4 {
  /* ms-5 отступ слева, Bootstrap класс для margin-left: 3rem */
  padding-left: 1rem; /* Добавим небольшой padding для визуальной границы */
  border-left: 2px solid #ddd; /* Левая линия для уровня 4 */
  /* margin-bottom: 2rem; */
}
.hierarchy-level-4 h5 {
  margin-left: -1rem; /* Компенсируем padding для заголовка уровня 4 */
  padding-left: 1rem;
}

.hierarchy-sub-manager-card {
  background-color: #f0f8ff; /* Более светлый цвет для карточек руководителей 4 уровня */
  border-color: #cce7ff;
  flex: 1 1 calc(33.333% - 1rem); /* 3 колонки на больших экранах, с gap-3 (1rem) */
  min-width: 280px; /* Минимальная ширина, чтобы не схлопывались */
}

.hierarchy-level-5 {
  /* ms-4 отступ слева, Bootstrap класс для margin-left: 1.5rem */
  padding-left: 0.5rem;
  border-left: 1px solid #eee; /* Легкая линия для уровня 5 */
}

.hierarchy-level-5 .list-group-item {
  padding-left: 0.5rem;
}

.list-group-item {
  background-color: transparent;
}

.hierarchy_number {
  color: #fd8a26;
  font-size: larger;
}

.hierarchy_lider {
  font-size: larger;
}

.third_card {
  margin-bottom: 0 !important;
}

.fines-list-header {
  background-color: #e9ecef;
  border-radius: .25rem;
  font-weight: bold;
  width: 100%;
  /* margin-left: 5px; */
}

.header_nav_toggle {
  display: none; /* Скрываем кнопку на больших экранах */
  flex-direction: column;
  cursor: pointer;
}

.header_nav_toggle .bar {
  width: 25px;
  height: 3px;
  background-color: white;
  margin: 3px 0;
}

.header_nav_toggle.open .bar:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.header_nav_toggle.open .bar:nth-child(2) {
  opacity: 0;
}

.header_nav_toggle.open .bar:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

.select2-container .select2-selection--single .select2-selection__rendered {
  display: block;
  padding: 3px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select2-container .select2-selection--single {
  height: 36px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  top: 5px !important;
}

/* LOADER */
.wrapper {
  width: 200px;
  height: 60px;
  position: fixed;
  display: none;
  z-index: 10909;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.circle_load {
  width: 20px;
  height: 20px;
  position: absolute;
  border-radius: 50%;
  background-color: #fff;
  left: 15%;
  transform-origin: 50%;
  animation: circle7124 .5s alternate infinite ease;
}

@keyframes circle7124 {
  0% {
    top: 60px;
    height: 5px;
    border-radius: 50px 50px 25px 25px;
    transform: scaleX(1.7);
  }

  40% {
    height: 20px;
    border-radius: 50%;
    transform: scaleX(1);
  }

  100% {
    top: 0%;
  }
}

.circle_load:nth-child(2) {
  left: 45%;
  animation-delay: .2s;
}

.circle_load:nth-child(3) {
  left: auto;
  right: 15%;
  animation-delay: .3s;
}

.shadow {
  width: 20px;
  height: 4px;
  border-radius: 50%;
  background-color: rgba(0,0,0,0.9);
  position: absolute;
  top: 62px;
  transform-origin: 50%;
  z-index: -1;
  left: 15%;
  filter: blur(1px);
  animation: shadow046 .5s alternate infinite ease;
}

@keyframes shadow046 {
  0% {
    transform: scaleX(1.5);
  }

  40% {
    transform: scaleX(1);
    opacity: .7;
  }

  100% {
    transform: scaleX(.2);
    opacity: .4;
  }
}

.shadow:nth-child(4) {
  left: 45%;
  animation-delay: .2s
}

.shadow:nth-child(5) {
  left: auto;
  right: 15%;
  animation-delay: .3s;
}

/* BTN LOADER */

.btn_loader {
  position: relative;
  width: 2.5vh;
  height: 2.5vh;
  transform: rotate(165deg);
}
 
.btn_loader:before, .btn_loader:after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 0.5vh;
  height: 0.5vh;
  border-radius: 0.25em;
  transform: translate(-50%, -50%);
}
 
.btn_loader:before {
  animation: before8 2s infinite;
}
 
.btn_loader:after {
  animation: after6 2s infinite;
}
 
@keyframes before8 {
  0% {
   width: 0.5vh;
   box-shadow: 1em -0.5em #FE4193, -1em 0.5em #37BDE3;
  }
 
  35% {
   width: 2vh;
   box-shadow: 0 -0.5em #FE4193, 0 0.5em #37BDE3;
  }
 
  70% {
   width: 0.5vh;
   box-shadow: -1em -0.5em #FE4193, 1em 0.5em #37BDE3;
  }
 
  100% {
   box-shadow: 1em -0.5em #FE4193, -1em 0.5em #37BDE3;
  }
}
 
@keyframes after6 {
  0% {
   height: 0.5vh;
   box-shadow: 0.5em 1em #9D7EBA, -0.5em -1em #E3C85F;
  }
 
  35% {
   height: 2vh;
   box-shadow: 0.5em 0 #9D7EBA, -0.5em 0 #E3C85F;
  }
 
  70% {
   height: 0.5vh;
   box-shadow: 0.5em -1em #9D7EBA, -0.5em 1em #E3C85F;
  }
 
  100% {
   box-shadow: 0.5em 1em #9D7EBA, -0.5em -1em #E3C85F;
  }
 }
 
.btn_loader {
  position: absolute;
  top: calc(50% - 1.25vh);
  left: calc(50% - 1.25vh);
}

/* MESSAGES */

.message-popup {
  position: fixed;
  top: 20px;
  right: 20px;
  border-radius: 10px;
  padding: 15px;
  z-index: 10000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  animation: fadeOut 3s ease-in-out 7s forwards;
}

.success-popup {
  background-color: #489928;
}

.error-popup {
  background-color: #963030;
}

.info-popup {
  background-color: #d0d0d0;
  color: #000 !important;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

/* POPUP */

#popup-bg1 {
  position: fixed;
  overflow: hidden;
  z-index: 9999;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  background: #000;
  opacity: 0.3;
  display: none;
}

#popup-bg {
  position: fixed;
  overflow: hidden;
  z-index: 9999;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  background: #000;
  opacity: 0.3;
  display: none;
}

#popup-container {
  position: fixed;
  z-index: 10000;
  width: 50%;
  max-width: 60vh !important;
  height: auto;
  min-height: 15vh;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

@media (max-width: 590px) {
  #popup-container {
      width: 80%;
  }
}

.content_box {
  max-width: 30%;
  background: #fff;
  box-shadow: 0px 0px 5px #939191;
  /* font-size: 1.2vh; */
  padding: 1.4vh;
  border-radius: 0.8vh;
}

@media (max-width: 1220px) {

  .content_box {
      max-width: 45%;
  }
}


@media (max-width: 900px) {

  .content_box {
      max-width: 100%;
  }
  
}

@media (max-width: 768px) {

  .content_box {
      width: 100%;

  }
  
}

.content_box_save_btn {
  margin: 15px 0 0 auto;
  height: 3.5vh;
  min-width: 13vh;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  background: #489928;
  border-radius: 5px;
  cursor: pointer;
  font-size: 18px;
  transition: 0.5s;
  border: 1px solid #489928;
  position: relative;
  flex-shrink: 0;
  padding: 0 1vh;
}

.content_box_save_btn:hover {
  background: transparent;
  color: #000;
}

.content_box_headline {
  font-size: 20px;
  font-weight: 500;
  width: 100%;
  border-bottom: 0.5px solid #939191;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

/* LOGIN PAGE */

.login_form_title {
  font-size: 30px;
  font-weight: 600;
  color: #FFF;
  text-align: center;
  padding-bottom: 40px;
  font-family: 'Roboto', sans-serif;
}

.login-box {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  padding: 40px;
  transform: translate(-50%, -50%);
  background: rgba(24, 20, 20, 0.987);
  box-sizing: border-box;
  box-shadow: 0 15px 25px rgba(0,0,0,.6);
  border-radius: 10px;
}

.login-box .user-box {
    position: relative;
}

.login-box .user-box input {
  width: 100%;
  padding: 10px 0;
  font-size: 16px;
  color: #fff;
  margin-bottom: 30px;
  border: none;
  border-bottom: 1px solid #fff;
  outline: none;
  background: transparent;
}

.login-box .user-box label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 10px 0;
  font-size: 16px;
  color: #fff;
  pointer-events: none;
  transition: .5s;
}

.login-box .user-box input:focus ~ label,
.login-box .user-box input:valid ~ label {
  top: -20px;
  left: 0;
  color: #bdb8b8;
  font-size: 12px;
}

.login-box form button {
  position: relative;
  display: inline-block;
  padding: 10px 20px;
  color: #ffffff;
  font-size: 16px;
  background-color: rgba(24, 20, 20, 0.987);
  text-decoration: none;
  text-transform: uppercase;
  overflow: hidden;
  transition: .5s;
  margin-top: 40px;
  letter-spacing: 4px;
  border: 1px solid #ffd570;
  border-radius: 5px;
  font-family: 'Roboto', sans-serif;
}

.login-box button:hover {
  background: #ffd570;
  color: #000;
  border: 1px solid #ffd87a;
}

.login-boxbuttonspan {
  position: absolute;
  display: block;
}


.forgot_pass {
  color: #fff;
  justify-content: center;
  display: flex;
  font-size: 16px;
  margin-top: 10px;
}

/* LOGIN PAGE END */

.add-fine-type-block, .edit-fine-type-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.edit-buttons {
    display: flex;
    gap: 5px;
}

.select2-container--bootstrap-5 .select2-selection__rendered {
    color: #444;
    line-height: 38px; /* Выравнивание текста в Select2 */
}

/* DB button btn */
.db_btn {
  height: 28px;
  width: 28px;
  text-decoration: none;
  transition: transform 0.1s linear;
  border: 2px solid #fd8a26;
  border-radius: 50%;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.db_btn:hover {
  transform: scale(1.2);
  background-color: #fd8a26;
}

.double_title {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-top: 5px;
  flex-direction: row;
}
/* DB button btn  END*/

.fine-description-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.popup_margin {
  margin-top: 35vh !important;
}

.nav-link-logout {
  display: none;
}

.fine-status-btn {
  background-color: #358637;
  border: none;
}

.fine-status-buttons-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.status-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fine-level-number {
  font-weight: bold;
  color: #fd8a26;
  margin-bottom: 5px;
  font-size: 1.5rem;
}

.fine-arrow {
  font-size: 1.7rem;
  color: #000;
}

.fine-level-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fine-status-btn {
  white-space: nowrap;
}

.fine-status-btn.disabled-div {
  cursor: not-allowed; 
  opacity: 0.5; 
  pointer-events: none; 
  box-shadow: none; 
}

.bg-status-new {
  background-color: #ffadaa;
}

/* ========================================================================= */
/* Специфические правила для Select2 в input-group для блоков "Сотрудники" и "Админы" */
/* ========================================================================= */

/* Общие правила для контейнеров Select2 внутри input-group в аккордеоне */
.accordion-item .input-group .select2-container {
    /* Важно: Используем flex-basis и flex-grow для корректной работы 
       внутри Bootstrap's .input-group (который display: flex).
    */
    flex-grow: 0 !important; /* Запрещаем Select2 безконтрольно расширяться */
    box-sizing: border-box !important;
}

/* Select2 container - должен занимать 90% */
.accordion-item .input-group.add-fine-type-block .select2-container {
    flex-basis: 90% !important; 
    width: 90% !important; /* Указываем требуемую ширину */
}

/* Кнопка "Додати"  */
.accordion-item .input-group.add-fine-type-block .btn {
    flex-shrink: 0; /* Запрещаем кнопке сжиматься */
    flex-grow: 1; /* Позволяем заполнить оставшееся место */
    max-width: 10%; /* Ограничиваем максимальную ширину */
}

/* ИЗМЕНЕНИЕ */
.accordion-item .input-group.edit-fine-type-block .select2-container {
    flex-basis: 84% !important;
    width: 84% !important;
    margin-right: 4px; /* Небольшой отступ для разделения с кнопками */
}

/* Контейнер для кнопок (.edit-buttons) */
.accordion-item .input-group.edit-fine-type-block .edit-buttons {
    flex-shrink: 0; /* Важно: запрещаем сжиматься */
    display: flex;
    gap: 5px; /* Пространство между кнопками */
}

/* Кнопки внутри контейнера равномерно распределяют доступное место */
.accordion-item .input-group.edit-fine-type-block .edit-buttons .btn {
    flex: 1; /* Занимают равное место внутри .edit-buttons */
    padding-left: 5px;
    padding-right: 5px;
}

@media (max-width: 1399px) {
  .accordion-item .input-group.add-fine-type-block .select2-container {
    flex-basis: 89% !important; 
    width: 89% !important; /* Указываем требуемую ширину */
  }

  .accordion-item .input-group.edit-fine-type-block .select2-container {
    flex-basis: 81% !important;
    width: 81% !important;
  }
}

@media (max-width: 1200px) {
  .accordion-item .input-group.add-fine-type-block .select2-container {
    flex-basis: 89% !important; 
    width: 89% !important; /* Указываем требуемую ширину */
  }

  .accordion-item .input-group.edit-fine-type-block .select2-container {
    flex-basis: 77% !important;
    width: 77% !important;
  }
}

@media (max-width: 993px) {
  .accordion-item .input-group.add-fine-type-block .select2-container {
    flex-basis: 84% !important; 
    width: 84% !important; /* Указываем требуемую ширину */
  }

  .accordion-item .input-group.edit-fine-type-block .select2-container {
    flex-basis: 69% !important;
    width: 69% !important;
  }

  .accordion-item .input-group.add-fine-type-block .btn {
    max-width: 15%; /* Ограничиваем максимальную ширину */
  }
}

@media (max-width: 770px) {
  .accordion-item .input-group.add-fine-type-block .select2-container {
    flex-basis: 100% !important; 
    width: 100% !important; /* Указываем требуемую ширину */
  }

  .accordion-item .input-group.edit-fine-type-block .select2-container {
    flex-basis: 100% !important;
    width: 100% !important;
  }

  .accordion-item .input-group.add-fine-type-block .btn {
    max-width: 22%; /* Ограничиваем максимальную ширину */
  }
}

@media (max-width: 442px) {
  .accordion-item .input-group.add-fine-type-block .btn {
    max-width: 40%; /* Ограничиваем максимальную ширину */
  }
}

.accordion-button:focus {
    outline: none !important; 
    box-shadow: none !important; 
}

/* Адаптивность */
@media (max-width: 767.98px) {
  .hierarchy-level-1,
  .hierarchy-level-2,
  .hierarchy-level-3,
  .hierarchy-level-4,
  .hierarchy-level-5 {
    margin-left: 0 !important; /* Убираем все отступы слева на мобильных */
    border-left: none !important; /* Убираем линии */
  }

  .hierarchy-level-3,
  .hierarchy-level-4 {
    border-left: none; /* Убираем линии */
  }

  .hierarchy-level-3 h4,
  .hierarchy-level-4 h5 {
    margin-left: 0;
    padding-left: 0;
  }

  .hierarchy-group {
    border-top: none; /* Убираем разделительные линии групп */
    padding-top: 0;
  }

  .hierarchy-sub-manager-card {
    flex: 1 1 100%; /* Каждая карточка на мобильных занимает всю ширину */
  }

  .main-header {
    justify-content: space-between;
    padding: 0 20px;
  }

  .main-header .logo-link {
    padding-left: 0;
  }

  .header_nav_toggle {
    display: flex;
    margin-right: 0;
    z-index: 1001;
  }

  .header_navi {
    display: none;
  }

  .main-header .header-nav {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #444;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
    z-index: 999;
  }

  .main-header .header-nav.active1 {
    max-height: 392px;
    margin-left: 0;
  }

  .main-header .nav-list li:first-child {
    margin-left: 0px;
  }

  .main-header .nav-list li {
    margin-left: 0px;
  }
  
  .main-header .nav-list {
    flex-direction: column;
    width: 100%;
    padding: 10px 0;
      /* margin-left: 0; */
  }

  .main-header .nav-list li {
      /* margin-left: 0; */
    text-align: center;
  }

  .main-header .nav-list .nav-link {
    display: block;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .main-header .nav-list li:last-child .nav-link {
    border-bottom: none;
  }

  .nav-link-logout {
    display: block;
  }

  .fines-list-header {
    display: none !important;
  }

  .fine-item .col-12 {
    text-align: left !important; /* Выравниваем текст по левому краю на мобильных */
  }

  .fine-status-buttons-container {
      flex-direction: column;
      align-items: stretch;
  }
  
  .fine-level-container {
      flex-direction: column;
      align-items: center;
  }
  
  .fine-level-container .fine-arrow {
      transform: rotate(90deg);
  }
  
}