:root {
  --bs-font-sans-serif: "Inter", sans-serif;
}
body {
  background-color: #f3f4f6;
  color: #111827;
  font-family: var(--bs-font-sans-serif);
}
.btn-primary {
  background-color: #000 !important;
  border-color: #000 !important;
  border-radius: 6px;
}
.btn-primary:hover {
  background-color: #333 !important;
}
.table-responsive {
  overflow: visible !important;
}
/* Збільшені крапки статусу */
[id^="status-dot-"] {
  width: 14px !important; /* Було 10px */
  height: 14px !important; /* Було 10px */
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);
}
/* Колонки: фиксируем ширину вспомогательных, даем свободу центру */
.custom-table th:nth-child(1),
.custom-table td:nth-child(1) {
  width: 220px;
} /* Project */
.custom-table th:nth-child(2),
.custom-table td:nth-child(2) {
  width: 100px;
} /* Today */
.custom-table th:nth-child(4),
.custom-table td:nth-child(4) {
  width: 90px;
} /* Actions */
/* Grid Styling */
/* Сетка 24 часа: теперь она главная */
.daily-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr); /* 12 в ряд */
  gap: 2px;
  width: 100%;
}

.hour-box {
  border-radius: 2px;
  padding: 2px 0;
  text-align: center;
  min-height: 48px;
  border: 1px solid #eee;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
}
.hour-box.positive {
  background-color: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}
