/* Стили для отложенных постов */
.dropdown-menu {
  position: absolute;
  top: calc(var(--header-height) - 8px);
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 220px;
  z-index: 1001;
  padding: 8px 0;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: background 0.2s ease;
}

.dropdown-item:hover {
  background: #f5f8fa;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-md);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #f5f5f5;
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 125, 246, 0.1);
}

.checkbox-group {
  margin-bottom: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checkbox-label span {
  font-size: 14px;
  color: var(--text);
}

.schedule-info {
  padding: 12px;
  background: #f0f7ff;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #1a5490;
}

.schedule-info:empty {
  display: none;
}

/* Страница отложенных постов */
.page-header {
  padding: 24px 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.page-header h1 {
  margin: 0 0 16px 0;
  font-size: 28px;
  font-weight: 600;
}

.filters-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.pagination-bar {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.pagination-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.pagination-info {
  font-size: 13px;
  color: rgba(15, 23, 42, 0.65);
  white-space: nowrap;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.post-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.post-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.post-card-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 15px;
}

.channel-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.post-card-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}

.post-card-time-text {
  min-width: 0;
}

.post-card-text {
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.3;
  display: flex;
  justify-content: center;
}

/* Для опросов сохраняем центрирование как у остальных */
.post-card-text:has(.poll-preview-card),
.post-card-text:has(.poll-wrapper) {
  display: flex !important;
  justify-content: center;
}

/* Эти стили больше не нужны - всё форматирование идёт через .post-text-content */

.post-text-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  max-width: 360px;
}

.post-text-wrapper.poll-wrapper {
  align-items: stretch;
  width: 100%;
  max-width: 360px;
}

.post-text-wrapper.poll-wrapper .post-text-short,
.post-text-wrapper.poll-wrapper .post-text-full {
  width: 100%;
}

.post-text-wrapper.is-expanded {
  width: 100%;
  max-width: 360px;
  align-items: stretch;
}

.post-text-wrapper.is-expanded .post-text-content {
  background: transparent;
  box-shadow: none;
  padding: 0;
  max-width: 100%;
}

.post-text-wrapper.is-expanded .post-text-content:hover {
  box-shadow: none;
}

.post-text-wrapper.is-expanded .tg-message {
  width: 100%;
  max-width: none;
  margin: 0;
}

.post-text-wrapper.is-expanded .tg-images.tg-album-abs {
  width: 100%;
}

.post-text-content {
  background: #ffffff;
  color: #000000;
  padding: 12px 14px;
  border-radius: 18px 18px 18px 0;
  width: 100%;
  max-width: 360px;
  line-height: 1.3;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
}

/* Для видео кружочков специальная обертка без .post-text-content */
.video-note-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.video-note-wrapper .post-text-short,
.video-note-wrapper .post-text-full {
  background: transparent;
  padding: 0;
  margin: 0;
}

.video-note-wrapper .post-text-toggle {
  margin-top: 8px;
}

.post-text-content:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.post-text-short, .post-text-full {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #000000;
}

/* Переопределяем стили для содержимого внутри preview */
.post-text-content p {
  margin: 0;
  line-height: 1.3;
  color: #000000;
}

.post-text-content p:not(:last-child) {
  margin-bottom: 0.3em;
}

.post-text-content a {
  color: #2f7df6;
  text-decoration: none;
}

.post-text-content b, .post-text-content strong {
  font-weight: 600;
}

.post-text-content i, .post-text-content em {
  font-style: italic;
}

.post-text-content u {
  text-decoration: underline;
}

.post-text-content code {
  background: #f4f4f4;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 13px;
  font-family: monospace;
}

.post-text-content pre {
  position: relative;
  background: #e9eef5;
  border-radius: 12px 12px 12px 0;
  padding: 38px 12px 10px 14px;
  box-shadow: inset 4px 0 0 rgba(17, 24, 39, 0.18);
  overflow: hidden;
  font-size: 13px;
  margin: 8px 0;
}

.post-text-content pre::before {
  content: 'копировать';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 28px;
  display: flex;
  align-items: center;
  padding: 0 36px 0 12px;
  font-size: 12px;
  color: rgba(17, 24, 39, 0.55);
  background: #dfe6ef;
  border-radius: 12px 12px 0 0;
  pointer-events: none;
}

.post-text-content pre::after {
  content: '⧉';
  position: absolute;
  top: 0;
  right: 10px;
  height: 28px;
  display: flex;
  align-items: center;
  color: rgba(17, 24, 39, 0.55);
  font-size: 13px;
  pointer-events: none;
}

.post-text-content pre code {
  background: none;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.post-text-content blockquote {
  background: linear-gradient(135deg, rgba(47,125,246,0.10) 0%, rgba(79,195,220,0.08) 100%);
  border-left: 3px solid rgba(47,125,246,0.65);
  margin: 8px 0;
  padding: 12px 14px;
  border-radius: 6px 12px 12px 6px;
}

.post-text-content ul, .post-text-content ol {
  margin: 8px 0;
  padding-left: 24px;
}

.post-text-content li {
  margin: 4px 0;
  line-height: 1.4;
}

.post-text-toggle {
  background: transparent;
  border: none;
  color: #60a5fa;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 0;
  text-align: left;
  transition: color 0.2s;
  display: inline-block;
  margin-top: 8px;
}

.post-text-toggle:hover {
  color: #93c5fd;
  text-decoration: underline;
}

.post-card-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #666;
}

.post-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.post-card-actions .btn {
  font-size: 13px;
  padding: 0 12px;
  height: 32px;
}

/* Poll preview in scheduled posts list */
.poll-preview-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.poll-question-preview {
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

.poll-option-preview {
  padding: 10px 12px;
  margin: 8px 0;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.3;
}

.poll-more-options {
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

.poll-meta-preview {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status-pending {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-sent {
  background: #e3f2fd;
  color: #1976d2;
}

.status-awaiting {
  background: #fff8e1;
  color: #8d6e63;
}

.status-published {
  background: #e3f2fd;
  color: #1976d2;
}

.status-deleted {
  background: #ffebee;
  color: #c62828;
}

.status-failed {
  background: #ffebee;
  color: #c62828;
}

.status-cancelled {
  background: #f5f5f5;
  color: #616161;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.empty-state-text {
  font-size: 18px;
  margin-bottom: 8px;
}

.empty-state-subtext {
  font-size: 14px;
  color: #bbb;
}

#posts-container.view-calendar .calendar-view {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

#posts-container.view-calendar .calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

#posts-container.view-calendar .calendar-title {
  font-size: 16px;
  font-weight: 600;
}

#posts-container.view-calendar .calendar-nav {
  display: inline-flex;
  gap: 8px;
}

#posts-container.view-calendar .calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#posts-container.view-calendar .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

#posts-container.view-calendar .calendar-day {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.02);
  overflow: visible;
}

#posts-container.view-calendar .calendar-day.is-other {
  opacity: 0.45;
  background: transparent;
}

#posts-container.view-calendar .calendar-day.is-today {
  border-color: rgba(47, 125, 246, 0.45);
  background: rgba(47, 125, 246, 0.08);
}

