/* Twikoo 评论系统样式 - AnZhiYu 原始方案适配 Fuwari */

/* 变量适配 */
:root {
  --anzhiyu-fontcolor: var(--title-color);
  --anzhiyu-card-bg: var(--card-bg);
  --anzhiyu-main: var(--primary);
  --anzhiyu-border-color: var(--line-color);
  --anzhiyu-white: var(--btn-content);
  --anzhiyu-secondtext: var(--meta-color);
  --anzhiyu-bg: var(--page-bg);
  --anzhiyu-maskbg: rgba(255, 255, 255, 0.6);
  --anzhiyu-maskbgdeep: rgba(255, 255, 255, 0.85);
  --anzhiyu-hovertext: var(--primary);
  --anzhiyu-lighttext: var(--meta-color);
  --anzhiyu-none: transparent;
}

/* 深色模式变量适配 */
:root.dark {
  --anzhiyu-maskbg: rgba(0, 0, 0, 0.6);
  --anzhiyu-maskbgdeep: rgba(0, 0, 0, 0.85);
}

/* OwO 表情包 */
.OwO .OwO-body {
  min-width: 31.25rem;
}

@media (max-width: 768px) {
  .OwO .OwO-body {
    min-width: 260px;
  }
}

.twikoo svg {
  color: var(--anzhiyu-fontcolor);
}

@keyframes owoIn {
  0% {
    transform: translate(0, -95%);
    opacity: 0;
  }
  100% {
    transform: translate(0, -112%);
    opacity: 1;
  }
}

#owo-big {
  position: fixed;
  align-items: center;
  background-color: var(--anzhiyu-card-bg);
  border: 1px solid var(--anzhiyu-border-color);
  border-radius: 10px;
  z-index: 9999;
  display: none;
  transform: translate(0, -112%);
  overflow: hidden;
  animation: owoIn 0.3s cubic-bezier(0.42, 0, 0.3, 1.11);
}

#owo-big img {
  width: 100%;
}

.tk-expand {
  width: 100%;
  cursor: pointer;
  padding: 0.75em;
  text-align: center;
  transition: all 0.5s;
  border: 1px solid var(--anzhiyu-border-color);
  box-shadow: 0 8px 16px -4px rgba(44, 45, 48, 0.05);
  border-radius: 50px;
  letter-spacing: 5px;
  background-color: var(--anzhiyu-card-bg);
  color: var(--anzhiyu-fontcolor);
}

.tk-expand:hover {
  color: var(--anzhiyu-white);
  background-color: var(--anzhiyu-main);
  border: 1px solid var(--anzhiyu-main);
}

/* 主要评论区域 */
#twikoo, #tcomment {
  color: var(--anzhiyu-fontcolor);
}

#twikoo .tk-comments > .tk-submit {
  overflow: visible !important;
}

#twikoo .tk-comments .OwO .OwO-body {
  border: 1px solid var(--anzhiyu-border-color) !important;
  border-radius: 8px !important;
  overflow: hidden;
  background-color: var(--anzhiyu-card-bg) !important;
  backdrop-filter: saturate(180%) blur(10px);
  cursor: auto;
  top: 2.1em !important;
  transform: translateZ(0);
  animation: 0.3s ease 0.1s 1 normal both running donate_effect;
}

#twikoo .tk-comments .OwO .OwO-body .OwO-items-show {
  margin: 12px 8px;
}

/* 按钮样式 */
#twikoo button.el-button.tk-cancel.el-button--default.el-button--small {
  background: var(--anzhiyu-card-bg);
  border-radius: 8px;
  color: var(--anzhiyu-fontcolor);
  border: 1px solid var(--anzhiyu-border-color);
}

#twikoo button.el-button.tk-cancel.el-button--default.el-button--small:hover {
  background: var(--anzhiyu-card-bg);
  color: var(--anzhiyu-fontcolor);
}

/* 隐藏不需要的元素 */
#twikoo a.tk-submit-action-icon.__markdown,
#twikoo .tk-comments > div.tk-submit > div.tk-row.actions > a,
#twikoo .el-button.tk-preview {
  display: none;
}

