/* Базовые */
*{box-sizing:border-box}
body{margin:0;font-family:'Segoe UI',Arial,sans-serif;background:#17181c;color:#fff;display:flex;min-height:100vh}

/* Сайдбар */
.sidebar{width:200px;min-width:200px;max-width:200px;background:#181920;padding:24px 0;height:100vh;box-shadow:1px 0 10px #0a0a0a55}
.sidebar h1{font-size:18px;margin:0 0 32px 24px;color:#ffd700}
.sidebar ul{list-style:none;padding:0;margin:0}
.sidebar li{padding:12px 24px;cursor:pointer;transition:background .2s;color:#eee;border-left:4px solid transparent}
.sidebar li.active,.sidebar li:hover{background:#24263a;color:#ffd700;border-left:4px solid #ffd700}

/* Контент */
main{flex-grow:1;padding:36px 48px 24px 48px;display:flex;flex-direction:column}


.header .banner {
  background: linear-gradient(135deg, #667eea 20%, #764ba2 100%);
  border-radius: 12px;
  padding: 16px 32px;
  color: #fff;
  font-size: 18px;
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: left;
}
.header .banner button {
  background: #ffd700;
  border: none;
  color: #000;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight:500;
  align-items: right;
}


.filters{display:flex;align-items:center;margin:16px 0 8px;gap:12px;flex-wrap:wrap}
.filter-btn{background:#2d3748;color:#e8eaed;border:1px solid #4a5568;border-radius:12px;padding:10px 18px;font-size:14px;font-weight:500;cursor:pointer}
.filter-btn.active{background:#00d4aa;color:#0f1114;border-color:#00d4aa}

/* Скрыть старый фильтр, если остался */
.filter-extra{display:none!important}

/* Кнопка добавления */
.actions-row{display:flex;align-items:center;gap:12px;margin:8px 0 16px}
.add-practice-btn{background:#ffd700;color:#23263a;border:none;border-radius:10px;padding:10px 18px;font-size:15px;cursor:pointer;box-shadow:0 2px 8px #0002}
.add-practice-btn:hover{filter:brightness(1.05)}

/* Карточка */

.header .banner {
  background: linear-gradient(90deg, #4440a5 20%, #433369 100%);
  border-radius: 12px;
  padding: 16px 32px;
  color: #fff;
  font-size: 18px;
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header .banner button {
  background: #ffd700;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
}
.filters {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
}
.filter-btn {
  background: #24263a;
  color: #fff;
  border: none;
  border-radius: 8px;
  margin-right: 12px;
  padding: 8px 20px;
  font-size: 15px;
  cursor: pointer;
  outline: none;
  box-shadow: 0 2px 8px #0002;
}
.filter-btn.active {
  background: #ffd700;
  color: #23263a;
}
.filter-extra {
  background: #151722;
  color: #fff;
  border: 1px solid #353850;
  border-radius: 8px;
  padding: 8px 20px;
  margin-left: 12px;
  font-size: 15px;
  cursor: pointer;
}
.content {
  margin-top: 0;
  min-height: 540px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.post-card {
  background: linear-gradient(120deg, #2b3345 70%, #25413a 100%);
  border-radius: 18px;
  box-shadow: 0 4px 32px #0006;
  padding: 28px 32px 18px 32px;
  width: 740px;
  margin-bottom: 18px;
}
.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.avatars {
  display: flex;
}
.avatars img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #fff4;
  margin-right: -10px;
  object-fit: cover;
  background: #334;
}
.post-date {
  font-size: 15px;
  color: #b5b5b7;
}
.post-content {
  font-size: 17px;
  margin-bottom: 18px;
  word-break: break-word;
}
.highlight {
  color: #ffd700;
  font-weight: 500;
}
.post-footer {
  border-top: 1px solid #314858;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
}
.leaders {
  font-size: 15px;
  color: #ffd700;
}
.likes-row {
  display: flex;
  align-items: center;
  margin-top: 10px;
}
.like-btn {
  background: #ffd700;
  color: #212539;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 15px;
  cursor: pointer;
  margin-right: 16px;
  box-shadow: 0 2px 8px #0002;
}


/* ==== CHAT BAR: clean, conflict-free ==== */
.plex-chat-bar {
  box-sizing: border-box;
  position: fixed;
  left: 215px;
  right: 35px;
  bottom: 32px;
  max-width: 1100px;
  min-width: 300px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;      /* важно для textarea, которая растёт вниз */
  background: #23262a;
  border-radius: 20px;
  border: 1.5px solid #353a44;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
  padding: 8px 18px;         /* вертикальные паддинги вместо фикс. высоты */
  height: auto;              /* убираем фиксированную высоту */
  min-height: 64px;          /* базовая высота — как раньше */
  z-index: 12;
  gap: 15px;
  padding-top: 8px; padding-bottom: 8px;
}

/* Если в HTML случайно остался input — прячем, чтобы не мешал textarea */
.plex-chat-bar input { display: none !important; }

/* Основное поле — авто-расширяемая textarea */
.plex-chat-bar textarea {
  flex: 1; min-width: 0; width: 100%; max-width: 100%;
  background: transparent; color: #fff; border: none; outline: none;
  font: 16px/1.45 'Segoe UI', Arial, sans-serif; padding: 10px 0;
  resize: none; overflow: hidden; min-height: 24px; height: auto; max-height: 	180px;
  caret-color: #ffd700; -webkit-appearance: none;
}

.plex-chat-bar textarea::placeholder { color: #b3b8be; opacity: 1; }

/* Кнопка не сжимается при расширении поля */
.plex-chat-bar button { flex-shrink: 0; }



/* Модалки */
.modal{position:fixed;inset:0;display:none;z-index:1000}
.modal.open{display:block}
.modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.55)}
.modal-dialog{position:relative;margin:8vh auto;width:min(900px,calc(100vw - 120px));background:#1b1d24;color:#fff;border:1px solid #313549;border-radius:14px;box-shadow:0 20px 80px #000c;padding:0;max-height:84vh;overflow:hidden}
.modal-header{display:flex;align-items:left;justify-content:space-between;padding:16px 18px;border-bottom:1px solid #2c3142}
.modal-close{background:transparent;border:none;color:#b7bcc7;font-size:26px;cursor:pointer;line-height:1}
.modal-close:hover{color:#ffd700}
.modal-body{padding:18px 20px;overflow:auto;max-height:calc(84vh - 98px)}
.form-group{margin-bottom:18px}
.field-title{font-size:15px;font-weight:600;margin-bottom:6px;color:#ffd700}
.field-sub{font-size:13px;color:#aeb3bd;margin-bottom:10px}
.field-input{width:100%;min-height:88px;max-height:360px;background:#23262a;color:#fff;border:1px solid #353a44;border-radius:10px;padding:12px 12px;font-size:15px;line-height:1.45;resize:vertical;overflow:auto}
.field-input::placeholder{color:#b3b8be}
.modal-actions{display:flex;justify-content:flex-end;margin-top:8px}
.submit-practice-btn{background:#ffd700;color:#23263a;border:none;border-radius:10px;padding:10px 18px;font-size:15px;cursor:pointer;box-shadow:0 2px 8px #0002}
.submit-practice-btn:hover{filter:brightness(1.05)}
.read-body{white-space:pre-wrap;line-height:1.5;font-size:15px}

/* Адаптив */
@media (max-width:1024px){.sidebar{width:200px;min-width:200px;max-width:200px}main{padding:24px 32px 140px}.plex-chat-bar{left:200px;right:20px;min-width:400px}}
@media (max-width:768px){.sidebar{width:60px;min-width:60px;max-width:60px}.sidebar h1{display:none}.nav-item{padding:16px 12px;justify-content:center}main{padding:20px 20px 140px}.plex-chat-bar{left:60px;right:15px;min-width:300px;padding:6px 12px}}



/* МОБИЛЬНАЯ АДАПТАЦИЯ: меню в футер при <900px */

/* При ширине < 900px: перенос сайдбара в футер */
@media (max-width: 900px) {
  /* Общая структура */
  body {
    flex-direction: column;
    padding-bottom: 80px; /* место для footer-nav */
  }

  /* Прячем сайдбар из основного потока */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    padding: 0;
    background: #181920;
    border-top: 1px solid #2d3748;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
  }

  /* Скрываем заголовок в мобильном футере */
  .sidebar h1 {
    display: none;
  }

  /* Горизонтальное меню в футере */
  .sidebar ul {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 8px;
    margin: 0;
  }

  .sidebar li {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    border-left: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sidebar li.active,
  .sidebar li:hover {
    background: transparent;
    border-left: none;
    border-bottom: 3px solid #ffd700;
    color: #ffd700;
  }

  /* Основной контент без отступов сайдбара */
  main {
    width: 100%;
    padding: 16px 16px 24px 16px;
    margin-left: 0;
  }

  /* Сжимаем баннер */
  .header .banner {
    padding: 12px 16px;
    font-size: 16px;
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  /* Карточки: резиновые, на всю ширину */
  .post-card {
    width: 100%;
    max-width: 100%;
    padding: 20px 16px 14px 16px;
    margin-bottom: 16px;
  }

  /* Чат-бар: на всю ширину, отступ от футера */
  .plex-chat-bar {
    left: 8px;
    right: 8px;
    bottom: 88px; /* над footer-nav */
    min-width: auto;
    max-width: none;
    padding: 6px 12px;
    border-radius: 16px;
  }

  /* Модалы: адаптация для мобильного */
  .modal-dialog {
    margin: 4vh auto;
    width: calc(100vw - 32px);
    max-height: 92vh;
  }
}

/* Дополнительная адаптация для очень узких экранов < 480px */
@media (max-width: 480px) {
  main {
    padding: 12px 12px 20px 12px;
  }

  .post-card {
    padding: 16px 12px 12px 12px;
  }

  .plex-chat-bar {
    left: 6px;
    right: 6px;
    padding: 5px 10px;
  }

  .sidebar li {
    font-size: 13px;
    padding: 10px 6px;
  }
}

