.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;  
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    overflow-y: auto;
  }
  
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: auto; /* Это важно для работы клика по оверлею */
}

  .post-details-container {
    max-width: 900px;
    width: 90%;
    background: var(--bg-dark);
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    margin: 5% auto;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}
  
  .close-btn {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 30px;
    color: var(--text-secondary);
    cursor: pointer;
    background: none;
    border: none;
    z-index: 10;
    transition: var(--transition);
  }
  
  .close-btn:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
  }
  
  .post-details-content {
    display: flex;
    flex-direction: column;
    height: 100%;
  }


  /* Добавить в modal.css */
.copy-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 15px;
  width: fit-content;
  top: -45px;
  right: 0;
  margin-bottom: 0;
  margin: 0 auto;
}

.copy-btn:hover {
  background: var(--primary-dark-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.copy-btn:active {
  transform: translateY(0);
}

.copy-icon {
  font-size: 16px;
}

.copy-btn.copied {
  background: #4CAF50;
}

.copy-btn.copied .copy-text {
  content: "Скопировано!";
}

.copy-btn.copied .copy-icon {
  content: "✓";
}

  .image-loading-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
    z-index: 2;
    transition: height 0.1s ease-out;
}
  
.download-btn {
    font-size: 16px;
}


  .post-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
  }
  
  .post-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--border-radius-small);
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
  }
  
  .post-info-wrapper {
    flex: 0 0 350px;
    padding: var(--padding-medium);
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
}

  .post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--padding-medium);
  }
  
  .post-author {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
  }
  
  .author-name {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
  }

  .author-name:hover
  {
    color: var(--gradient);
  }
  
  .post-rating {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
  }
  
  .post-rating[data-rating="safe"] {
    background: rgba(0, 200, 83, 0.2);
    color: #00c853;
  }
  
  .post-rating[data-rating="nsfw"] {
    background: rgba(255, 171, 0, 0.2);
    color: #ffab00;
  }
  
  .post-rating[data-rating="xxx"] {
    background: rgba(213, 0, 0, 0.2);
    color: #d50000;
  }
  
  .post-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: var(--padding-medium);
  }
  
  .post-prompt {
    margin-bottom: var(--padding-medium);
    flex: 1;
  }

  #post-prompt-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Courier New', monospace; /* Моноширинный шрифт для лучшего чтения кода/промптов */
    line-height: 1.6;
    color: var(--text-primary);
}

.post-prompt p {
    background: var(--bg-card);
    padding: var(--padding-small);
    border-radius: var(--border-radius-small);
    line-height: 1.5;
    font-size: 15px;
  }
  
  .post-prompt h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 18px;
  }
  
  .prompt-container {
    background: var(--bg-card);
    padding: var(--padding-small);
    border-radius: var(--border-radius-small);
    line-height: 1.5;
    font-size: 15px;
    max-height: 250px;
    overflow-y: auto;
    word-wrap: break-word;
    border: 1px solid var(--border-color);
    position: relative;
}


.count{
  display: flex;
  align-items: center;
}

.post-details-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2001;
  backdrop-filter: blur(5px);
}

.post-details-loading .loader {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
}

/* Стили для скроллбара */
.prompt-container::-webkit-scrollbar {
    width: 6px;
}

.prompt-container::-webkit-scrollbar-track {
    background: var(--bg-card);
}

.prompt-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.prompt-container:hover {
  box-shadow: 0 0 0 2px var(--primary-color);
}
  
  
  .prompt-container p {
    margin: 0;
    word-break: break-word; /* Переносим длинные слова */
  }
  
  .copy-text {
    color: white;
    font-weight: bold;
    background: var(--primary-color);
    padding: 8px 16px;
    border-radius: 20px;
  }
  
  .prompt-container:hover .copy-overlay {
    opacity: 1;
  }
  
  .post-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding-top: var(--padding-medium);
    margin: 0 auto;
  }
  
  .post-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
  }
  
  .post-action-btn:hover {
    background: var(--bg-card-hover);
  }



/* Стили для кнопок социальных сетей */
.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: var(--padding-medium);
}

.share-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-primary);
  cursor: pointer;
}

.share-button img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.share-button span {
  font-size: 14px;
  margin-top: 5px;
}

/* Стили для поля URL и кнопки копирования */
.share-url-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

#share-url-input {
  flex-grow: 1;
  padding: var(--padding-small);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-small);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
}

#copy-share-url-btn {
  padding: var(--padding-small);
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  transition: var(--transition);
}

#copy-share-url-btn:hover {
  background: var(--primary-dark-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#copy-share-url-btn:active {
  transform: translateY(0);
}

/* Стили для модального окна "Поделиться" */
.share-modal-container {
  width: 800px;
  background: var(--bg-dark);
  border-radius: var(--border-radius);
  overflow: hidden;
  position: relative;
  margin: 10% auto;
  border: 1px solid var(--border-color);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  height: 300px;
  padding: 2%;
}

