/* 基础样式 */
* {
  box-sizing: border-box;
}

body { 
  margin: 0; 
  padding: 0; 
  min-width: 89%; 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  color: #333333; 
  font-size: 16px; 
  background-color: #FFFFFF; 
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
} 

a:link {color:#224488;text-decoration:none; } 
a:visited {color:#224488;text-decoration:none; } 
a:hover {color:#c60;text-decoration:underline; } 
a:active {color:#c60;text-decoration:none;}
a:focus {
  outline: 2px solid #FF3300;
  outline-offset: 2px;
}
/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  a {
    -webkit-tap-highlight-color: rgba(255, 51, 0, 0.2);
    touch-action: manipulation;
  }
} 

td { 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif; 
  font-size: 14px; 
} 

/* 文章标题 */
.judulpost {
  border-left: 10px solid #FF3300;
  color: #000; 
  font-size: 20px; 
  font-weight: bold; 
  display: block; 
  padding: 8px 12px; 
  text-align: left; 
  direction: ltr; 
  width: 98%; 
  margin: 0 0 8px;
  line-height: 1.4;
}
h1.judulpost, h2.judulpost {
  font-size: 20px;
  font-weight: bold;
} 

/* 文章日期 */
.tanggalpost {
  background-color: #f7f7f7; 
  font-size: 14px; 
  color: #666666; 
  padding: 6px 12px; 
  text-align: right; 
  width: 98%; 
  float: right; 
  margin-bottom: 12px;
  border-radius: 4px;
} 

/* 文章内容 */
.isipost {
  font-size: 1.1em; 
  color: #333333; 
  text-align: left; 
  line-height: 1.8; 
  padding: 12px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* 文章内容中的段落 */
.isipost p {
  margin: 1em 0;
}

/* 文章内容中的标题 */
.isipost h1, .isipost h2, .isipost h3, .isipost h4, .isipost h5, .isipost h6 {
  margin: 1.5em 0 0.8em 0;
  font-weight: bold;
  line-height: 1.3;
  color: #222;
}

.isipost h1 { font-size: 1.8em; border-bottom: 2px solid #FF3300; padding-bottom: 0.3em; }
.isipost h2 { font-size: 1.5em; border-bottom: 1px solid #e0e0e0; padding-bottom: 0.3em; }
.isipost h3 { font-size: 1.3em; }
.isipost h4 { font-size: 1.1em; }

/* 代码块样式 */
.isipost pre {
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-left: 4px solid #FF3300;
  border-radius: 4px;
  padding: 16px;
  margin: 1.5em 0;
  overflow-x: auto;
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.9em;
  line-height: 1.5;
  color: #333;
  direction: ltr;
  text-align: left;
}

.isipost code {
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  padding: 2px 6px;
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.9em;
  color: #d63384;
}

.isipost pre code {
  background-color: transparent;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* 列表样式 */
.isipost ul, .isipost ol {
  margin: 1em 0;
  padding-left: 2em;
}

.isipost li {
  margin: 0.5em 0;
}

/* 引用块样式 */
.isipost blockquote {
  border-left: 4px solid #B9CAC0;
  margin: 1.5em 0;
  padding: 0.5em 1em;
  background-color: #f9f9f9;
  color: #666;
  font-style: italic;
}

/* 表格样式 */
.isipost table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  font-size: 0.95em;
}

.isipost table th,
.isipost table td {
  border: 1px solid #ddd;
  padding: 8px 12px;
  text-align: left;
}

.isipost table th {
  background-color: #f5f5f5;
  font-weight: bold;
  color: #333;
}

.isipost table tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* 图片样式 */
.isipost img {
  max-width: 100%;
  height: auto;
  border: 0px none;
  margin: 1.5em 0;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: block;
}

/* 图片懒加载占位符 */
.isipost img[loading="lazy"] {
  background-color: #f0f0f0;
  min-height: 200px;
}

/* 文章底部信息 */
.bawahpost { 
  font-size: 14px; 
  font-style: italic; 
  text-align: left; 
  padding: 12px; 
  color: #666;
  border-top: 1px solid #e0e0e0;
  margin-top: 20px;
} 

.judul { 
  font-size: 13px; 
  font-weight: bold; 
  height: 20px; 
  color: #FFFFFF; 
  text-align: center; 
  padding-top: 5px; 
  background-color: #B9CAC0; 
  font-family: Geneva, Arial, Helvetica, sans-serif; 
} 

.isi { 
  padding: 13px; 
  border: 1px solid #B9CAC0; 
  background-color: #F9F9F9; 
  border-radius: 4px;
  margin-bottom: 12px;
} 

textarea, input, select, option, button { 
  font-family: Tahoma, Verdana, Arial; 
  background-color: #F3F5F4; 
  color: #7B9685; 
  font-size: 14px; 
  border: 1px solid #B9CAC0; 
  border-radius: 4px;
  padding: 6px;
} 

img { 
  border: 0px none; 
  max-width: 100%;
  height: auto;
} 

.footer { 
  height: 50px; 
  font-family: Verdana, Arial, Helvetica, sans-serif; 
  font-size: 13px; 
  text-align: center; 
  vertical-align: middle; 
  padding: 20px 0;
  margin-top: 40px;
  border-top: 1px solid #e0e0e0;
} 

.footer a { 
  color: #7B9685; 
} 

.tengah { 
  vertical-align: top; 
  background-color: #510001; 
} 

.ulang { 
  background-color: #F9F9F9; 
  padding: 20px;
  margin-bottom: 20px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
} 

.ulang td { 
  padding: 8px; 
} 

/* 评论区域样式 */
#comments-block {
  margin: 2em 0;
}

#comments-block dt {
  font-weight: bold;
  margin-top: 1.5em;
  color: #333;
}

#comments-block dd {
  margin-left: 0;
  margin-bottom: 1em;
  padding-left: 1.5em;
  border-left: 3px solid #B9CAC0;
  padding-top: 0.5em;
}

#comments-block .comment-body {
  color: #555;
  line-height: 1.6;
}

#comments-block .comment-poster {
  color: #999;
  font-size: 0.9em;
  margin-top: 0.5em;
}

/* 主容器样式 */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 内容区域 */
.content-wrapper {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

/* 侧边栏 */
.sidebar {
  min-width: 250px;
  max-width: 300px;
}

/* 主内容区 */
.main-content {
  flex: 1;
  min-width: 0;
}

/* 响应式设计 - 平板 */
@media screen and (max-width: 1024px) {
  .main-container {
    padding: 15px;
  }
}

/* 响应式设计 - 移动端 */
@media screen and (max-width: 768px) {
  body {
    font-size: 14px;
    min-width: 100%;
  }
  
  .main-container {
    padding: 10px;
  }
  
  .content-wrapper {
    flex-direction: column;
    gap: 15px;
  }
  
  .sidebar {
    max-width: 100%;
    width: 100%;
  }
  
  .judulpost {
    font-size: 18px;
    padding: 6px 10px;
    width: 100%;
    border-left-width: 6px;
  }
  
  .tanggalpost {
    width: 100%;
    font-size: 12px;
    padding: 4px 10px;
  }
  
  .isipost {
    font-size: 1em;
    padding: 8px;
    line-height: 1.7;
  }
  
  .isipost h1 { font-size: 1.5em; }
  .isipost h2 { font-size: 1.3em; }
  .isipost h3 { font-size: 1.15em; }
  .isipost h4 { font-size: 1.05em; }
  
  .isipost pre {
    font-size: 0.85em;
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -8px;
    margin-right: -8px;
    border-radius: 0;
  }
  
  .isipost code {
    font-size: 0.85em;
    word-break: break-word;
  }
  
  .isipost ul, .isipost ol {
    padding-left: 1.5em;
  }
  
  .isipost blockquote {
    margin-left: 0;
    margin-right: 0;
    padding: 0.8em 1em;
  }
  
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    margin-left: -8px;
    margin-right: -8px;
  }
  
  .isipost table {
    font-size: 0.9em;
  }
  
  .isipost table th,
  .isipost table td {
    padding: 6px 8px;
  }
  
  .ulang {
    padding: 15px;
    margin-bottom: 15px;
  }
  
  .isi {
    padding: 10px;
  }
  
  .bawahpost {
    font-size: 12px;
    padding: 10px 8px;
  }
  
  .footer {
    font-size: 12px;
    padding: 15px 10px;
  }
  
  /* 固定宽度表格在移动端的处理 */
  table[width] {
    width: 100% !important;
    max-width: 100%;
    table-layout: auto !important;
  }
  
  td[width="500px"],
  td[width="300px"],
  td[width] {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    float: none !important;
  }
  
  /* 确保表格单元格在移动端正确显示 */
  table td {
    display: table-cell;
  }
  
  /* 但侧边栏和主内容区的表格单元格需要特殊处理 */
  table[width="100%"] > tbody > tr > td[width="500px"],
  table[width="100%"] > tbody > tr > td[width="300px"] {
    display: block !important;
    width: 100% !important;
  }
  
  /* Logo 和标题在移动端的优化 */
  img[alt*="BlogTitle"] {
    max-width: 100%;
    height: auto;
  }
  
  /* 链接触摸友好 */
  a {
    min-height: 44px;
    display: inline-block;
    padding: 4px 0;
  }
  
  /* 表单元素优化 */
  select, input, textarea, button {
    font-size: 16px; /* 防止 iOS 自动缩放 */
    min-height: 44px;
    width: 100%;
    max-width: 100%;
  }
  
  /* 评论区域优化 */
  #comments-block dt {
    font-size: 0.95em;
    margin-top: 1.2em;
  }
  
  #comments-block dd {
    padding-left: 1em;
    font-size: 0.95em;
  }
}