#posts-container.view-calendar .calendar-day-number {
  font-size: 13px;
  font-weight: 600;
}

#posts-container.view-calendar .calendar-posts {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

#posts-container.view-calendar .calendar-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  line-height: 0;
  cursor: default;
}

#posts-container.view-calendar .calendar-item:focus-visible {
  outline: 2px solid rgba(47, 125, 246, 0.35);
  outline-offset: 2px;
  border-radius: 999px;
}

#posts-container.view-calendar .calendar-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

#posts-container.view-calendar .calendar-dot.is-pending {
  background: #60a5fa;
}

#posts-container.view-calendar .calendar-dot.is-sent {
  background: #34d399;
}

#posts-container.view-calendar .calendar-dot.is-failed {
  background: #f87171;
}

#posts-container.view-calendar .calendar-dot.is-cancelled {
  background: #94a3b8;
}

#posts-container.view-calendar .calendar-tooltip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  transform: translateX(-6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 240px;
  max-width: 340px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 50;
}

#posts-container.view-calendar .calendar-tooltip::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 100%;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

#posts-container.view-calendar .calendar-item:hover .calendar-tooltip,
#posts-container.view-calendar .calendar-item:focus-within .calendar-tooltip {
  opacity: 1;
  visibility: visible;
}

#posts-container.view-calendar .calendar-tooltip-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 6px;
}

