/* =====================================================
   Цветовая схема — меняйте значения здесь,
   чтобы изменить весь внешний вид сайта
   ===================================================== */
:root {
  /* Основной цвет (навбар, кнопки, ссылки) */
  --mdou-primary:     #5357A6;
  --mdou-primary-rgb: 83, 87, 166;

  /* Акцентный цвет */
  --mdou-accent:      #F2780C;
  --mdou-accent-rgb:  242, 120, 12;

  /* Переопределяем Bootstrap-переменные */
  --bs-primary:        var(--mdou-primary);
  --bs-primary-rgb:    var(--mdou-primary-rgb);
  --bs-link-color:     var(--mdou-primary);
  --bs-link-hover-color: color-mix(in srgb, var(--mdou-primary) 80%, black);
}

/* Переопределяем Bootstrap-классы цвета */
.bg-primary   { background-color: var(--mdou-primary) !important; }
.text-primary { color:            var(--mdou-primary) !important; }
.btn-primary  {
  background-color: var(--mdou-accent) !important;
  border-color:     var(--mdou-accent) !important;
  color: #212529 !important;
}
.btn-primary:hover {
  background-color: #F38A1A !important;
  border-color:     #F38A1A !important;
  color: #212529 !important;
}
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active {
  color: #212529 !important;
  background-color: var(--mdou-accent) !important;
  border-color:     var(--mdou-accent) !important;
}
.btn-outline-primary {
  color:        var(--mdou-primary) !important;
  border-color: var(--mdou-primary) !important;
}
.btn-outline-primary:hover {
  background-color: var(--mdou-primary) !important;
  color: #fff !important;
}

/* =====================================================
   Цвета мероприятий / дашборд
   ===================================================== */
.bg-online {
  background-color: #0d6efd !important;
}
.text-online {
  color: #0d6efd !important;
}

.dashboard-tiles .fs-2 {
  color: #F2780C !important;
}

/* Цвет типа мероприятия для иконок/элементов внутри карточек */
.event-scope {
  --event-color: var(--mdou-primary);
}
.event-scope--online {
  --event-color: #0d6efd;
}
.event-scope--holiday {
  --event-color: #dc3545;
}
.event-scope--activity {
  --event-color: #198754;
}
.event-scope--past {
  --event-color: #6c757d;
}
.event-scope .event-icon {
  color: var(--event-color) !important;
}

.status-icon {
  min-height: 2rem;
  min-width: 2rem;
  padding: 0.2rem 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  line-height: 1;
}
.status-icon--active {
  background: #198754;
  color: #fff;
}
.status-icon--inactive {
  background: #6c757d;
  color: #fff;
}

/* =====================================================
   Типографика и базовые стили
   ===================================================== */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src:
    url("../fonts/nunito/Nunito-cyrillic.fd4986b86093.woff2") format("woff2"),
    url("../fonts/nunito/Nunito-latin.166202cc391c.woff2") format("woff2");
}

body {
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* =====================================================
   Навбар / логотип
   ===================================================== */

/* Активный пункт меню */
.navbar-dark .nav-link.nav-link-active {
  color: #fff !important;
  font-weight: 600;
  position: relative;
}

.navbar-dark .nav-link.nav-link-active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0.5rem;
  right: 0.5rem;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}
.navbar-brand {
  font-size: 1.15rem;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.navbar-brand-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.navbar-brand-sub {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.85;
}

.navbar-logo {
  width: 36px !important;
  height: 36px !important;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
}

/* =====================================================
   Карточки
   ===================================================== */
.card {
  border-radius: 12px;
}

.card-hover {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1) !important;
}

/* =====================================================
   Кнопки и поля ввода
   ===================================================== */
.btn {
  border-radius: 8px;
}

.form-control,
.form-select {
  border-radius: 8px;
  border-color: #d0d7de;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--mdou-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--mdou-primary-rgb), 0.2);
}

/* =====================================================
   Таблицы
   ===================================================== */
.table th {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
}

