/* ===========================================
   📱 MOBILE STYLES — max-width: 768px
   =========================================== */
@media (max-width: 768px) {

  /* ------------------------
     БАЗОВЫЕ СТИЛИ
     ------------------------ */
  body {
    margin: 10px;
    padding: 10px;
    font-size: 0.95rem;
  }

  h1 {
    font-size: 2rem;
    margin-bottom: 20px;
  }

  /* ------------------------
     ФОРМЫ
     ------------------------ */
  form#messageForm {
    padding: 20px 15px;
  }

  input[type="text"],
  textarea {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  .form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
  }

  #themeToggleBtn { order: 1; }
  #notificationsBell { order: 2; }

  .left-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
  }

  .left-controls input[type="text"] {
    flex: 1;
    min-width: 250px;
    font-size: 1rem;
    padding: 14px 18px;
  }

  .right-controls {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  #pollToggleBtn { order: 2; }

  /* ------------------------
     КНОПКИ
     ------------------------ */
  button {
    padding: 12px 20px;
    font-size: 1rem;
  }

  .button-plain,
  button.no-bg,
  #pollToggleBtn,
  .commentsToggleBtn,
  .comment button,
  #commentsToggle {
    padding: 6px 10px;
    font-size: 0.95rem;
  }

  /* ------------------------
     СООБЩЕНИЯ И КОММЕНТАРИИ
     ------------------------ */
.message,
.comment {
  padding: 8px 6px; /* уменьшаем внутренние отступы */
}

.comment {
  padding-left: 4px;  /* минимальный отступ внутри блока */
  margin: 4px 0;      /* уменьшаем вертикальные промежутки */
}

/* вложенные комментарии */
.comment .comment { 
  margin-left: 6px;  /* сильно уменьшили отступ слева */
  padding-left: 4px; /* можно оставить минимальный внутренний отступ */
}

.comment .comment .comment { 
  margin-left: 6px;  /* одинаковый шаг для всех уровней */
  padding-left: 4px;
}

.comment .comment .comment .comment {
  margin-left: 6px; 
  padding-left: 4px;
}

  .toggle-replies-btn { font-size: 0.75rem; }
  .message-time,
  .comment-time { font-size: 0.8rem; }

  /* ------------------------
     ЛАЙКИ / ДИЗЛАЙКИ
     ------------------------ */
  .likesDislikes { gap: 10px; }
  .likesDislikes button { padding: 4px 8px; }

  /* ------------------------
     ОПРОСЫ
     ------------------------ */
  #addPollOptionBtn { font-size: 1.2rem; padding: 6px 12px; }
  .poll-options button { padding: 10px 12px; font-size: 0.95rem; }
  .pollResults div { font-size: 0.95rem; }
  .pollBarContainer { width: 100%; }

  /* ------------------------
     ПАГИНАЦИЯ
     ------------------------ */
  .pagination button { padding: 8px 15px; font-size: 1rem; }
  .pagination span { font-size: 1rem; }
  #pageIndicator { margin: 0 5px; }

  /* ------------------------
     ВСПЛЫВАЮЩИЕ ОКНА
     ------------------------ */
  .message-popup-overlay {
    right: 5px;
    bottom: 10px;
    width: 95%;
    max-height: 50vh;
    padding-right: 5px;
    border: 2px solid #c4f0c5;
    border-radius: 4px;
  }

  .message-popup {
    width: 100%;
  }

  .message-popup .message {
    box-shadow: var(--shadow-sm);
    padding: 10px;
  }


  /* ------------------------
     TOP CONTROLS
     ------------------------ */
  #topControls {
    flex-direction: row-reverse;
    gap: 6px;
    top: 5px;
    right: 5px;
  }

  #notificationsBell {
    font-size: 20px;
    padding: 6px 10px;
  }

  #notificationsCount {
    top: 2px;
    right: 6px;
    padding: 1px 4px;
    font-size: 0.7rem;
  }

  /* ------------------------
     ПРОЧЕЕ
     ------------------------ */
  #searchInput {
    font-size: 0.95rem;
    padding: 5px 8px;
    border: 1.8px solid #ddd;
    border-radius: var(--radius);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
  }

  #searchInput:focus {
    border-color: #5b9bd5;
    outline: none;
    box-shadow: 0 0 8px 2px #5b9bd5aa;
  }

  body.dark-theme #searchInput {
    background-color: #2c2c2c;
    border: 1.8px solid #555;
    color: #ddd;
  }

  .comments-count { font-size: 0.95rem; }

  .messages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
  }

  .left-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
  }

  .right-section {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .header-title {
    font-weight: 600;
    font-size: 1.2rem;
    color: #333;
  }

  body.dark-theme .header-title { color: #ccc; }

  /* ------------------------
     УВЕДОМЛЕНИЯ
     ------------------------ */
  #notificationsContainer {
    width: 60%;
    max-width: 100vw;
    box-sizing: border-box;
    max-height: 300px;
    position: fixed;
    top: 70px;
    right: 5px;
    border-radius: 6px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
  }

  #notificationsContainer .notifications-list {
    overflow-y: auto;
    max-height: 250px;
    margin-top: 0;
  }

  #notificationsContainer .clear-all-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 0.9rem;
    margin: 5px;
    align-self: flex-end;
  }

  .message-text,
.comment-text  {
  font-size: 1rem;
}

 #clearSearchBtn {
  right: -10px;
}

.subtitle {
  font-size: 1.1rem;
}

.comment div textarea + button {
  display: none !important;
}

.comment div textarea {
  margin-bottom: 0 !important;
}

}