/* Общие стили для проекта Chaos Organizer */

/* Общие цвета */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-on-primary: #f9fafb;
    --text-on-dark: #e5e7eb;
    --bg-light: #f8fafc;
    --bg-panel: #ffffff;
    --bg-sidebar: #f1f5f9;
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;
    --hover-bg: #e5e7eb;
    --tg-blue: var(--primary-color);
    --tg-blue-hover: var(--primary-hover);
    /* Шкала z-index */
    --z-base: 1;
    --z-dropdown: 10;
    --z-sticky: 100;
    --z-overlay: 1000;
    --z-sidebar: 1001;
    --z-modal: 2000;
    --z-toast: 9999;
    /* Брейкпоинты (для медиа-запросов использовать те же значения: 769px, 480px) */
    --breakpoint-tablet: 769px;
    --breakpoint-mobile: 480px;
    /* Тёмный градиент для карточек видео */
    --attachment-video-bar-start: #374151;
    --attachment-video-bar-end: #1f2937;
    /* Единая анимация для панелей (скрытие/раскрытие) */
    --panel-duration: 0.2s;
    --panel-ease: ease;
    --panel-transition: opacity var(--panel-duration) var(--panel-ease),
        visibility var(--panel-duration) var(--panel-ease);
    /* Настройки темы (переопределяются из настроек) */
    --app-bg: linear-gradient(135deg, #9ca3af 0%, #6b7280 50%, #4b5563 100%);
    --app-bg-root: #f9fafb;
    --app-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --app-font-size: 1rem;
    --app-spacing-scale: 1;
    /* Фон сообщений (переопределяется из настроек) */
    --message-bg: rgba(120, 120, 120, 0.2);
    --message-bg-hover: rgba(120, 120, 120, 0.5);
    /* Фон основной области контента */
    --main-content-bg: rgba(120, 120, 120, 0.2);
}

