button#favorite-btn {
  min-width: 4rem;
  height: 3rem;
  font-size: 1rem;
  margin-left: 19.5rem;
  background: rgb(228, 92, 82);
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
#favorite-btn.favorited {
  background: rgb(194, 77, 41);
}
.post-icon .post-icon-left p {
  margin-left: 0.2rem;
}
#toggleSidebar {
  display: none;
}

.post {
  position: relative;
  max-width: 1200px;
  width: 100%;
  margin: 1.25rem auto;
  /* background: var(--secondary-bgc); */
  color: var(--primary-txt);
  transition: 300ms;
  box-shadow: 0 4px 4px var(--border-clr);
  border-radius: 8px;
}

.post-user {
  position: sticky;
  top: 92px;
  width: 100%; /* 似乎是因為外層的 border 影響寬度計算，導致不管怎麼設定 100%，都只是 1198px */
  display: grid;
  justify-content: stretch;
  align-items: stretch;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 8px;
  background: var(--secondary-bgc);
  border: 1px solid var(--border-clr);
  z-index: 99;
  transform: translateX(1px);
}

.back-btn {
  width: 50px;
  height: 100%;
  padding-block: 0.75rem;
  background: var(--secondary-bgc);
  color: var(--primary-txt);
  border: none;
  border-radius: 1rem;
  font-size: 1rem;
  cursor: pointer;
}

.back-btn:hover {
  background: var(--primary-bgc);
}

.user-avatar-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: var(--secondary-bgc);
}

.user-avatar {
  display: inline-block;
  vertical-align: middle;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-bgc);
  background-position: center center;
  background-size: cover;
  object-fit: cover;
  overflow: hidden;
}

.user-name {
  text-decoration: none;
  font-size: 1.125rem;
  color: var(--primary-txt);
}

.post-heading-section {
  justify-content: center;
}

.post-wrap {
  padding-inline: 1.75rem;
  padding-bottom: 1rem;
  background: var(--secondary-bgc);
  border: 1px solid var(--border-clr);
}

.post-wrap.comment {
  border-radius: 0 0 8px 8px;
}

.post-heading {
  display: flex;
  align-items: center;
  width: 100%;
  font-size: 18px;
  font-weight: 700;
}

.post-content {
  max-width: 80%;
  width: 100%;
  margin-inline: auto;
  padding: 1rem 0;
  letter-spacing: 1px;
  line-height: 1.8;
}

.post-content img {
  max-width: 100%;
  height: 100%;
}

.post-date {
  max-width: 80%;
  width: 100%;
  margin-inline: auto;
  padding-block: 1rem;
  display: flex;
  justify-content: start;
  align-items: center;
  gap: 1.25rem;
  text-align: left;

  font-size: 0.75rem;
  color: #aaa;
}

.post-icon {
  max-width: 80%;
  width: 100%;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  margin-inline: auto;
  margin-bottom: 1rem;
  /* padding: 1rem 2rem; */
}

.post-icon-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 50%;
}

.post-icon-right {
  display: flex;
  justify-content: end;
  align-items: center;
  gap: 1rem;
  width: 50%;
}

.post-icon-right div {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.post-icon button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: var(--secondary-bgc);
  color: var(--primary-txt);
  border: 1px solid transparent;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  /* transition: 300ms; */
}

.post-icon button:hover {
  border-color: var(--border-clr);
  box-shadow: 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  transition: 300ms;
}

.post-icon button i {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.125rem;
}

.comments-count {
  padding-block: 1.25rem;
  font-size: 0.875rem;
  color: #aaa;
}

.post-comment {
  position: relative;
  width: 100%;
  padding: 0 2.5rem;
  /* counter-reset: num; */
  border-left: 1px solid var(--border-clr);
  z-index: 1;
}

.post-comment::before,
.post-comment::after {
  content: "";
  position: absolute;
  width: 0.625rem;
  height: 0.625rem;
  background: #ddd;
  border: 1px solid #ddd;
  border-radius: 50%;
  z-index: 2;
}

