/* 分享功能样式 */
/* 分享按钮继承mystical-btn的样式，不需要额外定义 */
.share-btn i {
  margin-right: 6px;
  font-size: 1rem;
}

/* 分享模态框 */
.share-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.share-modal.active {
  display: flex;
  opacity: 1;
}

.share-content {
  width: 90%;
  max-width: 500px;
  background-color: var(--bg-primary, #fff);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: modalAppear 0.4s ease-out;
  border: 1px solid rgba(212, 175, 55, 0.3);
}

[data-theme="dark"] .share-content {
  background-color: var(--bg-primary-dark, #1a1a2e);
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: #f2f0f7;
}

.share-header {
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  padding-bottom: 15px;
  text-align: center;
}

.share-header h3 {
  font-size: 1.3rem;
  margin: 0;
  color: var(--color-heading, #483d8b);
  font-family: 'Noto Serif SC', serif;
}

[data-theme="dark"] .share-header h3 {
  color: #d4af37;
}

.share-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(155, 89, 182, 0.15);
  border: 1px solid rgba(155, 89, 182, 0.3);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.8rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text, #333);
  transition: all 0.2s;
  z-index: 2;
  -webkit-tap-highlight-color: transparent; /* 移除iOS点击高亮 */
  touch-action: manipulation; /* 优化触摸操作 */
  -webkit-user-select: none;
  user-select: none;
  /* 确保文本居中 */
  padding: 0;
  margin: 0;
  text-align: center;
}

.share-close:hover {
  background: rgba(155, 89, 182, 0.25);
  color: #9b59b6;
  transform: scale(1.1);
}

[data-theme="dark"] .share-close {
  background: rgba(212, 175, 55, 0.15);
  border-color: rgba(212, 175, 55, 0.3);
  color: #f2f0f7;
}

[data-theme="dark"] .share-close:hover {
  background: rgba(212, 175, 55, 0.25);
  color: #d4af37;
}

/* 选项样式 */
.share-options {
  margin-bottom: 25px;
}

.share-options h4 {
  font-size: 1.1rem;
  margin: 15px 0 10px;
  color: var(--color-heading, #483d8b);
}

[data-theme="dark"] .share-options h4 {
  color: #d4af37;
}

.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.option-item {
  display: flex;
  align-items: center;
  margin: 5px 0;
}

/* 自定义复选框样式 */
.custom-checkbox {
  position: relative;
  padding-left: 30px;
  cursor: pointer;
  font-size: 1rem;
  -webkit-user-select: none;
  user-select: none;
  line-height: 22px;
  margin-right: 15px;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 20px;
  width: 20px;
  background-color: #eee;
  border-radius: 4px;
  transition: all 0.2s ease;
  border: 1px solid #ccc;
}

.custom-checkbox:hover input ~ .checkmark {
  background-color: #ddd;
}

.custom-checkbox input:checked ~ .checkmark {
  background-color: #9b59b6;
  border-color: #9b59b6;
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
  display: block;
}

.custom-checkbox .checkmark:after {
  left: 7px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

[data-theme="dark"] .checkmark {
  background-color: #333;
  border-color: #555;
}

[data-theme="dark"] .custom-checkbox:hover input ~ .checkmark {
  background-color: #444;
}

[data-theme="dark"] .custom-checkbox input:checked ~ .checkmark {
  background-color: #d4af37;
  border-color: #d4af37;
}

/* 自定义单选按钮样式 */
.custom-radio {
  position: relative;
  padding-left: 30px;
  cursor: pointer;
  font-size: 1rem;
  -webkit-user-select: none;
  user-select: none;
  line-height: 22px;
  margin-right: 15px;
}

.custom-radio input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.radio-mark {
  position: absolute;
  top: 0;
  left: 0;
  height: 20px;
  width: 20px;
  background-color: #eee;
  border-radius: 50%;
  transition: all 0.2s ease;
  border: 1px solid #ccc;
}

.custom-radio:hover input ~ .radio-mark {
  background-color: #ddd;
}

.custom-radio input:checked ~ .radio-mark {
  background-color: #9b59b6;
  border-color: #9b59b6;
}

.radio-mark:after {
  content: "";
  position: absolute;
  display: none;
}

.custom-radio input:checked ~ .radio-mark:after {
  display: block;
}

.custom-radio .radio-mark:after {
  top: 6px;
  left: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}

[data-theme="dark"] .radio-mark {
  background-color: #333;
  border-color: #555;
}

[data-theme="dark"] .custom-radio:hover input ~ .radio-mark {
  background-color: #444;
}

[data-theme="dark"] .custom-radio input:checked ~ .radio-mark {
  background-color: #d4af37;
  border-color: #d4af37;
}

/* 按钮样式 */
.share-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.share-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s;
  background: linear-gradient(145deg, #9b59b6, #8e44ad);
  color: white;
}

.share-btn:hover {
  box-shadow: 0 5px 15px rgba(155, 89, 182, 0.4);
  transform: translateY(-2px);
}

.share-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

[data-theme="dark"] .share-btn:disabled {
  background: #444;
}

/* 预览容器 */
.share-preview {
  margin: 20px 0;
  padding: 15px;
  border-radius: 8px;
  background-color: rgba(249, 249, 249, 0.8);
  border: 1px dashed #ccc;
  text-align: center;
  min-height: 200px;
}

[data-theme="dark"] .share-preview {
  background-color: rgba(34, 34, 51, 0.8);
  border-color: #444;
}

.preview-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.preview-qrcode {
  max-width: 200px;
  margin: 0 auto;
}

.preview-link {
  word-break: break-all;
  padding: 10px;
  background: rgba(155, 89, 182, 0.1);
  border-radius: 4px;
  font-family: monospace;
  margin: 10px 0;
}

[data-theme="dark"] .preview-link {
  background: rgba(212, 175, 55, 0.1);
}

.copy-link-btn {
  background: transparent;
  border: 1px solid #9b59b6;
  color: #9b59b6;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s;
}

.copy-link-btn:hover {
  background: #9b59b6;
  color: white;
}

[data-theme="dark"] .copy-link-btn {
  border-color: #d4af37;
  color: #d4af37;
}

[data-theme="dark"] .copy-link-btn:hover {
  background: #d4af37;
  color: #1a1a2e;
}

/* 分享图片样式 */
.share-image-container {
  position: relative;
  width: 100%;
  font-family: 'Noto Serif SC', serif;
  color: #333;
  background: linear-gradient(to bottom, #f9f9f9, #f2f0f7);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

/* 五行元素颜色样式 */
.share-image-table .element-wood {
  color: #4CAF50;
  font-weight: bold;
}

.share-image-table .element-fire {
  color: #F44336;
  font-weight: bold;
}

.share-image-table .element-earth {
  color: #FF9800;
  font-weight: bold;
}

.share-image-table .element-metal {
  color: #9E9E9E;
  font-weight: bold;
}

.share-image-table .element-water {
  color: #2196F3;
  font-weight: bold;
}

.share-image-header {
  text-align: center;
  padding-bottom: 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.share-image-title {
  font-size: 24px;
  font-weight: 700;
  color: #483d8b;
  margin: 0 0 10px;
}

.share-image-topic {
  font-size: 16px;
  color: #666;
  font-style: italic;
}

.share-image-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.share-image-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 15px;
}

.share-image-table th,
.share-image-table td {
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 8px;
  text-align: center;
}

.share-image-table th {
  background-color: rgba(72, 61, 139, 0.1);
  color: #483d8b;
  font-weight: 600;
}

.share-image-ai-wrapper {
  margin-top: 20px;
  background: rgba(155, 89, 182, 0.03);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.share-image-ai-title {
  color: #9b59b6;
  margin-top: 0;
  margin-bottom: 10px;
  border-bottom: 1px dashed rgba(155, 89, 182, 0.3);
  padding-bottom: 8px;
  font-size: 1.1rem;
  text-align: center;
}

.share-image-ai {
  background: rgba(155, 89, 182, 0.05);
  padding: 15px;
  border-radius: 8px;
  border-left: 3px solid #9b59b6;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: break-word;
  white-space: normal;
}

.share-image-ai br {
  display: block;
  content: "";
  margin-top: 8px;
}

.share-image-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: #888;
  border-top: 1px solid rgba(212, 175, 55, 0.3);
  padding-top: 10px;
}

/* 动画效果 */
@keyframes modalAppear {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* 响应式设计 */
@media (max-width: 576px) {
  .share-content {
    width: 95%;
    padding: 15px;
  }
  
  .option-group {
    flex-direction: column;
    gap: 5px;
  }
  
  .share-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .share-btn {
    width: 100%;
  }
}