/* 提交按钮 */
#twikoo .el-button--primary.is-disabled,
#twikoo .el-button--primary.is-disabled:active,
#twikoo .el-button--primary.is-disabled:focus,
#twikoo .el-button--primary.is-disabled:hover {
  opacity: 0.2;
}

#twikoo .el-button--primary {
  border-color: var(--anzhiyu-main);
  background-color: var(--anzhiyu-main);
  color: var(--anzhiyu-white);
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
  width: 6.25rem;
  position: absolute;
  top: -43px;
  right: 0;
  margin-left: 0.5rem !important;
  height: 32px;
}

#twikoo .el-button--primary:hover {
  background-color: var(--anzhiyu-main);
  border-color: var(--anzhiyu-main);
  opacity: 0.8;
  transform: translateY(-1px);
}

/* 输入框样式 */
#twikoo .tk-input .el-textarea__inner {
  min-height: 130px !important;
  border-radius: 15px;
  display: block;
  resize: vertical;
  padding: 16px 16px 40px 16px;
  line-height: 1.5;
  box-sizing: border-box;
  width: 100%;
  font-size: inherit;
  color: var(--anzhiyu-fontcolor);
  background-color: var(--anzhiyu-card-bg);
  border: 1px solid var(--anzhiyu-border-color);
  transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
}

#twikoo .tk-input .el-textarea__inner:focus {
  border-color: var(--anzhiyu-main);
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--anzhiyu-main), 0.1);
}

#twikoo .el-input__inner {
  background: var(--anzhiyu-card-bg) !important;
  border: 1px solid var(--anzhiyu-border-color) !important;
  color: var(--anzhiyu-fontcolor) !important;
  padding-left: 8px;
}

#twikoo .el-input__inner:focus {
  border-color: var(--anzhiyu-main) !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--anzhiyu-main), 0.1);
}

#twikoo .el-input-group__append,
#twikoo .el-input-group__prepend {
  background-color: var(--anzhiyu-card-bg);
  color: var(--anzhiyu-fontcolor);
  border-color: var(--anzhiyu-border-color);
  border: 1px solid var(--anzhiyu-border-color);
  font-weight: 700;
}

#twikoo .el-input-group--prepend .el-input__inner,
#twikoo .el-input-group__append {
  border-radius: 12px;
}

#twikoo .el-input--small .el-input__inner {
  padding: 8px;
  padding-left: 16px;
}

#twikoo .el-input-group--prepend .el-input__inner,
#twikoo .el-input-group__append {
  border-left-width: 0 !important;
}

/* 元信息输入区 */
#twikoo .tk-meta-input {
  position: relative;
  margin-top: 8px;
  width: calc(100% - 6.875rem);
}

#twikoo .tk-meta-input .el-input.el-input--small.el-input-group.el-input-group--prepend {
  border-radius: 12px;
  background: var(--anzhiyu-card-bg);
  border: 1px solid var(--anzhiyu-border-color);
}

#twikoo .tk-meta-input .el-input .el-input-group__prepend {
  user-select: none;
  border-radius: 12px 0 0 12px;
}

#twikoo .tk-meta-input .el-input--small.el-input-group.el-input-group--prepend:focus-within {
  border-color: var(--anzhiyu-main);
}

/* 行布局 */
#twikoo .tk-row .tk-avatar {
  display: none;
}

#twikoo .tk-row .tk-col {
  flex-direction: column-reverse;
}

#twikoo .tk-row.actions {
  margin-bottom: 0;
  margin-left: 0;
  margin-top: 0;
  justify-content: space-around;
}

/* 管理员和操作 */
#twikoo .tk-admin {
  backdrop-filter: blur(5px);
}

#twikoo .el-button {
  background-color: var(--anzhiyu-main);
  border: 0 solid var(--anzhiyu-main);
  color: var(--anzhiyu-white);
}

#twikoo .tk-tag-green {
  background-color: var(--anzhiyu-main);
  border: none;
  border-radius: 4px;
  color: var(--anzhiyu-white);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

#twikoo .tk-action-icon {
  color: var(--anzhiyu-main);
  cursor: pointer;
  transition: all 0.3s;
}

#twikoo .tk-action-icon:hover {
  transform: scale(1.1);
}

#twikoo .tk-icon.__comments {
  color: var(--anzhiyu-main);
}

#twikoo .tk-actions a {
  cursor: pointer;
}

