.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

#comment-modal .close-btn {
  position: fixed;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: var(--base-color);
  font-size: 24px;
  cursor: pointer;
  z-index: 1001;
  padding: 4px 8px;
  line-height: 1;
}

#comment-modal .close-btn:hover {
  opacity: 0.7;
}

.comment-modal-content {
  display: flex;
  width: 90vw;
  max-width: 1000px;
  height: 85vh;
  background: var(--base-color);
  border-radius: 0px 8px 8px 0px;
  overflow: hidden;
  position: relative;
}

.comment-image-area {
  flex: 1;
  background: var(--base-color);  
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.comment-image {
  width: 100%;
  height: 100%;
  object-fit: cover;               
}

.comment-content-area {
  width: 400px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line-color);
  flex-shrink: 0;
}

.comment-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-color);
}

.comment-modal-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-modal-username {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-color);
}

.comment-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.comment-card,
.comment-modal-caption {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  text-align: left;
}

.comment-modal-caption {
  margin-bottom: 8px;
  padding-bottom: 16px;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-content {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.comment-header {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-color);
  word-wrap: break-word;
}

.comment-username {
  font-weight: 600;
  margin-right: 6px;
}

.comment-text {
  font-weight: 400;
  white-space: pre-wrap;
}

.comment-timestamp {
  display: block;
  font-size: 12px;
  color: var(--secondary-text-color);
  margin-top: 4px;
}

.modal-post-footer {
  border-top: 1px solid var(--line-color);
}

.modal-post-actions {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  padding: 4px 8px;
}

.modal-post-actions svg {
  width: 24px;
  height: 24px;
  padding: 8px;
  box-sizing: content-box;
  cursor: pointer;
  color: var(--text-color);
  stroke-width: 2px;
  transition: transform 0.1s ease;
}

.modal-post-actions svg:hover {
  transform: scale(1.1);
}

.modal-post-like.liked svg {
  fill: #ed4956;
  stroke: #ed4956;
  animation: pop 0.3s ease;
}

.modal-post-likes-count {
  display: flex;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 4px;
  padding: 0 16px;
  margin-bottom: 2px;
}

.modal-post-time {
  display: flex;
  font-size: 12px;
  color: var(--secondary-text-color);
  text-transform: uppercase;
  padding: 0 16px;
  letter-spacing: 0.2px;
}

.comment-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line-color);
  padding: 4px 16px 4px 0px;
}

.comment-input-area textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-color);
  outline: none;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 40px;
  line-height: 1.4;
  max-height: 80px;
  overflow-y: auto;
  box-sizing: border-box;
  margin: 8px;
}

.comment-input-area textarea::placeholder {
  color: var(--secondary-text-color);
}

.comment-input-area:focus-within {
  border-top-color: var(--text-color);
}

.comment-input-area button {
  background: none;
  border: none;
  color: #0095f6;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  flex-shrink: 0;
}

.comment-input-area button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.comment-modal-avatar,
.comment-modal-username,
.comment-avatar,
.comment-username {
  cursor: pointer;
}

.comment-username:hover,
.comment-modal-username:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .comment-modal-content {
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 100%;
    border-radius: 0;
  }

  .top-bar {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-color);
    position: relative;
    background: var(--base-color);
  }

  .top-back {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
  }

  .top-back svg {
    width: 24px;
    height: 24px;
    fill: var(--text-color);
  }

  .top-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
  }

  .comment-image-area {
    flex: none;
    height: 40vh;
    position: relative;
  }

  .comment-content-area {
    width: 100%;
    flex: 1;
    border-left: none;
    border-top: 1px solid var(--line-color);
  }

  .comment-content-area {
    width: 100%;
    flex: 1;
    border-left: none;
    border-top: none;
    border-radius: 20px 20px 0 0;
    background: var(--base-color);
    margin-top: -16px;
    position: relative;
    z-index: 1;
  }

  .comment-modal-body {
    flex: 1;
    padding-bottom: 60px;
  }

  .comment-input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--base-color);
    border-top: 1px solid var(--line-color);
    padding: 4px 16px 4px 0;
    z-index: 1001;
  }

  #close-comment-modal {
    display: none;
  }
}


.post-options-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  padding: 4px 8px;
  margin-left: auto;       
  color: var(--text-color);
}

.post-options-btn:hover {
  opacity: 0.6;
}

.post-options-popover {
  position: fixed;         
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--base-color);
  border-radius: 12px;
  min-width: 260px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;           
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.post-options-popover button {
  background: transparent;
  border: none;
  padding: 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line-color);
  width: 100%;
}

.post-options-popover button:last-child {
  border-bottom: none;
}

.post-options-popover button:hover {
  background: var(--hover-bg-color);
}

.post-delete-btn {
  color: #ed4956;           
  font-weight: 700;
}

.post-options-cancel {
  color: var(--text-color);
}