/* 小屏幕手机优化 */
@media screen and (max-width: 480px) {
  body {
    font-size: 13px;
  }
  
  .judulpost {
    font-size: 16px;
    padding: 5px 8px;
  }
  
  .isipost {
    font-size: 0.95em;
    padding: 6px;
  }
  
  .isipost h1 { font-size: 1.4em; }
  .isipost h2 { font-size: 1.25em; }
  .isipost h3 { font-size: 1.1em; }
  
  .isipost pre {
    font-size: 0.8em;
    padding: 10px;
  }
  
  .ulang {
    padding: 12px;
  }
  
  .isi {
    padding: 8px;
  }
}

/* QuickSub 样式 */
#quickSub { 
  position: absolute; 
  font: normal 7pt verdana; 
  border: 1px solid #000066; 
  visibility: hidden; 
  z-index: 1000; 
  width: 79px; 
} 

#quickSub .qsheader { 
  background-color: #006699; 
  color: #FFFFFF; 
  font: bold 7pt verdana; 
  padding: 2px 2px 2px 3px; 
  border-bottom: 1px solid #000066; 
} 

#quickSub .qsheader a { 
  margin-left: 3px; 
  color: #FFFFFF; 
  text-decoration: none; 
} 

#quickSub .qscontent { 
  background-color: #EEEEEE; 
  color: #000000; 
  padding: 1px 3px 2px 2px; 
  font: normal 7pt verdana; 
} 

