:root {
  --main: #f80;
  --main-medium: #ff88007d;
  --main-light: #ff88002b;
}

.post-inner {
  background-color: #ffffff30;
  border-radius: 8px;
  margin-bottom: 20px;
  padding: 10px;
  position: relative;
}

.comments-wrapper {
  background-color: var(--main-light);
  border-radius: 4px;
  padding: 10px;
  position: relative;
  overflow-y: auto;
}

/* --- Комментарии под постом --- */
.comments-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.comments-toggle-btn {
  background: var(--main-light);
  color: #f80;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  align-self: flex-start;
  transition: background 0.2s;
}
.comments-toggle-btn:hover {
  background: var(--main-medium);
}
/* --- Форма комментария --- */
.add-comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.add-comment-input-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.add-comment-submit-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex: 0 0 auto;
}

.add-comment-input input {
  background: #fff;
}
.add-comment-btn {
  background: var(--main);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 16px;
  cursor: pointer;
  font-size: 20px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
}
.add-comment-btn:hover {
  background: #e06d00;
}
.add-comment-btn-text {
  font-size: 15px;
  margin-right: 6px;
  display: inline-block;
}
.comment-arrow-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
}

.add-comment-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  min-height: 80px;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  word-break: break-word;
  white-space: pre-wrap;
}

.comments-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--main-light);
  border-radius: 4px;
  padding: 10px;
  margin-top: 4px;
}

.time-subtext {
  color: #000;
  display: inline-block;
  font-family: Kurale, system-ui;
  font-size: 12px;
  font-weight: 300;
}

.chat-bg-wrapper {
  position: relative;
  min-height: 100vh;
}
.chat-container:before {
  background-image: url(./images/f7.png);
  background-position: 50%;
  background-size: cover;
  content: "";
  height: 100%;
  left: 0;
  opacity: 0.2;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: 2;
  pointer-events: none;
}

/* Чат поддержки */
.chat-modal {
  display: none;
}

.chat-modal .modal-dialog {
  width: 100%;
  margin: 0;
}

.chat-modal .modal-content {
  height: 100vh;
  margin: 0;
  border-radius: 0;
}

.chat-modal .modal-header {
  padding: 10px 20px;
  background: #e8e8e8;
  color: white;
  border-bottom: none;
}

.chat-modal .modal-header .close {
  color: white;
  opacity: 1;
  margin: 0;
}

.chat-modal .modal-header .close:hover {
  color: #fff;
  opacity: 0.8;
}

.chat-modal .modal-title {
  margin: 0;
  color: black;
  font-weight: 500;
}

.chat-container {
  height: 100vh;
  padding: 0;
  margin: 0;
  background-color: var(--main-medium);
}

.chat-wrapper {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.chat-color-wrapper {
  background-image: url(./images/bg-old-paper.jpg);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  min-height: 100vh;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 953px;
  margin: 0 auto;
  width: 100%;
  z-index: 14;
}

.chat-header {
  padding: 15px 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: transparent;
}

.chat-status-indicator {
  width: 12px;
  height: 12px;
  background: #4a90e2;
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-status-indicator.online {
  background: #28a745;
}

.chat-status-indicator.offline {
  background: #dc3545;
}

.chat-status-text {
  color: #333;
  font-weight: 500;
  flex: 1;
}

.chat-connection-status {
  color: #666;
  font-size: 12px;
  margin-left: auto;
}

/* Контейнер сообщений */
.chat-messages {
  padding: 10px 10px 100px 10px;
  border: none;
  margin-bottom: 15px;
  overflow-y: auto;
}

/* Сообщения */
.message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 12px 18px;
  background-color: #ffffff30;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.message.own {
  text-align: right;
}

.message.other {
  text-align: left;
}

.message-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
}

.message-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: white;
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  max-width: 80%;
  margin-bottom: 2px;
}

.message.own .message-content {
  background: #007bff;
  color: white;
}

.message-text {
  font-size: 16px;
  color: #222;
  margin-bottom: 4px;
  word-break: break-word;
}

.message.own .message-text {
  color: white !important;
}

.message.other .message-text {
  color: #000000 !important;
}