.hour-box.negative {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.hour-box.neutral {
  background-color: #f9fafb;
  color: #9ca3af;
}
.hour-box.current {
  border: 1.5px solid #000;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
}

.hour-label {
  font-size: 0.5rem; /* Мелкое время */
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.8;
}

.hour-val-today {
  font-size: 0.85rem; /* Жирные клики */
  font-weight: 900;
}

.hour-val-yesterday {
  font-size: 0.6rem;
  opacity: 0.6;
  margin-top: 1px;
}

.badge {
  border-radius: 4px;
  padding: 0.4em 0.6em;
}
/* Кнопки в колонке действий: вертикальный стек */
.actions-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.actions-stack .btn {
  width: 100%;
  padding: 2px 5px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

/* === МОБИЛЬНАЯ ВЕРСИЯ (Адаптив) === */
@media (max-width: 768px) {
  /* Превращаем таблицу в карточки */
  .custom-table,
  .custom-table thead,
  .custom-table tbody,
  .custom-table th,
  .custom-table td,
  .custom-table tr {
    display: block;
    width: 100%;
  }

  /* Прячем заголовки таблицы */
  .custom-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  /* Каждая строка - это теперь карточка с тенью */
  .custom-table tr {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid #eee;
  }

  /* Убираем рамки внутри карточки */
  .custom-table td {
    border: none;
    padding: 0.5rem 0 !important;
  }

  /* Блок "Проект" и "Unique Today" на одной строке */
  .custom-table td:nth-child(1) {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 0.8rem !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  /* Выравнивание для "Unique Today" */
  .custom-table td:nth-child(2) {
    text-align: left !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.8rem !important;
  }
  .custom-table td:nth-child(2)::before {
    content: "Today's Sessions:";
    font-size: 0.75rem;
    font-weight: 700;
    color: #6b7280;
  }

  /* Сетка 24 часа для мобильных */
  /* Мы скрываем половину часов. Умный JS сам решит, какую половину показать */
  .daily-grid {
    grid-template-columns: repeat(
      6,
      1fr
    ) !important; /* На мобилке по 6 в ряд */
  }

  .hour-box.hidden-on-mobile {
    display: none !important;
  }

  /* Кнопки действий: горизонтально снизу */
  .custom-table td:nth-child(4) {
    border-top: 1px solid #f0f0f0;
    padding-top: 0.8rem !important;
  }
  .actions-stack {
    flex-direction: row !important;
    width: 100%;
    gap: 8px;
  }
  .actions-stack .btn {
    flex-grow: 1; /* Кнопки растягиваются на всю ширину */
  }
}

/* ================================================================================= */
/* RESPONSIVE DESIGN (Tablets & Phones) */
/* ================================================================================= */

/* 1. Стили для заголовка формы Add Project (Аккордеон) */
.card-header[data-bs-toggle="collapse"] {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
}
.card-header[data-bs-toggle="collapse"]:hover {
  background-color: #fafafa !important;
}
.card-header[data-bs-toggle="collapse"] i {
  transition: transform 0.3s;
}
/* Поворот стрелочки при открытии */
.card-header:not(.collapsed) i {
  transform: rotate(180deg);
}

/* 2. Адаптивность для ПЛАНШЕТОВ (до 1024px) */
@media (max-width: 1024px) {
  .custom-table th:nth-child(1),
  .custom-table td:nth-child(1) {
    width: 180px;
  }
  .daily-grid {
    gap: 1px;
  }
  .hour-box {
    min-height: 40px;
  }
}

/* 3. Адаптивность для ТЕЛЕФОНОВ (до 768px) */
@media (max-width: 768px) {
  /* Контейнер на мобилках делаем плотнее */
  .container-fluid {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* Превращаем таблицу в набор карточек */
  .custom-table thead {
    display: none; /* Прячем заголовки таблицы */
  }

  .custom-table,
  .custom-table tbody,
  .custom-table tr,
  .custom-table td {
    display: block;
    width: 100% !important;
  }

  /* Каждая строка (TR) становится отдельной карточкой */
  .custom-table tr {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 1.2rem;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
  }

  .custom-table td {
    padding: 6px 0 !important;
    border: none !important;
  }

  /* Первый блок: Имя проекта и ГЕО */
  .custom-table td:nth-child(1) {
    border-bottom: 1px solid #f3f4f6 !important;
    margin-bottom: 8px;
    padding-bottom: 10px !important;
  }

  /* Второй блок: Unique Today (делаем подпись) */
  .custom-table td:nth-child(2) {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left !important;
  }
  .custom-table td:nth-child(2)::before {
    content: "SESSIONS TODAY:";
    font-size: 0.65rem;
    font-weight: 700;
    color: #9ca3af;
  }

  /* Третий блок: Сетка (показываем только 12 часов) */
  .custom-table td:nth-child(3) {
    margin: 12px 0;
  }

  .daily-grid {
    grid-template-columns: repeat(6, 1fr) !important; /* 6 колонок в 2 ряда */
    gap: 4px;
  }

  /* Синяя пометка Фрод (как TM) */
  .fraud-tag {
    color: #0d6efd; /* Ярко-синий */
    font-size: 0.65rem;
    font-weight: 800;
    vertical-align: super;
    margin-left: 2px;
    text-transform: uppercase;
    border: 1px solid #0d6efd;
    padding: 0px 3px;
    border-radius: 3px;
    line-height: 1;
    display: inline-block;
  }

  .fraud-count {
    color: #0d6efd;
    font-size: 0.85rem;
    font-weight: 600;
  }

  /* ✅ То самое скрытие 12 лишних часов из JS */
  .hour-box.hidden-on-mobile {
    display: none !important;
  }

  .hour-box {
    min-height: 50px;
    border-radius: 4px;
  }

  /* Четвертый блок: Кнопки (горизонтально в ряд) */
  .custom-table td:nth-child(4) {
    border-top: 1px solid #f3f4f6 !important;
    padding-top: 12px !important;
    margin-top: 5px;
  }

  .actions-stack {
    flex-direction: row !important; /* Кнопки в ряд */
    display: flex;
    gap: 8px;
  }

  .actions-stack .btn {
    flex: 1; /* Растягиваем кнопки поровну */
    padding: 8px 0;
    font-size: 0.7rem;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.sparkline-wrapper {
  width: 100%;
  margin-bottom: 20px;
}

.sparkline-html-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* Контейнер для одной "ноды" (точка + текст) */
.chart-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(
    -50%
  ); /* Центрируем по горизонтали относительно точки */
}

/* Сама точка (кружок) */
.label-point {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
  position: absolute;
  top: 0;
  transform: translateY(-50%); /* Центрируем по вертикали */
}

/* Цифра сверху */
.label-value {
  position: absolute;
  font-size: 13px;
  font-weight: 900;
  color: #111827;
  white-space: nowrap;
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 4px;
}

/* Дата снизу */
.label-date {
  position: absolute;
  font-size: 10px;
  font-weight: 600;
  color: #9ca3af;
  white-space: nowrap;
}

/* Чтобы график не обрезался в таблице */
.weekly-sparkline {
  height: 140px !important;
  overflow: visible !important;
}