/* Общие кнопки */
.action-button {
    background: none;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-button:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

.primary-button {
    background: var(--primary-color);
    color: var(--text-on-primary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-button:hover {
    background: var(--primary-hover);
}

/* Общие утилиты */
.hidden {
    display: none !important;
}

/* Единая стилистика раскрытия/скрытия панелей (opacity + visibility) */
.panel-reveal {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: var(--panel-transition);
}
.panel-reveal.is-open,
.panel-reveal.show,
.panel-reveal.visible,
.panel-reveal.drop-overlay-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Общие анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Общие стили для форм */
input, textarea, select {
    font-family: inherit;
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
}

input:focus-visible, textarea:focus-visible, select:focus-visible {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(75, 85, 99, 0.15);
}
/* Базовые стили для Chaos Organizer */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

html {
    font-size: var(--app-font-size, 1rem);
}

body {
    font-family: var(--app-font);
    background: var(--app-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

@media (max-width: 769px) {
    body {
        padding: 10px;
    }
    .search-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .sidebar h2 {
        text-align: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
}

#root {
    width: 100%;
    height: 100%;
    background: var(--app-bg-root);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Стили для новых компонентов Chaos Organizer */
.app-container {
    display: flex;
    height: 100%;
}

.main-content {
    flex: 1;
    padding: calc(1rem * var(--app-spacing-scale, 1));
    display: flex;
    flex-direction: column;
    background: var(--main-content-bg);
}

.messages-container {
    background: var(--bg-panel);
    border: 1px solid var(--hover-bg);
    border-radius: calc(12px * var(--app-spacing-scale, 1));
    overflow-y: auto;
    flex: 1;
    margin-bottom: calc(0.5rem * var(--app-spacing-scale, 1));
}

.pinned-message {
    background: rgba(128, 128, 128, 0.4);
    border-left: 4px solid var(--warning-color);
    padding: 0.5rem;
    border-radius: 8px;
}

.sticky-message {
  position: sticky;
  width: 100%;
  top: 0;
  color: var(--text-primary);
  z-index: var(--z-sticky);
}

.app-footer {
  padding: 0.25rem 0;
  font-size: 0.75rem;
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
  text-align: center;
  flex-shrink: 0;
}

.app-footer a {
  color: inherit;
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* Основные стили сообщений */
.message {
  padding: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--message-bg);
  transition: background 0.2s;
  position: relative;
  max-width: 80%;
  border-radius: 12px;
}
.message:hover {
  background: var(--message-bg-hover);
}

/* Сообщения пользователя (прижаты к правой стороне) */
.message.user-message {
  align-self: flex-end;
  border-radius: 12px 12px 0 12px;
}
.message.user-message:hover {
  background: var(--message-bg-hover);
}

/* Сообщения других (прижаты к левой стороне) */
.message.other-message {
  align-self: flex-start;
  border-radius: 12px 12px 12px 0;
}
.message.other-message:hover {
  background: var(--message-bg-hover);
}

/* Заголовок сообщения */
.message-header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.message-author {
  font-weight: 600;
  color: var(--text-primary);
}
.message-time {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Тело сообщения */
.message-body {
  color: var(--text-primary);
  line-height: 1.5;
  word-wrap: break-word;
}
.message-text {
  margin-bottom: 0.5rem;
}

/* Превью карты в сообщениях с геолокацией */
.message-map-preview {
  margin-top: 0.75rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-light, rgba(0, 0, 0, 0.1));
  width: 100%;
  background: var(--bg-light, #f3f4f6);
}
.message-map-preview-link {
  display: block;
  line-height: 0;
  width: 100%;
}
.message-map-preview-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  vertical-align: middle;
}
.message-map-preview-caption {
  display: block;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
}

.message-text.truncated {
  max-height: 6em;
  overflow: hidden;
  position: relative;
}
.message-text.truncated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2em;
  background: linear-gradient(to bottom, transparent, var(--message-bg));
}
.message-text.expanded {
  max-height: none;
}

/* Единый стиль кнопок в сообщении: закрепить, избранное, удалить, скачать — цвет акцента */
.message .action-button.pin-btn,
.message .action-button.favorite-btn,
.message .action-button.delete-btn,
.message .attachment-download-btn {
  background: var(--bg-light);
  border: 1px solid var(--primary-color);
  border-radius: 6px;
  color: var(--primary-color);
  transition: all 0.2s;
}
.message .action-button.pin-btn:hover,
.message .action-button.favorite-btn:hover,
.message .action-button.delete-btn:hover,
.message .attachment-download-btn:hover {
  background: var(--primary-color);
  color: var(--text-on-primary);
}

/* Кнопка «Показать полностью» / «Свернуть» — нейтральный стиль */
.message .text-toggle-btn {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-primary);
  transition: all 0.2s;
}
.message .text-toggle-btn:hover {
  background: var(--hover-bg);
  color: var(--primary-color);
}

/* Кнопка «Скачать» во вложениях (карточки изображений, видео, аудио) — цвет акцента */
.message .attachment-card .attachment-download-btn,
.message .attachment-card:has(video) .attachment-download-btn,
.message .attachment-card:has(audio) .attachment-download-btn {
  background: var(--bg-light);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}
.message .attachment-card .attachment-download-btn:hover,
.message .attachment-card:has(video) .attachment-download-btn:hover,
.message .attachment-card:has(audio) .attachment-download-btn:hover {
  background: var(--primary-color);
  color: var(--text-on-primary);
}

/* Кнопка «Показать полностью» / «Свернуть» — одно место под текстом */
.message .text-toggle-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  margin-top: 0.5rem;
  display: inline-block;
  cursor: pointer;
}

/* Действия с сообщением */
.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Кнопка «Скачать всё» — такой же вид, как у кнопки «Скачать» в карточке вложения */
.message .action-button.download-all-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 8.5em;
  padding: 0.625rem;
  background: var(--bg-light);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}
.message .action-button.download-all-btn:hover {
  background: var(--primary-color);
  color: var(--text-on-primary);
}
.message .action-button.download-all-btn:disabled {
  opacity: 0.85;
}

/* Специальные состояния сообщений */
.pinned {
  border-left: 4px solid var(--text-secondary);
  background: var(--hover-bg);
}
.message .action-button .action-icon,
.message .action-button .delete-icon {
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  display: block;
}

.message .action-button.delete-btn,
.message .action-button.download-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.favorited .star .favorite-icon,
.favorite-btn .star .favorite-icon.is-filled {
  opacity: 1;
}
.favorite-btn .star .favorite-icon:not(.is-filled) {
  opacity: 0.45;
}
.star {
  color: var(--border-light);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Стилизация элементов внутри сообщения */
.message code,
.pinned-message .message-pinned code {
  background: var(--bg-light);
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.875em;
}
.message strong,
.pinned-message .message-pinned strong {
  font-weight: 700;
}
.message em,
.pinned-message .message-pinned em {
  font-style: italic;
}
.message del,
.pinned-message .message-pinned del {
  text-decoration: line-through;
}

/* Контейнер сообщений */
.messages-container .list-message {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

/* Адаптивность (сообщение). 769px / 480px соответствуют --breakpoint-tablet / --breakpoint-mobile */
@media (max-width: 769px) {
  .message {
    padding: 0.75rem;
  }
}

@media (max-width: 480px) {
  .message {
    padding: 0.5rem;
  }
  .message-header {
    flex-direction: column;
    gap: 0.25rem;
  }
  .message-actions {
    flex-wrap: wrap;
  }
}

/* Зашифрованное сообщение: заглушка и кнопка расшифровки */
.message-body-encrypted {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.encrypted-placeholder-text {
  margin: 0;
  color: var(--text-secondary, #64748b);
  font-style: italic;
}
.message-body-encrypted .decrypt-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.message-body-encrypted .decrypt-btn .decrypt-btn-icon {
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
}

/* Сетка вложений: одна колонка по умолчанию. minmax(0, 1fr) — чтобы длинные имена файлов обрезались с многоточием */
.attachments-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-light);
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

/* Если карточек больше одной — две колонки */
.attachments-grid:has(.attachment-card:nth-child(2)) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Карточка вложения */
.attachment-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: transform 0.2s, box-shadow 0.2s;
  min-width: 0;
}

.attachment-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.attachment-preview-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-light);
  overflow: hidden;
  min-height: 120px;
  max-height: min(200px, 50cqh);
  aspect-ratio: 1;
}

.attachment-preview {
  max-width: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.attachment-card .file-icon {
  font-size: 2.5rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.attachment-card .file-icon .file-type-icon {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
}

.attachment-info {
  padding: 0.5rem 0.75rem;
  flex-grow: 1;
  min-width: 0;
}

.attachment-filename {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.attachment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.attachment-size,
.attachment-duration,
.attachment-type {
  padding: 0.125rem 0.375rem;
  background: var(--bg-light);
  border-radius: 12px;
  white-space: nowrap;
}

.attachment-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem;
  background: var(--primary-color);
  color: var(--text-on-primary);
  border: none;
  border-radius: 0 0 8px 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
  margin-top: auto;
}

.attachment-download-btn:hover {
  background: var(--primary-hover);
}

.download-icon,
.download-all-icon {
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  flex-shrink: 0;
}

/* ——— Видеоплеер ——— */
.attachment-card:has(video) {
  border: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  background: #0f172a;
}

.attachment-card:has(video):hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.1);
}

.attachment-card:has(video) .attachment-preview-container {
  min-height: 0;
  max-height: 50cqh;
  aspect-ratio: 16 / 9;
  background: #000;
  padding: 0;
}

.attachment-card video.attachment-preview {
  width: 100%;
  max-width: 100%;
  max-height: 50cqh;
  border-radius: 0;
  background: #000;
  aspect-ratio: 16 / 9;
  display: block;
  vertical-align: middle;
  object-fit: contain;
}

.attachment-card:has(video) .attachment-info {
  padding: 0.75rem 1rem;
  background: linear-gradient(to bottom, var(--attachment-video-bar-start) 0%, var(--attachment-video-bar-end) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.attachment-card:has(video) .attachment-filename {
  color: var(--text-on-dark);
  font-size: 0.875rem;
}

.attachment-card:has(video) .attachment-meta {
  color: var(--text-light);
}

.attachment-card:has(video) .attachment-size,
.attachment-card:has(video) .attachment-type {
  background: rgba(255, 255, 255, 0.1);
  color: #d1d5db;
}

.attachment-card:has(video) .attachment-download-btn {
  background: var(--primary-color);
  border-radius: 0 0 12px 12px;
}

.attachment-card:has(video) .attachment-download-btn:hover {
  background: var(--primary-hover);
}

/* ——— Аудиоплеер ——— */
.attachment-card:has(audio) {
  border: none;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--hover-bg) 100%);
}

.attachment-card:has(audio):hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.attachment-card:has(audio) .attachment-preview-container {
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  padding: 1rem 1.25rem;
  background: transparent;
}

.attachment-card audio.attachment-preview {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.attachment-card audio.attachment-preview::-webkit-media-controls-panel {
  background: transparent;
}

.attachment-card:has(audio) .attachment-info {
  padding: 0.625rem 1rem 0.75rem;
}

.attachment-card:has(audio) .attachment-filename {
  font-size: 0.8125rem;
}

.attachment-card:has(audio) .attachment-download-btn {
  border-radius: 0 0 16px 16px;
}

/* Адаптивность (вложения). 769px / 480px соответствуют --breakpoint-tablet / --breakpoint-mobile */
@media (max-width: 769px) {
  .attachments-grid  {
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .attachments-grid:has(.attachment-card:nth-child(2)) {
    gap: 0.5rem;
    padding: 0.5rem;
    grid-template-columns: 1fr;
  }
  .attachment-card audio.attachment-preview {
    min-width: 0;
  }
}

/* Широкие экраны: три колонки */
@media (min-width: 1440px) {
  .attachments-grid:has(.attachment-card:nth-child(2)) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.attachment-encrypted-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 60px;
  color: var(--text-secondary, #64748b);
  font-size: 0.875rem;
}
.attachment-encrypted-placeholder .encrypted-placeholder-icon {
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  flex-shrink: 0;
}

.input-panel {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--hover-bg);
  border-radius: 12px;
  padding: 0.5rem;
  margin-top: auto;
  margin-bottom: 0;
}

.input-panel h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.send-btn-icon {
  display: none;
}
.send-btn-text {
  display: inline;
}

.message-input {
  flex: 1;
  padding: 7px 15px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  resize: none;
  height: 39px;
}

.emoji-picker-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 39px;
  height: 39px;
  padding: 0;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
}
.emoji-picker-btn .emoji-picker-icon .icon-img {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
  position: relative;
  top: 3px;
}
.emoji-picker-btn:hover {
  background: var(--bg-light);
  border-color: var(--primary-color);
}

.emoji-picker-container {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 0.5rem;
  z-index: var(--z-sticky);
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--panel-transition);
}

.emoji-picker-container.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.emoji-picker-container emoji-picker {
  --num-columns: 8;
  --border-radius: 8px;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.file-upload {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 2px dashed var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color 0.2s;
}

.file-upload:hover {
  border-color: var(--primary-color);
}

/* Прогресс загрузки сообщения с файлами */
.upload-progress {
  display: none;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.upload-progress .upload-progress-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.upload-progress .upload-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--hover-bg);
  border-radius: 4px;
  overflow: hidden;
}

.upload-progress .upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary-color);
  border-radius: 4px;
  transition: width 0.15s ease;
}

