/* ============================================
   Create Post - Extended Styles
   ============================================ */

/* Image Preview */
.image-preview-container {
  margin-top: 12px;
}

.image-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.image-preview-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
}

.image-preview-remove:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* Poll Container */
.poll-container {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.poll-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.poll-option-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.poll-option-field {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
}

.poll-option-field:focus {
  outline: none;
  border-color: var(--primary);
}

.poll-option-remove {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
}

.poll-option-remove:hover {
  background: var(--hover);
  color: #ff4d4f;
}

.add-poll-option {
  padding: 8px 16px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 12px;
}

.add-poll-option:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.poll-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.poll-multiple {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.poll-multiple input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.remove-poll {
  padding: 6px 12px;
  background: transparent;
  color: #ff4d4f;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}

.remove-poll:hover {
  background: #fff1f0;
}

/* Topic Tags */
.topic-tags-container {
  margin-top: 12px;
}

.topic-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #e6f7ff;
  color: #1890ff;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
}

.topic-tag-remove {
  cursor: pointer;
  font-size: 12px;
}

.topic-tag-remove:hover {
  color: #ff4d4f;
}

/* Visibility Menu */
.visibility-menu {
  position: absolute;
  top: 60px;
  left: 60px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 8px;
  z-index: 100;
  min-width: 200px;
}

.visibility-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.visibility-option:hover {
  background: var(--hover);
}

.visibility-option i {
  width: 20px;
  text-align: center;
  color: var(--text-secondary);
}

.visibility-info {
  display: flex;
  flex-direction: column;
}

.visibility-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.visibility-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Emoji Picker */
.emoji-picker {
  position: absolute;
  bottom: 60px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 100;
  width: 300px;
  overflow: hidden;
}

.emoji-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 8px;
  gap: 4px;
}

.emoji-tab {
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
}

.emoji-tab:hover,
.emoji-tab.active {
  background: var(--hover);
}

.emoji-list {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-item {
  padding: 8px;
  text-align: center;
  font-size: 20px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.emoji-item:hover {
  background: var(--hover);
  transform: scale(1.2);
}

/* Mention Dropdown */
.mention-dropdown,
.topic-dropdown {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
  min-width: 200px;
}

.mention-dropdown {
  bottom: 60px;
  left: 20px;
}

.topic-dropdown {
  bottom: 60px;
  left: 100px;
}

.mention-list,
.topic-list {
  padding: 8px;
}

.mention-item,
.topic-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.mention-item:hover,
.topic-item:hover {
  background: var(--hover);
}

.mention-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

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

.topic-item {
  font-size: 14px;
  color: #1890ff;
}

.topic-item::before {
  content: '#';
  color: var(--text-muted);
}

/* Mention Search Results - Horizontal Display */
.mention-search-results {
  display: flex;
  flex-direction: row;
  gap: 12px;
  overflow-x: auto;
  max-width: 100%;
}

.mention-search-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  min-width: 140px;
}

.mention-search-item:hover {
  border-color: var(--primary);
  background: var(--hover);
}

.mention-search-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.mention-search-info {
  display: flex;
  flex-direction: column;
}

.mention-search-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

.mention-search-username {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

/* Create Post Box Position */
#create-post-box {
  position: relative;
}

/* Post Images Grid */
.post-images-grid {
  display: grid;
  gap: 4px;
  margin: 12px 0 0 0;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.post-images-grid.single-image {
  grid-template-columns: 1fr;
  max-height: 400px;
  max-width: 500px;
}

.post-images-grid.two-images {
  grid-template-columns: repeat(2, 1fr);
  max-height: 300px;
  max-width: 100%;
}

.post-images-grid.multi-images {
  grid-template-columns: repeat(3, 1fr);
  max-height: 300px;
  max-width: 100%;
}

.post-image-wrapper {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
}

.post-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.post-image-wrapper:hover img {
  transform: scale(1.05);
}

.post-images-grid .image-action-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  z-index: 10;
}

.post-images-grid .image-action-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.post-images-grid .image-action-btn svg {
  width: 16px;
  height: 16px;
}

/* Image Viewer */
.image-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-viewer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
}

.image-viewer-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  z-index: 1001;
}

.image-viewer-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

.image-viewer-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-viewer-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.image-viewer-prev,
.image-viewer-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
}

.image-viewer-prev:hover,
.image-viewer-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

.image-viewer-prev {
  left: -60px;
}

.image-viewer-next {
  right: -60px;
}

.image-viewer-counter {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 16px;
  border-radius: 16px;
}

/* Mention Link in Post Content */
.mention-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary) !important;
    text-decoration: none;
    font-weight: 500;
    padding: 5px 8px;
    background: rgba(139, 195, 74, 0.1);
    border-radius: 20px;
    transition: all 0.2s;
    vertical-align: middle;
}

.mention-link:hover {
  background: rgba(139, 195, 74, 0.2);
  transform: translateY(-1px);
}

.mention-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(139, 195, 74, 0.3);
}