.close-btn {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  transition: var(--transition);
}

.close-btn:hover {
  color: var(--primary-color);
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
}

.share-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.share-button img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.share-button span {
  font-size: 14px;
  margin-top: 5px;
}

.share-button:hover {
  transform: scale(1.1);
}

.share-url-section {
  margin-top: 20px;
  display: flex;
  align-items: center;
  padding: 16px;
}

.share-url {
  flex-grow: 1;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-small);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
}

.copy-btn {
  padding: 10px 16px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  transition: var(--transition);
}

.copy-btn:hover {
  background: var(--primary-dark-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.copy-btn:active {
  transform: translateY(0);
}


/*комментарии*/

/* Модальное окно комментариев */
.comments-modal {
  display: none;
  position: fixed;
  z-index: 999999;
  right: 0;
  top: 0;
  width: 400px;
  height: 100%;
  background-color: var(--bg-dark);
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
  flex-direction: column;
}

.comments-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--padding-medium);
}

.comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--padding-medium);
}

.comments-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  max-height: 400px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-small);
  padding: var(--padding-medium);
  margin-bottom: var(--padding-medium);
  background: var(--bg-card);
}

.comment-form-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: var(--padding-medium);
}

#comment-input {
  flex: 1;
  padding: var(--padding-small);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-small);
  background: var(--bg-card);
  color: var(--text-primary);
  resize: none;
  min-height: 80px;
}

#send-comment {
  padding: var(--padding-small);
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  transition: var(--transition);
}

#send-comment:hover {
  background: var(--primary-dark-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#send-comment:active {
  transform: translateY(0);
}


/* Стилизация скроллбара */
.comments-list::-webkit-scrollbar {
  width: 8px;
}

.comments-list::-webkit-scrollbar-track {
  background: var(--bg-dark);
  border-radius: 10px;
}

.comments-list::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
  border: 2px solid var(--bg-dark);
}

.comments-list::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark-color);
}

/* Стили для отдельных комментариев */
.comment-item {
  border-bottom: 1px solid var(--border-color);
  padding: var(--padding-small) 0;
  margin-bottom: var(--padding-medium);
  animation: fadeIn 0.3s ease-in-out;
}

.comment-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.comment-author {
  font-weight: bold;
  color: var(--primary-color);
  font-size: 14px;
}

.comment-text {
  word-break: break-word;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.4;
  margin: 5px 0;
}

.comment-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.comment-time {
  font-style: italic;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.comment-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-small);
}

.comment-item .comment-actions {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.comment-item:hover .comment-actions {
  opacity: 1;
}

/* Стили для кнопок действий с комментариями */
.comment-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.comment-actions button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  transition: var(--transition);
}

.comment-actions button:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

/* Стили для формы редактирования */
.comment-edit-form {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.comment-edit-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-small);
  background: var(--bg-card);
  color: var(--text-primary);
  resize: vertical;
}

.comment-edit-form button {
  padding: 6px 12px;
  border: none;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  transition: var(--transition);
}

.comment-edit-form .save-edit-btn {
  background: var(--primary-color);
  color: white;
}

.comment-edit-form .save-edit-btn:hover {
  background: var(--primary-dark-color);
}

.comment-edit-form .cancel-edit-btn {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.comment-edit-form .cancel-edit-btn:hover {
  background: var(--bg-card-hover);
}

/* Стили для формы редактирования комментария */
.comment-edit-form {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-small);
}

.comment-edit-form textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-small);
  background: var(--bg-card);
  color: var(--text-primary);
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
}

.comment-edit-form .save-edit-btn,
.comment-edit-form .cancel-edit-btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
}

.comment-edit-form .save-edit-btn {
  background: var(--primary-color);
  color: white;
}

.comment-edit-form .save-edit-btn:hover {
  background: var(--primary-dark-color);
}

.comment-edit-form .cancel-edit-btn {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.comment-edit-form .cancel-edit-btn:hover {
  background: var(--bg-card-hover);
}

/* Кнопки действий с комментариями */
.comment-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.comment-actions button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 5px;
  transition: var(--transition);
}

.comment-actions button:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

/* Стили для видео в модальном окне */
.post-image-wrapper video {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  background: #000;
  border-radius: var(--border-radius-small);
}


.video-prompt-tooltip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px;
  font-size: 14px;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 10;
  transition: all 0.3s ease;
}

.video-prompt-tooltip:hover {
  white-space: normal;
  overflow: visible;
  max-height: none;
}

.video-duration {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 2;
}

.post-image-wrapper video::-webkit-media-controls-volume-slider,
.post-image-wrapper video::-webkit-media-controls-mute-button {
  display: none !important;
}

.post-image-wrapper video::-webkit-media-controls-current-time-display,
.post-image-wrapper video::-webkit-media-controls-time-remaining-display {
  color: white;
  font-size: 12px;
}