.upload-progress .upload-progress-percent {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 2.5rem;
  text-align: right;
}

.attachments-preview {
  margin-top: 1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.attachment-item:last-child {
  border-bottom: none;
}

.attachment-name {
  flex: 1;
  margin-left: 0.5rem;
}

.remove-attachment {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem;
  width: 2.25rem;
  height: 2.25rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.remove-attachment:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}
.remove-attachment .remove-icon {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  font-weight: 600;
  padding: 0.5rem;
  background: var(--hover-bg);
  border-radius: 6px;
  margin-bottom: 1rem;
}

.recording-dot {
  width: 10px;
  height: 10px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

.recording-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 2.5em;
}

.audio-recording-stop-btn {
  width: 20px;
  height: 20px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--primary-color);
  border-radius: 6px;
  background: var(--bg-light);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.audio-recording-stop-btn .icon .icon-img {
  width: 12px;
  height: 12px;
  object-fit: contain;
}

.audio-recording-stop-btn:hover {
  background: var(--primary-color);
}
.audio-recording-stop-btn:hover .icon .icon-img {
  filter: brightness(0) invert(1);
}

.audio-recording-stop-btn:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.drag-over {
  border-color: var(--primary-color);
  background: var(--hover-bg);
}

/* Бургер-меню */
.burger-menu {
  position: relative;
  display: inline-block;
}

.burger-button {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 39px;
  height: 39px;
}

.burger-button:hover {
  background: var(--bg-light);
  color: var(--primary-color);
}

.burger-icon {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 1rem;
}

.burger-icon span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: currentColor;
  border-radius: 1px;
}

