/* 分享彈窗樣式 */
.share-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.share-modal.active {
  opacity: 1;
  visibility: visible;
}

.share-modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(30px);
  transition: transform 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.share-modal.active .share-modal-content {
  transform: translateY(0);
}

.share-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 16px;
}

.share-modal-title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.share-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.share-modal-close:hover {
  background: #f5f5f5;
  color: #666;
}

/* 分享預覽區 */
.share-preview {
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e9ecef;
}

.share-preview-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
  font-weight: 500;
}

.share-preview-content {
  background: white;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  position: relative;
}

.share-preview-text {
  font-size: 15px;
  line-height: 1.5;
  color: #333;
  white-space: pre-line;
  margin: 0;
}

.share-preview-url {
  font-size: 13px;
  color: #666;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

.share-text-options {
  margin-bottom: 20px;
}

.share-text-options-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
  font-weight: 500;
}

.share-text-variants {
  display: grid;
  gap: 8px;
}

.share-text-variant {
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  line-height: 1.4;
  color: #333; /* 確保文字顏色清晰 */
  font-weight: 500; /* 增加文字粗細以提高可讀性 */
}

.share-text-variant:hover {
  border-color: #667eea;
  background: #f8f9ff;
}

.share-text-variant.selected {
  border-color: #667eea;
  background: #667eea;
  color: white;
}

/* 分享按鈕網格 */
.share-platforms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.share-platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  background: white;
  color: #333;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  font-weight: 500;
  min-height: 80px;
}

.share-platform-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  color: #333;
}

.share-platform-btn i {
  font-size: 24px;
  margin-bottom: 6px;
}

/* 平台特定顏色 */
.share-platform-btn.line:hover {
  border-color: #00c300;
  background: #00c300;
  color: white;
}

.share-platform-btn.facebook:hover {
  border-color: #1877f2;
  background: #1877f2;
  color: white;
}

.share-platform-btn.twitter:hover {
  border-color: #1da1f2;
  background: #1da1f2;
  color: white;
}

.share-platform-btn.whatsapp:hover {
  border-color: #25d366;
  background: #25d366;
  color: white;
}

.share-platform-btn.telegram:hover {
  border-color: #0088cc;
  background: #0088cc;
  color: white;
}

.share-platform-btn.clipboard:hover {
  border-color: #6c757d;
  background: #6c757d;
  color: white;
}

.share-platform-btn.native:hover {
  border-color: #667eea;
  background: #667eea;
  color: white;
}

/* 圖片生成區域 */
.share-image-section {
  border-top: 1px solid #e0e0e0;
  padding-top: 20px;
  margin-top: 20px;
}

.share-image-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.share-image-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.generate-image-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.generate-image-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.generate-image-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.share-image-preview {
  text-align: center;
  padding: 20px;
  border: 2px dashed #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
}

.share-image-preview.has-image {
  border-style: solid;
  background: white;
  padding: 12px;
}

.share-image-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.share-image-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.download-image-btn,
.share-image-btn {
  background: #f8f9fa;
  color: #495057;
  border: 1px solid #dee2e6;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.download-image-btn:hover,
.share-image-btn:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

/* 載入動畫 */
.share-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.share-loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e0e0e0;
  border-top: 2px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 響應式設計 */
@media (max-width: 768px) {
  .share-modal-content {
    margin: 20px;
    padding: 20px;
    border-radius: 12px;
  }

  .share-platforms {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .share-platform-btn {
    padding: 12px 8px;
    min-height: 70px;
    font-size: 12px;
  }

  .share-platform-btn i {
    font-size: 20px;
    margin-bottom: 4px;
  }

  .share-image-actions {
    flex-direction: column;
  }

  .download-image-btn,
  .share-image-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .share-platforms {
    grid-template-columns: repeat(2, 1fr);
  }

  .share-modal-content {
    margin: 10px;
    padding: 16px;
  }
}