/* Стили для emoji picker */
.emoji-picker {
  position: absolute;
  bottom: 70px;
  right: 20px;
  display: none;
  z-index: 1000;
  width: 350px;
  height: 400px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
}

.emoji-picker.visible {
  display: block;
}

.emoji-picker-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 5px;
  color: var(--text-primary);
  transition: transform 0.2s;
}

.emoji-picker-btn:hover {
  transform: scale(1.1);
}

.comment-input-wrapper {
  position: relative;
}

.comment-input-wrapper textarea {
  padding-right: 40px;
  width: 100%;
  box-sizing: border-box;
  min-height: 80px;
  resize: vertical;
}

/* Стили для кнопок редактирования */
.edit-action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.edit-action-buttons button {
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.save-edit-btn {
  background: #4CAF50;
  color: white;
}

.cancel-edit-btn {
  background: #f44336;
  color: white;
}

.edit-comment-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  min-height: 60px;
}

/* Мобильная адаптация модального окна */
@media (max-width: 768px) {
  .modal {
    backdrop-filter: blur(3px);
  }
  
  .post-details-container {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    border: none;
    max-width: none;
  }
  
  .post-details-content {
    flex-direction: column;
    height: 100%;
    max-height: none;
  }
  
  .post-image-wrapper {
    flex: 0 0 auto;
    max-height: 50vh;
    padding: 10px;
    align-items: flex-start;
  }
  
  .post-image {
    max-height: calc(50vh - 20px);
  }
  
  .post-info-wrapper {
    flex: 1;
    max-height: 50vh;
    overflow-y: auto;
    padding: 15px;
    -webkit-overflow-scrolling: touch;
  }
  
  .close-btn {
    right: 15px;
    top: 15px;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
  
  
  .post-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    padding: 10px;
    justify-content: space-around;
    border-top: 1px solid var(--border-color);
    z-index: 10;
  }
  
      .post-action-btn {
        min-width: 60px;
        gap: 4px;
        font-size: 12px;
    }

    .download-btn{
    font-size: 18px;
  }
  
  .post-action-btn .icon {
    font-size: 18px;
  }
  
  .prompt-container {
    max-height: 150px;
  }
  
  .copy-btn {
    display: none;
  }

  .emoji-picker{
    right: 0;
    top: 20px;
  }
  

  
  /* Для больших мобильных экранов */
  @media (min-width: 500px) and (max-width: 768px) {
    .post-details-container {
      width: 90%;
      height: auto;
      max-height: 90vh;
      margin: 5vh auto;
      border-radius: var(--border-radius);
    }
    
    .post-image-wrapper {
      max-height: 50vh;
    }
    
    .post-info-wrapper {
      max-height: 40vh;
    }
  }
}

/* Адаптация для очень маленьких экранов */
@media (max-width: 480px) {
  .post-image-wrapper {
    max-height: 40vh;
  }
  
  .share-modal-container {
    width: 300px;
  }

  .post-image {
    max-height: calc(40vh - 20px);
  }
  
  .post-info-wrapper {
    max-height: 60vh;
  }
  
  .author-avatar {
    width: 32px;
    height: 32px;
  }
  
  .post-rating {
    font-size: 10px;
    padding: 2px 8px;
  }
  
  .post-meta {
    font-size: 12px;
    margin-bottom: 0;
  }

  .copy-btn {
    display: none;
  }
  
  .comments-modal{
    width: 375px;
  }

  #post-prompt-text {
    font-size: 14px;
  }
  
  .prompt-container {
    font-size: 14px;
    max-height: 250px;
  }
}

/* Портретный режим */
@media (max-width: 768px) and (orientation: portrait) {
  .post-image-wrapper {
    max-height: 40vh;
  }
  
  .post-image {
    max-height: calc(40vh - 20px);
  }
  
  .post-info-wrapper {
    max-height: 60vh;
  }
}

/* Ландшафтный режим */
@media (max-width: 768px) and (orientation: landscape) {
  .post-image-wrapper {
    max-height: 60vh;
  }
  
  .post-image {
    max-height: calc(60vh - 20px);
  }
  
  .post-info-wrapper {
    max-height: 40vh;
  }
}

@media (min-width: 768px) {
  .post-details-content {
    flex-direction: row;
    max-height: 80vh;
  }
  
  .post-image-wrapper {
    flex: 1;
    max-height: 80vh;
  }
  
  .post-info-wrapper {
    flex: 0 0 350px;
    max-height: 80vh;
    overflow-y: auto;
  }
}

@media (orientation: landscape) and (max-width: 900px) {
  /* Принудительно задаем ширину, как на ПК */
  @viewport {
    width: device-width;
    zoom: 1.0;
  }
  
  /* Или просто через meta-тег динамически (через JS) */
  html {
    width: 1440px; /* Фиксированная ширина, как на ПК */
    margin: 0 auto;
    overflow-x: auto;
    transform: none !important;
  }
  body {
    min-width: 1440px; /* Чтобы контент не сжимался */
  }
}