.post-comment:hover::before,
.post-comment:hover::after {
  background: #bbb;
  border-color: #bbb;
}

.post-comment::before {
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
}

.post-comment::after {
  left: 0;
  bottom: 0;
  transform: translate(-50%, 50%);
}

.post-comment-section {
  position: relative;
  display: flex;
  width: 100%;
  padding-block: 0.75rem;
  padding-left: 1rem;
  /* counter-increment: num; */
  border-bottom: 1px solid var(--border-clr);
}

.post-comment-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: -2.5rem;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--secondary-bgc);
  border: 1px solid #ccc;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.post-comment-section::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3.5rem;
  height: 2.25rem;
  border-left: 1px solid transparent;
  border-bottom: 1px solid transparent;
  border-bottom-left-radius: 1rem;
  transform: translate(calc(-2.5rem - 1px), 0);
  z-index: -1;
}

.post-comment-section:first-child::before {
  background: transparent;
  border: none;
}

.post-comment-section:hover::before {
  background: #bbb;
  border-color: #bbb;
}

.post-comment-left {
  flex-shrink: 0;
  width: 60px;
  display: inline-block;
  vertical-align: top;
  text-align: center;
}

.post-comment-avatar {
  display: inline-block;
  vertical-align: top;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-bgc);
  background-position: center center;
  background-size: cover;
  object-fit: cover;
  overflow: hidden;
  z-index: 2;
}

.post-reply {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  padding-right: 0;
  border-right: none;
}

.post-comment-reply {
  display: flex;
  gap: 0.25rem;
  width: 100%;
  padding-block: 1rem;
  border-radius: 6px;
  transition: 300ms;
}

.post-comment-reply:hover {
  background: var(--primary-bgc);
}

.post-comment-reply::before {
  content: "";
  position: absolute;
  left: 0;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--secondary-bgc);
  border: 1px solid #ddd;
  border-radius: 50%;
  transform: translate(-50%, calc(-50% + -1rem));
}

.post-comment-reply:hover::before {
  background: #bbb;
  border-color: #bbb;
}

.post-comment-reply:first-child::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2.25rem;
  height: 4.25rem;
  border-left: 1px solid transparent;
  border-bottom: 1px solid transparent;
  border-bottom-left-radius: 1rem;
  transform: translate(calc(-2.875rem - 1px), -4.25rem);
  z-index: -1;
}

.post-comment-right {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding-left: 1rem;
}

.post-comment-reply .post-comment-right::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transform: translate(-2.125rem, -1rem);
  border-top: 1px solid var(--border-clr);
}

.post-comment-reply .post-comment-right::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transform: translate(-2.125rem, -1rem);
  border-top: 1px solid var(--border-clr);
}

.post-comment-reply:first-child .post-comment-right::after {
  border-top: none;
}

.post-comment:hover,
.post-reply:hover,
.post-reply:hover .post-comment-reply::after,
/* .post-comment-section:hover::after, */
.post-comment-reply:hover::before {
  border-color: #bbb;
}