.burger-dropdown {
  position: absolute;
  bottom: 50px;
  left: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  min-width: 10rem;
  z-index: var(--z-dropdown);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--panel-transition);
}

.burger-dropdown.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.burger-item {
  padding: 0.5rem 0.75rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.burger-item:hover {
  background: var(--bg-light);
  color: var(--primary-color);
}

.burger-item .icon {
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.burger-item .icon .icon-img {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}

.burger-item.encrypt-btn.active {
  background: rgba(0, 123, 255, 0.15);
  color: var(--primary-color, #007bff);
}

/* На экранах шире 481px кнопка эмодзи есть отдельно — в бургер-меню не показываем */
@media (min-width: 482px) {
  .burger-item.emoji-from-burger-btn {
    display: none;
  }
}

/* Палитра команд (автодополнение после @) */
.command-palette {
  display: none;
  margin-top: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: var(--z-dropdown);
  max-height: 280px;
  overflow: hidden;
  transition: var(--panel-transition);
}

.command-palette.visible {
  display: block;
}

.command-palette-list {
  overflow-y: auto;
  max-height: 280px;
  padding: 4px 0;
}

.command-palette-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.15s;
}

.command-palette-item:hover,
.command-palette-item.selected {
  background: var(--bg-light, #f1f5f9);
  color: var(--primary-color, #3b82f6);
}

.command-palette-value {
  font-family: inherit;
  font-weight: 500;
  color: var(--text-primary, #1e293b);
}

.command-palette-item:hover .command-palette-value,
.command-palette-item.selected .command-palette-value {
  color: inherit;
}

.command-palette-desc {
  font-size: 0.75rem;
  color: var(--text-secondary, #64748b);
}

.command-palette-item:hover .command-palette-desc,
.command-palette-item.selected .command-palette-desc {
  color: inherit;
  opacity: 0.9;
}

/* Модальное окно Drag and Drop */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: var(--panel-transition);
}

.drop-overlay.drop-overlay-visible {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.drop-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.drop-overlay-box {
  position: relative;
  z-index: var(--z-base);
  min-width: 320px;
  max-width: 90vw;
  padding: 2rem 2.5rem;
  background: var(--bg-panel);
  border-radius: 16px;
  border: 3px dashed var(--primary-color, #3b82f6);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.drop-overlay-box:hover,
.drop-overlay-box.drag-over-box {
  background: rgba(59, 130, 246, 0.06);
  border-color: var(--primary-color, #2563eb);
}

.drop-overlay-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.drop-overlay-icon .icon-img {
  width: 3rem;
  height: 3rem;
  object-fit: contain;
}

.drop-overlay-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}

.drop-overlay-hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
}

/* Модальное окно записи видео (превью текущей записи) */
.video-recording-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--panel-transition);
}

.video-recording-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.video-recording-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.video-recording-modal-content {
  position: relative;
  z-index: var(--z-base);
  background: var(--bg-panel);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 1.5rem;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.video-recording-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}

.video-recording-modal-preview {
  position: relative;
  width: 100%;
  max-width: 640px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.video-recording-preview {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
}

.video-recording-modal-preview .video-recording-dot {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  width: 12px;
  height: 12px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulse 1s infinite;
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.video-recording-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* Стилистика как у кнопки «Скачать»: светлый фон, акцентная рамка и текст, при hover — заливка */
.video-recording-stop-btn {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-light);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 6px;
  transition: all 0.2s;
}
.video-recording-stop-btn:hover {
  background: var(--primary-color);
  color: var(--text-on-primary);
}
.video-recording-stop-btn .icon .icon-img {
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  position: relative;
  top: 2px;
}
.video-recording-stop-btn:hover .icon .icon-img {
  filter: brightness(0) invert(1);
}

/* Адаптивность: планшет и узкие экраны (769px включительно, --breakpoint-tablet) */
@media (max-width: 769px) {
  .form-row {
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .message-input {
    min-width: 0;
  }
  .message-input::placeholder {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border-radius: 50%;
  }
  .send-btn-text {
    display: none;
  }
  .send-btn-icon {
    display: block;
    width: 0;
    height: 0;
    border-left: 8px solid currentColor;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    margin-left: 2px;
  }
  .burger-dropdown {
    max-width: min(90vw, 20rem);
  }
  .command-palette {
    max-height: min(280px, 50vh);
  }
  .command-palette-list {
    max-height: min(280px, 50vh);
  }
  .drop-overlay-box {
    min-width: 0;
    width: calc(100vw - 2rem);
    padding: 1.5rem;
  }
  .video-recording-modal-content {
    width: 100%;
  }
}

/* Адаптивность: телефоны (--breakpoint-mobile: 480px) — меньше кнопок в ряд */
@media (max-width: 480px) {
  .form-row {
    gap: 0.35rem;
  }
  .emoji-picker-btn {
    display: none;
  }
}

/* Модальное окно напоминания (календарь, время, текст) */
.reminder-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  opacity: 1;
}

.reminder-modal {
  background: var(--bg-panel);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 1.5rem;
  min-width: 320px;
  max-width: 90vw;
}

.reminder-modal-title {
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}

.reminder-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.reminder-modal-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
}

.reminder-modal-label span {
  font-weight: 500;
  color: var(--text-primary, #1e293b);
}

.reminder-modal-date,
.reminder-modal-time,
.reminder-modal-text {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-panel);
}

.reminder-modal-date:focus,
.reminder-modal-time:focus,
.reminder-modal-text:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.reminder-modal-text {
  resize: vertical;
  min-height: 60px;
}

.reminder-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.reminder-modal-btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: var(--bg-light);
  color: var(--text-primary);
  transition: all 0.2s;
}

.reminder-modal-btn:hover {
  background: var(--hover-bg);
  border-color: var(--border-color);
}

.reminder-modal-submit.primary-button {
  background: var(--primary-color);
  color: var(--text-on-primary);
  border-color: var(--primary-color);
}

.reminder-modal-submit.primary-button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.sidebar {
  width: 250px;
  background: var(--bg-light);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  transition: transform var(--panel-duration) var(--panel-ease);
  transform: translateX(-100%);
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  z-index: var(--z-overlay);
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-toggle {
  position: absolute;
  top: 1rem;
  left: 0;
  background: var(--primary-color);
  color: var(--text-on-primary);
  border: none;
  border-radius: 0 8px 8px 0;
  width: 28px;
  height: 48px;
  cursor: pointer;
  z-index: var(--z-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform var(--panel-duration) var(--panel-ease);
}
.sidebar-toggle:hover {
  background: var(--primary-hover);
}
.sidebar-toggle-arrow {
  display: block;
  width: 0;
  height: 0;
  border-left: 8px solid currentColor;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  margin-left: 4px;
  transition: transform var(--panel-duration) var(--panel-ease);
}
#sidebarContainer:has(.sidebar.open) .sidebar-toggle-arrow {
  transform: rotate(180deg);
  margin-left: 0;
  margin-right: 4px;
}

.sidebar h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin-bottom: 0.75rem;
}

.sidebar a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.2s;
  cursor: pointer;
  gap: 0.5rem;
}

.sidebar a:hover,
.sidebar a.active {
  background: var(--hover-bg);
  color: var(--primary-color);
}

.sidebar a .category-label {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sidebar a .category-icon {
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar a .category-count {
  flex-shrink: 0;
  margin-left: auto;
  background: var(--border-light);
  color: var(--text-secondary);
  border-radius: 12px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-link {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.settings-link a.settings-link-btn,
.settings-link .settings-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.settings-link .sidebar-btn-icon {
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  flex-shrink: 0;
}

.export-import {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.export-import button {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.export-import button .sidebar-btn-icon {
  width: 1.1rem;
  height: 1.1rem;
  object-fit: contain;
  flex-shrink: 0;
}

.export-import button:hover {
  background: var(--hover-bg);
  color: var(--primary-color);
}

/* Планшеты и телефоны: контейнер сайдбара не занимает ширину, контент на всю ширину (769 включительно) */
@media (max-width: 769px) {
  #sidebarContainer {
    position: relative;
    flex: 0 0 0;
    min-width: 0;
    overflow: visible;
  }
}

/* 769px и выше — десктоп, сайдбар виден */
@media (min-width: 770px) {
  .sidebar {
    position: relative;
    transform: translateX(0);
    height: 100%;
  }
  .sidebar-toggle {
    display: none;
  }
}
.search-container {
  margin-bottom: 0.5rem;
  position: relative;
}

.search-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  /* padding: 1.5rem; */
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  width: 100%;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 0.875rem 2.25rem 0.875rem 0.875rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 0;
}

.search-clear-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary, #64748b);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}
.search-clear-btn .search-clear-icon {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}
.search-clear-btn:hover {
  background: #e2e8f0;
  color: #334155;
}

.search-input-wrap.has-text .search-clear-btn {
  display: flex;
}

.filter-options {
  display: flex;
  flex-direction: column;
  margin: 0 1rem 0;
  padding-top: 0;
  border-top: 1px solid transparent;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  visibility: hidden;
  transition: opacity var(--panel-duration) var(--panel-ease),
    visibility var(--panel-duration) var(--panel-ease),
    max-height var(--panel-duration) var(--panel-ease),
    padding var(--panel-duration) var(--panel-ease),
    margin var(--panel-duration) var(--panel-ease),
    border-color var(--panel-duration) var(--panel-ease);
}

.filter-options.is-visible {
  max-height: 200px;
  margin: 0 1rem 1rem;
  padding-top: 0.5rem;
  border-top-color: var(--border-light, #e2e8f0);
  opacity: 1;
  visibility: visible;
}

.filter-options-list {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-options-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.search-results {
  margin-top: 1rem;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-light);
}

.result-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

.result-item:hover {
  background: var(--hover-bg);
}

.result-item:last-child {
  border-bottom: none;
}

.result-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.no-results {
  padding: 1rem;
  text-align: center;
  color: var(--text-light);
}

/* Адаптивность: узкие экраны (соответствует --breakpoint-tablet: 769px) */
@media (max-width: 769px) {
  .filter-options-list {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem 1rem;
  }
  .search-results {
    max-height: min(300px, 50vh);
  }
  .search-panel {
    max-width: 100%;
  }
}

/* Адаптивность: узкие экраны (соответствует --breakpoint-tablet: 769px) */
@media (max-width: 426px) {
  .filter-options-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
  }
}
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 350px;
}

.notification {
  background: var(--bg-panel);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: slideIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border-left: 4px solid var(--tg-blue);
}

.notification.success {
  border-left-color: var(--success-color);
}

.notification.warning {
  border-left-color: var(--warning-color);
}

.notification.error {
  border-left-color: var(--error-color);
}

.notification.info {
  border-left-color: var(--info-color);
}

.notification-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
}

.notification-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.notification-message {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.4;
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.notification-close .notification-close-icon {
  width: 1rem;
  height: 1rem;
  object-fit: contain;
}
.notification-close:hover {
  color: var(--text-secondary);
}

.notification.fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

/* Адаптивность: узкие экраны */
@media (max-width: 769px) {
  .notification-container {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: calc(100vw - 2rem);
  }
}
.settings-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.settings-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.settings-modal {
  background: var(--bg-panel, #fff);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.settings-modal-backdrop.is-open .settings-modal {
  transform: scale(1);
}

.settings-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-modal-header h2 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin: 0;
}

.settings-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.25rem;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.settings-modal-close .settings-close-icon {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}
.settings-modal-close:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.settings-modal-body {
  padding: 1.5rem;
}

.settings-group {
  margin-bottom: 1.5rem;
}

.settings-group:last-child {
  margin-bottom: 0;
}

.settings-group-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: block;
}

.settings-bg-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.settings-bg-option {
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-light);
  cursor: pointer;
  font-size: 0.875rem;
  transition: border-color 0.2s, background 0.2s;
}

.settings-bg-option:hover {
  border-color: var(--primary-color);
  background: var(--hover-bg);
}

.settings-bg-option.active {
  border-color: var(--primary-color);
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary-color);
}

.settings-custom-color-wrap {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-custom-color-wrap input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 2px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

.settings-custom-color-wrap input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.settings-custom-color-wrap label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.settings-font-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg-light);
  color: var(--text-primary);
  cursor: pointer;
}

.settings-accent-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.settings-accent-option {
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-light);
  cursor: pointer;
  font-size: 0.875rem;
  transition: border-color 0.2s, background 0.2s;
  border-left: 4px solid var(--accent-preview, var(--primary-color));
}

.settings-accent-option:hover {
  border-color: var(--primary-color);
  background: var(--hover-bg);
}

.settings-accent-option.active {
  border-color: var(--primary-color);
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary-color);
}

.settings-accent-option.settings-accent-custom {
  border-left-color: var(--border-light);
}

.settings-message-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.settings-message-row:last-child {
  margin-bottom: 0;
}

.settings-inline-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  min-width: 6rem;
}

.settings-message-row input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 2px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

.settings-message-row input[type="range"] {
  flex: 1;
  min-width: 100px;
  accent-color: var(--primary-color);
}

.settings-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.settings-modal-footer .primary-button {
  padding: 0.6rem 1.25rem;
}

/* Адаптивность: узкие экраны */
@media (max-width: 769px) {
  .settings-modal {
    max-width: calc(100vw - 2rem);
    margin: auto 1rem;
  }
  .settings-modal-footer {
    flex-wrap: wrap;
  }
}