/* Анкеты → Ответы: аккуратная шапка таблицы (без CAPS, с подсказкой) */
.responses-table thead th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.78rem;
  line-height: 1.15;
  vertical-align: top;
}
.responses-table thead th:not(:first-child):not(:nth-child(2)) {
  min-width: 14rem;
  max-width: 18rem;
}
.responses-table .responses-th {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.responses-table .responses-th-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.responses-table .responses-th-badge {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0;
}
.responses-table .responses-th-num {
  font-size: 0.7rem;
  color: #6c757d;
  font-weight: 600;
}
.responses-table .responses-th-text {
  white-space: normal;
  word-break: break-word;
  font-weight: 600;
  color: #495057;
}

/* =====================================================
   Логотип на странице входа
   ===================================================== */
.login-logo {
  width: 80px !important;
  height: 80px !important;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: 4px;
  box-shadow: 0 4px 16px rgba(var(--mdou-primary-rgb), 0.2);
}

/* =====================================================
   Футер
   ===================================================== */
footer {
  font-size: 0.8rem;
}

/* Пользователь: на мобилке — одна строка; на md+ — две (как раньше) */
.navbar .navbar-user-identity {
  font-size: 0.92rem;
  line-height: 1.35;
  max-width: 12.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Мобилка: основной текст чуть крупнее для комфорта */
@media (max-width: 575.98px) {
  main.container {
    font-size: 1.04rem;
  }
  .post-feed-body {
    font-size: 1.02rem;
  }
}

/* «Мои материалы»: бейдж статуса той же высоты, что кнопки .btn-sm */
.my-posts-status .badge {
  min-height: 2rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  line-height: 1.1;
  border-radius: 0.375rem;
}
.my-posts-status .btn-sm {
  min-height: 2rem;
  min-width: 2rem;
  padding: 0.2rem 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Якорь к карточке в ленте (редирект с /posts/id/) */
.post-feed-card {
  scroll-margin-top: 5.5rem;
}

/* Лента: длинный текст — одна колонка, «Показать» раскрывает тот же текст */
.post-feed-text {
  position: relative;
}
.post-feed-text--clamped {
  max-height: 12.5rem;
  overflow: hidden;
}
.post-feed-text--clamped::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.5rem;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    #fff
  );
  pointer-events: none;
}
.post-feed-body .post-feed-text--clamped {
  position: relative;
}
.post-feed-body .post-feed-text--clamped::after {
  border-radius: 0 0 0.5rem 0.5rem;
}

.post-feed-toggle {
  position: relative;
  z-index: 2;
}

/* Лента материалов: превью фото */
.post-feed-img {
  max-height: 280px;
  object-fit: cover;
}

/* Детальная публикация: сетка картинок */
.post-detail-img {
  max-height: 360px;
  object-fit: cover;
}

/* Прошедшие мероприятия */
.event-card--past {
  opacity: 0.9;
  filter: grayscale(0.25);
}

/* FullCalendar: компактные кнопки и без наложения заголовка на мобилке */
.fc .fc-button {
  font-size: 0.8rem;
  line-height: 1.2;
  padding: 0.2rem 0.45rem;
  font-weight: 500;
}
.fc .fc-daygrid-day-number {
  color: var(--mdou-primary) !important;
}
.fc .fc-col-header-cell-cushion {
  color: var(--mdou-primary) !important;
}
.fc .fc-toolbar-title {
  font-size: 1rem;
  font-weight: 600;
}

/* FullCalendar: время в месячном виде должно быть заметным */
.fc .fc-daygrid-event {
  white-space: nowrap;
}
.fc .fc-daygrid-event .fc-event-time {
  font-weight: 700;
  opacity: 1;
  /* Чтобы "14:00" не обрезалось до "14:0" */
  display: inline-block;
  min-width: 5ch;
  padding-right: 0.1rem;
}
.fc .fc-daygrid-event .fc-event-title {
  font-weight: 600;
}

/* FullCalendar (month): время в одной строке, заголовок — обрезка с троеточием */
.fc .fc-daygrid-event .fc-event-main {
  min-width: 0;
}
.fc .fc-daygrid-event .fc-event-main-frame {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.25rem;
}
.fc .fc-daygrid-event .fc-event-time {
  flex: 0 0 auto;
}
.fc .fc-daygrid-event .fc-event-title-container {
  flex: 1 1 auto;
  min-width: 0;
}
.fc .fc-daygrid-event .fc-event-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .fc .fc-header-toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
  }
  /* Сначала месяц, затем стрелки, затем «Сегодня» — без перекрытия */
  .fc .fc-header-toolbar .fc-toolbar-chunk:nth-child(1) {
    order: 2;
  }
  .fc .fc-header-toolbar .fc-toolbar-chunk:nth-child(2) {
    order: 1;
  }
  .fc .fc-header-toolbar .fc-toolbar-chunk:nth-child(3) {
    order: 3;
  }
  .fc .fc-toolbar-chunk {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
  }
  .fc .fc-toolbar-title {
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.2;
    width: 100%;
    margin: 0;
    padding: 0 0.25rem;
  }
  .fc .fc-button {
    font-size: 0.65rem !important;
    line-height: 1.1 !important;
    padding: 0.12rem 0.4rem !important;
    min-height: 0;
  }
  .fc .fc-today-button {
    font-size: 0.65rem !important;
  }
}