#twikoo .tk-nick {
  line-height: 40px;
  color: var(--anzhiyu-fontcolor);
  font-weight: 600;
}

#twikoo .tk-extras {
  margin-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* 评论内容 */
#twikoo .tk-content p {
  margin: 0;
  color: var(--anzhiyu-fontcolor);
  line-height: 1.6;
}

#twikoo .tk-content {
  margin-top: 0.5rem;
  overflow: auto;
  max-height: 500px;
  color: var(--anzhiyu-fontcolor);
}

/* 代码样式 */
#twikoo pre code {
  background: none;
}

#twikoo code {
  padding: 2px 4px;
  background: var(--anzhiyu-card-bg);
  color: var(--anzhiyu-main);
  border-radius: 4px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

#twikoo .tk-comment pre {
  background: var(--anzhiyu-card-bg);
  padding: 1em;
  margin: 0.5em 0;
  overflow: auto;
  border-radius: 0.3em;
  border: 1px solid var(--anzhiyu-border-color);
}

/* 头像样式 */
#twikoo .tk-comment .tk-submit .tk-avatar,
#twikoo .tk-replies .tk-avatar {
  height: 2.5rem !important;
  width: 2.5rem !important;
}

#twikoo .tk-avatar {
  border-radius: 50px;
  transition: transform 0.3s;
}

#twikoo .tk-avatar:hover {
  transform: scale(1.05);
}

#twikoo .tk-avatar .tk-avatar-img {
  height: 2.5rem !important;
  border-radius: 50px;
}

/* 回复区域 */
.tk-replies {
  max-height: 10rem !important;
  transition: max-height 0.3s ease;
}

.tk-replies.tk-replies-expand {
  max-height: none !important;
}

.tk-replies .tk-comment {
  border-top: 1px dashed var(--anzhiyu-border-color);
  border-radius: 12px;
  padding: 1rem 0px 0px;
  margin-top: 0;
  transition: all 0.3s ease 0s;
  position: relative;
}

.tk-replies .tk-comment::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  width: 2px;
  height: 100%;
  background: var(--anzhiyu-main);
  opacity: 0.3;
  transform: translateY(-50%);
}

.tk-replies .tk-content span:first-child:not(.token) {
  font-size: 0.75rem;
  color: var(--anzhiyu-secondtext);
}

/* 评论容器 */
.tk-comments-container .tk-submit {
  opacity: 1;
  height: auto;
  overflow: visible;
}

.tk-comments-container > .tk-comment {
  margin-top: 0 !important;
  margin-bottom: 1rem !important;
  transition: 0.3s;
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--anzhiyu-border-color);
  background: var(--anzhiyu-card-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.tk-comments-container > .tk-comment::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--anzhiyu-main);
  opacity: 0;
  transition: opacity 0.3s;
}

.tk-comments-container > .tk-comment:hover::before {
  opacity: 1;
}

.tk-comments-container > .tk-comment:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* 额外信息 */
#twikoo .tk-extra {
  background: var(--anzhiyu-card-bg);
  border: 1px solid var(--anzhiyu-border-color);
  padding: 4px 8px;
  border-radius: 8px;
  margin-right: 4px;
  color: var(--anzhiyu-secondtext);
  margin-top: 6px;
  font-size: 0.8rem;
  transition: all 0.3s;
}

#twikoo .tk-extra:hover {
  background: var(--anzhiyu-card-bg);
}

#twikoo .tk-extra-text {
  font-size: 0.75rem;
}

#twikoo .tk-replies .tk-content {
  font-size: 0.9rem;
}

/* 链接样式 */
.tk-content span a:not([data-fancybox="gallery"]) {
  font-weight: 500;
  border-bottom: solid 2px var(--anzhiyu-main);
  color: var(--anzhiyu-fontcolor);
  padding: 0 0.2em;
  text-decoration: none;
  transition: all 0.3s;
}

.tk-content span a:not([data-fancybox="gallery"]):hover {
  color: var(--anzhiyu-white);
  background-color: var(--anzhiyu-main);
  border-radius: 4px;
  transform: translateY(-1px);
}

.tk-main .tk-content span > a {
  border-bottom: none;
}