#quickSub a { 
  margin-left: 3px; 
  text-decoration: none; 
  font: normal 7pt verdana; 
} 

#quickSub a:hover { 
  text-decoration: underline; 
} 

#quickSub .qscontent a:visited { 
  color: #000000; 
} 

#quickSub .qscontent a:hover { 
  color: #ff0000; 
} 

#quickSub .qscontent a:link { 
  color: #000000; 
} 

#quickSub .qsfooterWhat a:visited { 
  color: #000000; 
} 

#quickSub .qsfooterWhat a:link { 
  color: #000000; 
} 

#quickSub .qsfooterWhat a:hover { 
  color: #ff0000; 
} 

#quickSub .qsfooterWhat { 
  background-color: #EEEEEE; 
  text-align: right; 
  padding: 1px 3px 2px 3px; 
  font: 4pt verdana; 
} 

#quickSub .qsfooter { 
  background-color: #006699; 
  color: #FFFFFF; 
  text-align: right; 
  font: 4pt verdana; 
  padding: 2px 2px 2px 3px; 
  border-bottom: 1px solid #000066; 
} 

#quickSub .qsfooter a { 
  color: #FFFFFF; 
  text-decoration: none; 
}

/* 触摸设备样式 */
.touch-device a {
  -webkit-tap-highlight-color: rgba(255, 51, 0, 0.2);
}

/* 可访问性改进 */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #FF3300;
  color: #fff;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* 减少动画（尊重用户偏好） */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 打印样式优化 */
@media print {
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }
  
  .sidebar,
  .footer,
  .bawahpost,
  #comments-block {
    display: none;
  }
  
  .isipost {
    page-break-inside: avoid;
  }
  
  .isipost pre {
    page-break-inside: avoid;
    border: 1px solid #ccc;
  }
  
  a {
    color: #000;
    text-decoration: underline;
  }
  
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  .judulpost {
    border-left-width: 12px;
  }
  
  .isipost {
    border: 1px solid #000;
  }
  
  a {
    text-decoration: underline;
  }
}

/* 聊天机器人：右侧竖条，抽屉从右侧滑入 */
#blog-chatbot-container {
  position: fixed;
  right: 0;
  left: auto;
  top: 50%;
  z-index: 9999;
  width: 350px;
  max-width: 90vw;
  max-height: 80vh;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-right: none;
  border-radius: 8px 0 0 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  visibility: hidden;
  pointer-events: none;
  transform: translate(100%, -50%);
  transition: transform 0.28s ease, visibility 0.28s ease;
}

#blog-chatbot-container.active {
  visibility: visible;
  pointer-events: auto;
  transform: translate(0, -50%);
}