.post-comment-right-top,
.post-comment-reply-right-top {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.post-comment-right-top::after {
  content: attr(data-floor); /* 讀取 data-floor 屬性 */
  /* counter 計數器，自動計算樓層 */
  /* content: "#" counter(num);*/
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 24px;
  padding: 0.25rem;
  border-radius: 2px;
  background: linear-gradient(
    325deg,
    rgba(20, 20, 20, 0.7) 0%,
    rgba(71, 71, 71, 0.7) 100%
  );
  color: #eee;
  transform: translateY(-0.75rem);
  letter-spacing: 2px;
}

.post-comment-id {
  font-size: 0.875rem;
  font-weight: 600;
}

.post-comment-date {
  font-size: 0.75rem;
  font-weight: 400;
  color: #aaa;
}

.post-comment-right-bottom {
  padding-top: 0.25rem;
}

.post-comment-content {
  font-size: 0.875rem;
  line-height: 1.5;
}

.post-comment-icon {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.post-comment-icon div {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.post-comment-icon button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.3rem;
  background: transparent;
  color: var(--primary-txt);
  border: none;
  border-radius: 0.525rem;
  font-size: 0.75rem;
  cursor: pointer;
  line-height: 1;
  transition: background-color 0.2s ease;
}

.post-comment-icon button:hover {
  background: hsla(180, 100%, 27%, 0.1);
  color: darkcyan;
}

.post-comment-icon button i {
  font-size: 1rem;
  cursor: pointer;
}

.post-comment-icon small {
  margin-right: 0.25rem;
  font-size: 0.75rem;
}

/* 文章留言 */
.form-comment-section {
  display: grid;
  grid-template-rows: 0;
  width: 100%;
  padding: 0 2.5rem;
  transform: scaleX(0);
  transition: transform 400ms ease, padding 500ms ease;
  overflow: hidden;
}

.form-comment-section.active {
  transform: scaleX(1);
  grid-template-rows: 1fr;
  padding: 1.5rem 2.5rem;
}

/* 回覆留言 */
.form-comment-reply-section {
  display: grid;
  grid-template-rows: 0;
  width: 100%;
  padding: 0 2.5rem;
  transform: scaleX(0);
  transition: transform 400ms ease, padding 500ms ease;
  overflow: hidden;
}

.form-comment-reply-section.active {
  transform: scaleX(1);
  grid-template-rows: 1fr;
  padding: 1.5rem 2.5rem;
}
#form {
  display: flex;
  width: 100%;
  background: var(--secondary-bgc);
  border: 1px solid var(--border-clr);
  border-radius: 0.5rem;
  overflow: hidden;
}

#form input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 1rem;
  padding: 0.75rem 0.75rem;
  background: var(--secondary-bgc);
  color: var(--primary-txt);
  /* box-shadow: 0 0 0px 1000px var(--secondary-bgc) inset !important; /* 解決自動填入表單的預設背景（方法一） */
}

/* 解決自動填入表單的預設文字 */
#form input::first-line {
  color: var(--primary-txt);
}

/* 解決自動填入表單的預設背景（方法二） */
#form input:-internal-autofill-previewed,
#form input:-internal-autofill-selected {
  box-shadow: 0 0 0px 1000px var(--secondary-bgc) inset !important;
}

#form input:focus {
  background: var(--primary-bgc);
  color: var(--primary-txt);
}

#form button {
  border: none;
  outline: none;
  white-space: nowrap;
  margin: 0;
  padding: 0;
  font-size: 0.75rem;
  background: var(--secondary-bgc);
  color: var(--primary-txt);
  border-left: 1px solid var(--border-clr);
  cursor: pointer;
}

#form button i {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

#form button:hover {
  background: hsla(180, 100%, 27%, 0.6);
  color: #fff;
}

.formReply {
  display: flex;
  width: 100%;
  background: var(--secondary-bgc);
  border: 1px solid var(--border-clr);
  border-radius: 0.5rem;
  overflow: hidden;
}

.formReply input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 1rem;
  padding: 0.75rem 0.75rem;
  background: var(--secondary-bgc);
  color: var(--primary-txt);
  /* box-shadow: 0 0 0px 1000px var(--secondary-bgc) inset !important; /* 解決自動填入表單的預設背景（方法一） */
}

/* 解決自動填入表單的預設文字 */
.formReply input::first-line {
  color: var(--primary-txt);
}

/* 解決自動填入表單的預設背景（方法二） */
.formReply input:-internal-autofill-previewed,
.formReply input:-internal-autofill-selected {
  box-shadow: 0 0 0px 1000px var(--secondary-bgc) inset !important;
}

.formReply input:focus {
  background: var(--primary-bgc);
  color: var(--primary-txt);
}

.formReply button {
  border: none;
  outline: none;
  white-space: nowrap;
  margin: 0;
  padding: 0;
  font-size: 0.75rem;
  background: var(--secondary-bgc);
  color: var(--primary-txt);
  border-left: 1px solid var(--border-clr);
  cursor: pointer;
}