/* 输入提示 */
.el-input.el-input--small.el-input-group.el-input-group--prepend:nth-child(1):before {
  content: "输入QQ号会自动获取昵称和头像🐧";
}

.el-input.el-input--small.el-input-group.el-input-group--prepend:nth-child(2):before {
  content: "收到回复将会发送到您的邮箱📧";
}

.el-input.el-input--small.el-input-group.el-input-group--prepend:nth-child(3):before {
  content: "可以通过昵称访问您的网站🔗";
}

.el-input.el-input--small.el-input-group.el-input-group--prepend:focus-within::before {
  display: block;
  animation: commonTipsIn 0.3s;
  z-index: 2;
}

.el-input.el-input--small.el-input-group.el-input-group--prepend:focus-within::after {
  display: block;
  animation: commonTriangleIn 0.3s;
}

.el-input.el-input--small.el-input-group.el-input-group--prepend::before {
  display: none;
  position: absolute;
  top: -60px;
  white-space: nowrap;
  border-radius: 10px;
  left: 50%;
  transform: translate(-50%);
  padding: 14px 18px;
  background: var(--anzhiyu-card-bg);
  color: var(--anzhiyu-fontcolor);
  border: 1px solid var(--anzhiyu-border-color);
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.el-input.el-input--small.el-input-group.el-input-group--prepend::after {
  display: none;
  content: '';
  position: absolute;
  border: 12px solid transparent;
  border-top-color: var(--anzhiyu-card-bg);
  left: 50%;
  transform: translate(-50%, -46px);
}

/* 动画 */
@keyframes commonTipsIn {
  0% {
    top: -50px;
    opacity: 0;
  }
  100% {
    top: -60px;
    opacity: 1;
  }
}

@keyframes commonTriangleIn {
  0% {
    transform: translate(-50%, -36px);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -46px);
    opacity: 1;
  }
}

@keyframes donate_effect {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    filter: none;
    transform: translateY(0);
  }
}

/* 移动端适配 - 保持原始anzhiyu方案 */
@media screen and (max-width: 768px) {
  .tk-comments .tk-row-actions-start {
    top: -176px;
  }
  
  #twikoo .tk-comments .tk-submit .el-button--primary {
    height: 122px;
    top: -126px;
  }
  
  #twikoo .el-textarea__inner {
    background: var(--anzhiyu-card-bg) !important;
    overflow: hidden;
    resize: none !important;
  }
  
  .tk-comments button.el-button.tk-preview.el-button--default.el-button--small {
    display: none;
  }
  
  .tk-comments .tk-main .tk-submit .tk-row.actions {
    justify-content: center;
  }
  
  .tk-comments button.el-button.tk-send,
  .tk-comments button.el-button.tk-cancel {
    width: 100%;
  }
  
  .tk-comments .tk-row-actions-start {
    position: absolute;
  }
  
  .tk-comments-container .tk-comment {
    padding: 1rem;
    border: 1px solid var(--anzhiyu-border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    background: var(--anzhiyu-card-bg);
  }
  
  .tk-replies .tk-comment {
    border: none;
  }
}

/* 表情包悬停效果 */
.OwO .OwO-body .OwO-items .OwO-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  border-radius: 8px;
  background: var(--anzhiyu-card-bg);
  transform: scale(1.1);
  transition: all 0.3s;
}

/* 管理员配置 */
#twikoo .tk-admin-config-input .el-input__inner {
  background: transparent !important;
}

/* 页面特定样式 */
.tk-comments .tk-row-actions-start {
  position: absolute;
  top: -84px;
  left: 17px;
}

/* 时间显示 */
#twikoo .tk-time {
  color: var(--anzhiyu-secondtext);
  font-size: 0.85rem;
}

/* 操作按钮 */
#twikoo .tk-action {
  color: var(--anzhiyu-secondtext);
  transition: color 0.3s;
}

#twikoo .tk-action:hover {
  color: var(--anzhiyu-main);
}

/* 评论区整体动画 */
#tcomment {
  animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 评论发送成功提示 */
.tk-submit-success {
  background: linear-gradient(135deg, var(--anzhiyu-main), rgba(var(--anzhiyu-main), 0.8));
  color: var(--anzhiyu-white);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  text-align: center;
  animation: slideInDown 0.5s ease;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}