.message-time {
  font-size: 13px;
  color: #888;
  margin-top: 0;
  margin-bottom: 0;
}

/* Редактор сообщений */
.message-editor {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
}

.editor-buttons {
  margin-top: 8px;
  text-align: right;
}

.editor-buttons button {
  border: none;
  padding: 6px 12px;
  margin: 0 4px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.editor-buttons .cancel-btn {
  background: #6c757d;
  color: white;
}

.editor-buttons .cancel-btn:hover {
  background: #5a6268;
}

.editor-buttons .save-btn {
  background: #007bff;
  color: white;
}

.editor-buttons .save-btn:hover {
  background: #0056b3;
}

.post-card {
  margin-bottom: 15px;
}

/* Системные сообщения */
.system-message {
  margin-bottom: 15px;
  text-align: center;
}

.system-message-content {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.system-message.info .system-message-content {
  background: #17a2b8;
  color: white;
}

.system-message.success .system-message-content {
  background: #28a745;
  color: white;
}

.system-message.warning .system-message-content {
  background: #ffc107;
  color: #212529;
}

.system-message.error .system-message-content {
  background: #dc3545;
  color: white;
}

/* Ошибка истечения токена */
.token-expired-error {
  margin: 20px 10px;
  padding: 15px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(238, 90, 82, 0.3);
  border-left: 4px solid #fff;
}

.token-expired-error .error-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.token-expired-error .error-message {
  font-size: 14px;
  margin-bottom: 12px;
  opacity: 0.9;
}

.token-expired-error .close-button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.token-expired-error .close-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* === FAB Add Post Button === */
.fab-add-post {
  position: static;
  margin: 0;
  width: 56px;
  height: 56px;
  background: #007bff;
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  border: none;
}
.fab-add-post:hover {
  background: #0056b3;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

/* === Diary Post Modal === */
.diary-post-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.diary-post-modal {
  background: #fff;
  border-radius: 16px;
  max-width: 600px;
  width: 90vw;
  min-width: 320px;
  padding: 32px 24px 24px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 3000;
}
#diary-post-modal-title {
  margin: 0 0 8px 0;
  font-size: 1.3em;
  font-weight: 600;
  text-align: center;
}
#diary-post-modal-text {
  width: 100%;
  min-height: 120px;
  font-size: 16px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  resize: vertical;
  box-sizing: border-box;
}
.diary-post-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
#diary-post-cancel,
#diary-post-save {
  padding: 8px 20px;
  border-radius: 6px;
  border: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
#diary-post-cancel {
  background: #f5f5f5;
  color: #333;
}
#diary-post-cancel:hover {
  background: #e0e0e0;
}
#diary-post-save {
  background: #007bff;
  color: #fff;
}
#diary-post-save:hover {
  background: #0056b3;
}

/* Удаляю стили для .chat-input, .chat-send-button, .chat-input-panel */
.chat-input,
.chat-send-button,
.chat-input-panel {
  display: none !important;
}

.chat-actions-panel {
  position: fixed;
  bottom: 32px;
  right: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  z-index: 35;
  @media (max-width: 500px) {
    flex-direction: row;
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  .chat-messages {
    padding: 15px;
  }

  .chat-header {
    padding: 12px 15px;
  }

  .chat-input-panel {
    padding: 12px 15px;
  }

  .message-bubble {
    max-width: 90%;
  }
}

/* Скроллбар */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Стили календаря дневника */
.diary-calendar-btn {
  position: static;
  margin: 0;
  width: 48px;
  height: 48px;
  background: #454545;
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  z-index: 3001;
  transition: background 0.2s;
}

.diary-calendar-btn i {
  font-size: 22px;
}

.diary-calendar {
  position: fixed;
  bottom: 120px;
  right: 50px;
  width: 280px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  z-index: 1200;
  font-family: "Kurale", system-ui;
  border: 1px solid #e1e8ed;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e1e8ed;
  border-radius: 8px 8px 0 0;
}

.calendar-month {
  font-weight: 600;
  font-size: 16px;
  color: #333;
}

.calendar-prev,
.calendar-next,
.calendar-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #666;
  padding: 5px;
  border-radius: 4px;
  transition: 0.2s;
}