#posts-container.view-calendar .calendar-tooltip-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.2;
}

#posts-container.view-calendar .calendar-tooltip-media {
  display: block;
  margin-bottom: 10px;
}

#posts-container.view-calendar .calendar-tooltip-media .tg-images {
  margin-bottom: 0;
}

#posts-container.view-calendar .calendar-tooltip-media .tg-images .calendar-thumb.is-file {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.06);
  display: grid;
  place-items: center;
}

#posts-container.view-calendar .calendar-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.02);
  object-fit: contain;
  object-position: center;
  display: block;
}

#posts-container.view-calendar .calendar-thumb.is-file {
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

#posts-container.view-calendar .calendar-tooltip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

#posts-container.view-calendar .calendar-tooltip-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.02);
  font-size: 11px;
  color: var(--text);
  line-height: 20px;
  white-space: nowrap;
}

#posts-container.view-calendar .calendar-tooltip-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.35;
  max-height: 82px;
  overflow: hidden;
}

#posts-container.view-calendar .calendar-tooltip-poll {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

#posts-container.view-calendar .calendar-tooltip-poll-question {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 8px;
}

#posts-container.view-calendar .calendar-tooltip-poll-option {
  font-size: 11px;
  color: var(--text);
  line-height: 1.25;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.02);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

#posts-container.view-calendar .calendar-tooltip-poll-option + .calendar-tooltip-poll-option {
  margin-top: 6px;
}

#posts-container.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
}

@media (max-width: 420px) {
  #posts-container.view-grid {
    grid-template-columns: 1fr;
  }
}

#posts-container.view-grid .post-card {
  margin-bottom: 0;
  height: 100%;
}

#posts-container.view-table {
  display: block;
  width: 100%;
}

#posts-container.view-table .posts-table-wrap {
  width: 100%;
  overflow-x: auto;
}

#posts-container.view-table .posts-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

#posts-container.view-table .posts-table th,
#posts-container.view-table .posts-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: top;
}

#posts-container.view-table .posts-table tr.data-row td,
#posts-container.view-table .posts-table tr.expand-row td {
  border-bottom: none;
}

#posts-container.view-table .posts-table tr.meta-row td {
  border-bottom: none;
}

#posts-container.view-table .posts-table th {
  background: rgba(15, 23, 42, 0.02);
  color: var(--text-secondary);
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
}

#posts-container.view-table .posts-table tr:last-child td {
  border-bottom: none;
}

#posts-container.view-table .td-time {
  white-space: nowrap;
}

#posts-container.view-table .table-channel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#posts-container.view-table .table-channel-badge {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 auto;
}

#posts-container.view-table .table-channel-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

#posts-container.view-table .table-status {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.02);
  font-size: 12px;
  white-space: nowrap;
}

#posts-container.view-table .table-status.is-pending {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(96, 165, 250, 0.10);
}

#posts-container.view-table .table-status.is-sent {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.10);
}

#posts-container.view-table .table-status.is-failed {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.10);
}

#posts-container.view-table .table-status.is-cancelled {
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.10);
}

#posts-container.view-table .table-text {
  line-height: 1.3;
}

#posts-container.view-table .table-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

#posts-container.view-table .posts-table .cell-title {
  font-weight: 650;
  color: var(--text);
}

#posts-container.view-table .posts-table .cell-sub {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.25;
}

#posts-container.view-table .posts-table .expand-row {
  display: none;
}

#posts-container.view-table .posts-table tr.data-row.is-expanded + tr.expand-row {
  display: table-row;
}

#posts-container.view-table .posts-table .expand-row td {
  padding: 12px 12px 14px;
  background: rgba(15, 23, 42, 0.02);
}

#posts-container.view-table .posts-table .table-expand-body {
  width: 100%;
  max-width: 375px;
  margin: 0 auto;
}

#posts-container.view-table .posts-table .meta-row .table-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 2px;
}

#posts-container.view-table .posts-table .menu-pop {
  display: none;
}

#posts-container.view-table .posts-table .menu-pop[data-open="true"] {
  display: block;
}

#posts-container.view-table .cell-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

#posts-container.view-table .cell-actions .btn {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

#posts-container.view-table .cell-actions .btn.btn-icon {
  width: 28px;
  padding: 0;
  justify-content: center;
}
