/* Modal wrapper */
.comment-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(30px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  animation-fill-mode: forwards;
}

.comment-modal.is-visible {
  visibility: visible;
  animation: fadeInUp 0.3s ease forwards;
}

.comment-modal.is-closing {
  animation: fadeOutDown 0.3s ease forwards;
  animation-fill-mode: forwards;
  /* Ensures it stays faded out after animation */
}

/* After fade-out, hide completely */
.comment-modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* REMOVE display: none; */
}

/* Backdrop */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
}

/* Modal content box */
.modal-box {
  position: relative;
  background: var(--bg-button-login-color);
  max-width: 600px;
  border-radius: 24px;
  padding: 32px;
  z-index: 300;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

/* Header */
.modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.modal-close-container {
  display: flex;
  justify-content: end;
  width: 100%;
}

.modal-close-icon {
  width: 14px;
  height: 14px;
  color: var(--post-card-date);
  background-color: transparent;
  border: none;
  cursor: pointer;
}

.modal-title {
  font-size: 24px;
  font-weight: 500;
  color: var(--post-card-title);
}

.modal-desc {
  font-size: 18px;
  font-weight: 400;
  color: var(--post-card-title);
  text-align: center;
}

.comment-form-form {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.form-group1 {
  display: flex;
  align-items: center;
  gap: 16px;
}

.special-input {
  position: relative;
}

.styled-input {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--comment-input-border);
  border-radius: 8px;
  outline: none;
  background-color: transparent;
  color: var(--text-color);
}

.input-label {
  position: absolute;
  background-color: var(--bg-button-login-color);
  top: -16px;
  right: 1rem;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 400;
  color: var(--post-card-title);
}

.half-width-input {
  width: 50%;
}

.form-group2 {
  display: flex;
  flex-direction: column;
  /* gap: 8px; */
}

#comment_content {
  max-width: 100%;
  min-width: 100%;
}

.submit-comment-btn {
  background-color: #613CC3;
  border-radius: 8px;
  font-family: inherit;
  border: none;
  color: #ffffff;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms;
}

.save-information {
  display: flex;
  align-items: center;
  gap: 4px;
}

.save-info-label {
  color: var(--checkbox-label);
  font-size: 14px;
  font-weight: 400;
}

.submit-comment-btn:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

.comment-reply-btn {
  display: flex;
  align-items: center;
  gap: 2px;
  background-color: transparent;
  font-family: inherit;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 8px;
  width: max-content;
}

.comment-reply-btn:hover {
  background-color: #8051FF33;
}

.comment-reply-icon {
  width: 18px;
  height: 18px;
  color: #8051FE;
}

.comment-reply-txt {
  color: #8051FE;
  font-size: 12px;
  font-weight: 500;
}

/* Fade animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(30px);
  }
}

@media screen and (max-width: 1024px) {
  .modal-box {
    max-width: 343px;
    border-radius: 16px;
    padding: 20px;
    gap: 20px;
  }

  .modal-title {
    font-size: 18px;
  }

  .modal-desc {
    font-size: 14px;
  }

  .input-label {
    font-size: 12px;
  }

  .save-info-label {
    font-size: 12px;
  }

  .save-information {
    align-items: first baseline;
  }

  .modal-content {
    gap: 24px;
  }

  .form-group1 {
    flex-direction: column;
    gap: 20px;
  }

  .half-width-input {
    width: 100%;
  }

  .comment-form-form {
    gap: 20px;
  }
}