.formReply button i {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.formReply button:hover {
  background: hsla(180, 100%, 27%, 0.6);
  color: #fff;
}

ul.post-pagination {
  width: 100%;
  list-style: none;
  margin-block: 1rem;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
}

ul.post-pagination li {
  display: inline-block;
  vertical-align: middle;
  align-self: center;
  line-height: 1.8;
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
}

ul.post-pagination li a {
  display: inline-block;
  vertical-align: middle;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  color: darkcyan;
}

ul.post-pagination li a:hover {
  background: hsla(180, 100%, 27%, 0.1);
}

ul.post-pagination li a:active {
  background: hsla(180, 100%, 27%, 0.6);
  color: var(--primary-bgc);
}

ul.post-pagination li a.active {
  background: hsla(180, 100%, 27%, 0.6);
  color: var(--primary-bgc);
}

@media screen and (max-width: 768px) {
  .post {
    max-width: 100%;
    padding-inline: 0;
  }

  .post-wrap {
    padding-inline: 0.5rem;
  }

  .post-heading {
    font-size: 20px;
  }

  .post-heading h2 {
    margin: 0;
  }

  .post-content {
    padding: 0.5rem 0.5rem 2rem;
  }

  .post-user {
    top: 0;
  }

  .post-icon {
    padding-inline: 1rem;
  }

  .post-icon-left {
    width: 100%;
  }

  .post-icon-right {
    width: 100%;
  }

  .post-icon button {
    width: 40px;
    height: 40px;
  }

  .post-icon button i {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
  }
}
/* 留言閃爍動畫 */
@keyframes flashAnimation {
  0% {
    background: var(--border-clr);
  }
  50% {
    background: transparent;
  }
  100% {
    background: var(--border-clr);
  }
}

@keyframes comments {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-comment-section:nth-child(1) {
  animation-delay: 0.1s;
}
.post-comment-section:nth-child(2) {
  animation-delay: 0.2s;
}
.post-comment-section:nth-child(3) {
  animation-delay: 0.3s;
}
.post-comment-section:nth-child(4) {
  animation-delay: 0.4s;
}
.post-comment-section:nth-child(5) {
  animation-delay: 0.5s;
}
.post-comment-section:nth-child(6) {
  animation-delay: 0.6s;
}
.post-comment-section:nth-child(7) {
  animation-delay: 0.7s;
}
.post-comment-section:nth-child(8) {
  animation-delay: 0.8s;
}
.post-comment-section:first-child {
  border-top: 1px solid var(--border-clr);
}
.post-comment-section.flash {
  animation: flashAnimation 1.5s ease-in 1 backwards;
}

/* .show-more-btn {
  padding: 1rem;
  color: hsla(180, 100%, 27%, 0.6);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  user-select: none;
  cursor: pointer;
}

.show-more-btn:hover {
  background: hsla(180, 100%, 27%, 0.1);
  color: hsl(180, 100%, 27%);
}

.show-more-btn i {
  font-size: 0.9rem;
  padding-right: 1rem;
} */
.likeComment-btn {
  gap: 0.3rem;
}
.likeReply-btn {
  gap: 0.3rem;
}
.shareLink {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.shareLink a img {
  width: 40px;
  height: 40px;
  transition: transform 0.2s ease;
}

.shareLink a img:hover {
  transform: scale(1.15);
}
.share-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin: 25px 0 15px;
}
.share-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
}
.share-item:hover {
  transform: translateY(-5px);
}
.share-item img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.share-item span {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-color);
}
.copy-link {
  display: flex;
  margin-top: 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
}
.copy-link input {
  flex: 1;
  padding: 10px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-color);
}
.copy-link button {
  padding: 10px 15px;
  background: var(--primary-color);
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.3s;
}
.copy-link button:hover {
  background: var(--primary-color-hover);
}
#copy-btn {
  color: var(--secondary-txt);
}
@media (max-width: 768px) {
  .share-container {
    gap: 15px;
  }
  .share-item img {
    width: 40px;
    height: 40px;
  }
}