#blog-chatbot-toggle {
  position: fixed;
  right: 0;
  left: auto;
  top: 62%;
  transform: translateY(-50%);
  z-index: 10000;
  background: #224488;
  color: #fff;
  border: none;
  border-radius: 8px 0 0 8px;
  padding: 12px 8px;
  cursor: pointer;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: background 0.3s ease, padding 0.3s ease;
}

#blog-chatbot-toggle:hover {
  background: #c60;
  padding-right: 10px;
}

#blog-chatbot-toggle.active {
  visibility: hidden;
  pointer-events: none;
}

#blog-chatbot-header {
  background: #929292;
  color: #fff;
  padding: 12px 44px 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px 0 0 0;
  position: relative;
}

#blog-chatbot-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: bold;
}

#blog-chatbot-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

#blog-chatbot-close:hover {
  opacity: 0.8;
}

#blog-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f9f9f9;
  min-height: 300px;
  max-height: calc(80vh - 120px);
}

.chatbot-message {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

.chatbot-message.user {
  align-items: flex-end;
}

.chatbot-message.bot {
  align-items: flex-start;
}

.chatbot-message-content {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  word-wrap: break-word;
  line-height: 1.5;
}

.chatbot-message.user .chatbot-message-content {
  background: #224488;;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chatbot-message.bot .chatbot-message-content {
  background: #fff;
  color: #333;
  border: 1px solid #e0e0e0;
  border-bottom-left-radius: 4px;
}

.chatbot-message-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  padding: 0 4px;
}

#blog-chatbot-input-container {
  padding: 12px;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 8px;
  border-radius: 0 0 0 8px;
}

#blog-chatbot-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

#blog-chatbot-input:focus {
  border-color: #224488;
}

#blog-chatbot-send {
  background: #224488;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background 0.3s;
}

#blog-chatbot-send:hover {
  background:#c60;
}

#blog-chatbot-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.chatbot-loading {
  display: inline-flex;
  gap: 4px;
  padding: 10px 14px;
}

.chatbot-loading span {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: chatbot-bounce 1.4s infinite ease-in-out;
}

.chatbot-loading span:nth-child(1) {
  animation-delay: -0.32s;
}

.chatbot-loading span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes chatbot-bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* 移动端聊天机器人优化 */
@media screen and (max-width: 768px) {
  #blog-chatbot-container {
    width: 100%;
    max-width: 100%;
    height: 100%;
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    border-radius: 0;
    max-height: 100vh;
    transform: translateX(100%);
  }

  #blog-chatbot-container.active {
    transform: translateX(0);
  }

  #blog-chatbot-toggle {
    right: 0;
    left: auto;
  }

  #blog-chatbot-toggle.active {
    visibility: hidden;
    pointer-events: none;
  }

  #blog-chatbot-header {
    border-radius: 0;
  }

  #blog-chatbot-close {
    top: 10px;
    right: 10px;
  }

  #blog-chatbot-messages {
    max-height: calc(100vh - 140px);
  }
}

.site-brand img { max-width: 399px; height: auto; }
.sidebar-cell { width: 300px; vertical-align: top; }
.main-cell { vertical-align: top; }
.archive-entry { margin: 8px 0; }
.archive-toolbar { margin-bottom: 16px; color: #666; }
.archive-sep { margin: 0 8px; color: #ccc; }
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
}
.cal-title { margin: 0; font-size: 1.2em; }
.cal-grid { width: 100%; max-width: 420px; border-collapse: collapse; table-layout: fixed; }
.cal-grid th, .cal-grid td {
  border: 1px solid #e0e0e0;
  text-align: center;
  padding: 8px 4px;
  width: 14.28%;
}
.cal-grid th { background: #f7f7f7; font-weight: bold; }
.cal-grid td.has-posts { background: #fff5f0; }
.cal-grid td.has-posts.selected { background: #ffece5; outline: 2px solid #FF3300; }
.cal-grid td a { display: block; color: #224488; text-decoration: none; }
.cal-count { display: block; font-size: 11px; color: #c60; }
.cal-day.muted { color: #bbb; }
.archive-post-list { padding-left: 1.2em; }
.archive-month-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.archive-year-block h4 { margin: 1em 0 0.4em; border-left: 6px solid #FF3300; padding-left: 8px; }
.blog-pager { overflow: hidden; margin: 16px 0; }
.sidebar-label { font-weight: bold; padding-top: 8px; }
.wechat-qr img { max-width: 160px; width: 100%; height: auto; display: block; }
.wechat-qr div { font-size: 12px; color: #666; margin-top: 4px; }
@media screen and (max-width: 768px) {
  .sidebar-cell, .main-cell { display: block; width: 100%; }
}
