/* 通用 */
.hidden {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  line-height: 1.6;
  background-color: #f5f5f5;
  color: #111;
}

/* 头部 */
.header {
  background: #4f46e5;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 1.2rem;
  margin: 0;
}

.logout-btn {
  background: #ffffff;
  color: #4f46e5;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

/* 主体内容 */
.content {
  padding: 16px;
  max-width: 800px;
  margin: 0 auto;
}

section {
  margin-bottom: 24px;
  background: #ffffff;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

code {
  background-color: #f0f0f0;
  padding: 2px 4px;
  border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}

.highlight {
  background-color: rgba(255, 255, 0, 0.2);
  display: block;
  margin: 0 -1rem;
  padding: 0 1rem;
}

/* 代码块及复制按钮 */
.pre-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

pre {
  background-color: #2d2d2d;
  color: #f8f8f2;
  padding: 2.5rem 1rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: #444;
  color: #fff;
  border: none;
  padding: 4px 8px;
  font-size: 0.8rem;
  border-radius: 4px;
  cursor: pointer;
}

/* 弹窗 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-dialog {
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
}

.modal-dialog h2 {
  margin-top: 0;
}

.modal-dialog label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.modal-dialog input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.primary-btn {
  background: #4f46e5;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  margin-top: 4px;
  font-size: 1rem;
}

/* 移动端优化 */
@media (max-width: 600px) {
  .header h1 {
    font-size: 1rem;
  }
}

/* Loading 遮罩 */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #4f46e5;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 微信群二维码 */
.wechat-group {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 12vw;
  max-width: 250px;
  min-width: 150px;
  height: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  overflow: hidden;
  display: none; /* 默认在移动端隐藏 */
}

.wechat-group img {
  width: 100%;
  height: auto;
  display: block;
}

.wechat-sidebar {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background-color: #4f46e5;
  color: white;
  padding: 10px 5px; /* 调整内边距 */
  width: 45px; /* 增加宽度 */
  height: 160px; /* 设置固定高度 */
  box-sizing: border-box; /* 增加盒模型属性 */
  writing-mode: vertical-rl;
  text-orientation: mixed;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  cursor: pointer;
  z-index: 998;
  /* 使用 Flexbox 实现内容居中 */
  display: flex;
  justify-content: center;
  align-items: center;
}

.wechat-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}

.wechat-modal-content {
  width: 80%;
  max-width: 300px;
}

.wechat-modal-content img {
  width: 100%;
  border-radius: 8px;
}

/* 响应式调整 */
@media (min-width: 601px) {
  .wechat-group {
    display: block;
  }
  .wechat-sidebar {
    display: none;
  }
}

@media (max-width: 600px) {
  .wechat-sidebar {
    display: flex;
  }
}