.calendar-prev:hover,
.calendar-next:hover {
  background: #e9ecef;
  color: #333;
}

.calendar-close {
  font-size: 20px;
  color: #999;
}

.calendar-close:hover {
  background: #ffebee;
  color: #f44336;
}

.calendar-body {
  padding: 10px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 5px;
}

.calendar-weekday {
  padding: 8px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  background: #f8f9fa;
  border-radius: 4px;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-day {
  position: relative;
  padding: 8px 4px;
  text-align: center;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  transition: 0.2s;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day.current-month {
  background: #fff;
  color: #333;
}

.calendar-day.other-month {
  background: #f8f9fa;
  color: #ccc;
}

.calendar-day:hover {
  background: #e3f2fd !important;
  color: #1976d2;
}

.calendar-day.has-records {
  background: #4cd964;
  color: white;
  font-weight: 600;
}

.calendar-day.has-records:hover {
  background: #43c85a !important;
  opacity: 0.9;
}

.record-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  background: #ff4444;
  border-radius: 50%;
  font-size: 0;
}

.calendar-day.has-records .record-indicator {
  background: rgba(255, 255, 255, 0.8);
}

/* Адаптивность для календаря */
@media (max-width: 768px) {
  .diary-calendar-btn {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }

  .diary-calendar {
    bottom: 80px;
    right: 20px;
    width: 260px;
  }
}

.action-btn {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0 4px;
  cursor: pointer;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.13s cubic-bezier(0.4,0.2,0.2,1);
}
.action-btn img {
  width: 32px;
  height: 32px;
  display: block;
  object-fit: contain;
  pointer-events: none;
  transition: transform 0.13s cubic-bezier(0.4,0.2,0.2,1);
}
.action-btn:hover,
.action-btn:focus {
  /* Только увеличение, без цвета */
  transform: scale(1.18);
  background: transparent !important;
  color: inherit !important;
  box-shadow: none !important;
  border: none !important;
}
.action-btn:hover img {
  transform: scale(1.18);
}
.fab-add-post:hover,
.diary-calendar-btn:hover,
#diary-post-save:hover,
#diary-post-cancel:hover,
#select-student-btn:hover,
.editor-actions button:hover,
#editor-save-btn:hover,
#editor-cancel-btn:hover {
  background: inherit !important;
  color: inherit !important;
  box-shadow: none !important;
  border: none !important;
}

.date-header {
  text-align: center;
  color: #000000;
  font-family: Kurale, system-ui;
  font-size: 18px;
}

.inline-comment-btn {
  position: absolute;
  z-index: 100020;
  width: 40px;
  height: 40px;
  border: 2px solid var(--main);
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.18s;
  opacity: 1;
  pointer-events: auto;
  padding: 0;
}

.inline-comment-btn svg {
  width: 24px;
  height: 24px;
  display: block;
}

.inline-comment-btn:active {
  transform: scale(0.95);
}

.add-comment-sendbox {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.comment {
  max-width: 420px;
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 15px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  word-break: break-word;
  background: #fff;
  align-self: flex-start;
  box-sizing: border-box;
}
.comment.owner {
  background: #fff;
  border: 1px solid #e0e0e0;
}
.comment.curator {
  background: #fffae6;
  border: 1px solid #ff88002b;
  align-self: flex-start;
}

/* Отключение всех jQuery UI тултипов */
.ui-tooltip,
.ui-tooltip * {
  display: none !important;
}

/* === Редактор поста (fullscreen, как chat-modal) === */
#post-editor-page.chat-modal {
  display: none;
  z-index: 300000 !important;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
#post-editor-page.in {
  display: block;
  z-index: 300000 !important;
}
#post-editor-page .modal-dialog,
#post-editor-page .modal-content,
#post-editor-page .chat-container,
#post-editor-page .chat-wrapper,
#post-editor-page .chat-color-wrapper {
  z-index: 300001 !important;
}
#post-editor-page .modal-header {
  padding: 10px 20px;
  background: #e8e8e8;
  color: white;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#post-editor-page .modal-title {
  margin: 0;
  color: black;
  font-weight: 500;
}
#post-editor-page .close {
  color: white;
  opacity: 1;
  margin: 0;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
}
#post-editor-page .close:hover {
  color: #fff;
  opacity: 0.8;
}
#post-editor-page .chat-container {
  height: 100vh;
  padding: 0;
  margin: 0;
  background-color: var(--main-medium);
  display: flex;
  align-items: center;
  justify-content: center;
}
#post-editor-page .chat-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}
#post-editor-page .chat-color-wrapper {
  background-color: #e7e7e766;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  z-index: 14;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
#post-editor-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
#post-editor-page-title {
  font-size: 18px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  margin-bottom: 8px;
}
#post-editor-page-text {
  width: 100%;
  font-size: 16px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  min-height: 120px;
  background: #fff;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
  word-break: break-word;
}
#emoji-panel-page {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#emoji-panel-page img {
  width: 28px;
  height: 28px;
  cursor: pointer;
  transition: transform 0.1s;
}
#emoji-panel-page img:hover {
  transform: scale(1.15);
}
#post-editor-form .btn {
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}
#post-editor-form .btn-main {
  background: #ffa94b;
  color: #fff;
}
#post-editor-form .btn-main:hover {
  background: #e06d00;
}
#post-editor-form .btn-light {
  background: #fff;
  color: #333;
  border: 1px solid #bbb;
  font-weight: 400;
}
#post-editor-form .btn-light:hover {
  background: #f5f5f5;
}

/* === Стили редактора поста (editor-wrapper) — теперь как chat-messages === */
.editor-wrapper {
  border-radius: 8px;
  width: 100%;
  padding: 10px 10px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: none;
  margin: 0;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  justify-content: space-between;
}

.editor-title {
  max-width: 300px;
  width: 100%;
}

.editor-header input {
  flex: 1 1 0;
  font-size: 18px;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  max-width: 300px;
  width: 100%;
}
.editor-actions {
  display: flex;
  gap: 7px;
}
#editor-save-btn {
  color: #111;
  border: 2px solid #ffa94b;
  background: transparent;
  border-radius: 6px;
  padding: 6px 18px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
#editor-save-btn:hover {
  background: #ffa94b22;
}
.editor-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.editor-textarea {
  width: 100%;
  min-height: 120px;
  font-size: 16px;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: transparent;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
  word-break: break-word;
}
.editor-emoji-panel {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.editor-emoji-panel img {
  width: 28px;
  height: 28px;
  cursor: pointer;
  transition: transform 0.1s;
}
.editor-emoji-panel img:hover {
  transform: scale(1.15);
}

/* --- Комментарии: выравнивание, фон, полоска даты --- */
.comment-student {
  align-self: flex-end;
  background: #fffbe6;
  border-radius: 10px;
  padding: 12px 16px 22px 16px;
  position: relative;
  margin-bottom: 12px;
}
.comment-curator {
  align-self: flex-start;
  background: #fff3e0;
  border-radius: 10px;
  padding: 12px 16px 22px 16px;
  position: relative;
  margin-bottom: 12px;
}
.comment-avatar {
  background-size: cover;
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 40px;
    z-index: 100;
    left: -45px;
    bottom: 0px;
}
.my-comment {
  background: #fff;
}
.comment-text-main {
  color: #333;
  margin-bottom: 0;
}
.comment-date-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 18px;
  font-size: 13px;
  color: #555;
  text-align: right;
  line-height: 18px;
  padding-right: 12px;
  background: none;
  border-bottom: 21px solid #ffe5b4;
  border-radius: 0 0 10px 10px;
  box-sizing: border-box;
}
.comment-curator .comment-date-bar {
  border-bottom: 21px solid #ffb347;
}
.comment-student .comment-date-bar {
  border-bottom: 21px solid #ffe5b4;
}

/* --- Редактор поста: прозрачный input --- */
.editor-header input#editor-title {
  background: transparent !important;
}

/* --- Комментарии: белый input --- */
.add-comment-input[contenteditable="true"] {
  background: #fff !important;
}
