/**
 * 通用组件样式
 * Components CSS - Buttons, Cards, Forms, etc.
 */

/* 统一按钮样式 */
.btn,
button.btn,
input[type="submit"].btn,
.search-btn,
.comment-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-lg);
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn:hover,
button.btn:hover,
input[type="submit"].btn:hover,
.search-btn:hover,
.comment-submit-btn:hover {
  background: #4c63d2;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
}

.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(94, 114, 228, 0.1);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(94, 114, 228, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Toast 消息 - 简洁版 */
.toast-message {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 9999;
  animation: toastFadeIn 0.2s ease;
  pointer-events: none;
  width: auto;
  max-width: 200px;
  white-space: nowrap;
  line-height: 1.2;
  box-sizing: border-box;
  height: auto;
  min-height: auto;
  display: inline-block;
}

.toast-message.toast-hide {
  animation: toastFadeOut 0.2s ease;
  opacity: 0;
}

@keyframes toastFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes toastFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* 分页 */
.pagination-wrapper {
  margin-top: 40px;
  text-align: center;
}

.pagination,
.category-pagination,
.archive-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination .page-numbers,
.category-pagination .page-numbers,
.archive-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  background: white;
  color: var(--text-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
}

.pagination .page-numbers:hover,
.pagination .page-numbers.current,
.category-pagination .page-numbers:hover,
.category-pagination .page-numbers.current,
.archive-pagination .page-numbers:hover,
.archive-pagination .current {
  background: var(--primary-color);
  color: white;
}

/* 空状态 */
.no-posts,
.no-links,
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-posts-icon,
.no-links-icon,
.no-results-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* 标签云 */
.tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-item,
.post-tag,
.link-tag,
.tag-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  background: linear-gradient(135deg, rgba(94, 114, 228, 0.08) 0%, rgba(94, 114, 228, 0.12) 100%);
  color: var(--primary-color);
  border: 1px solid rgba(94, 114, 228, 0.15);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  line-height: 1.2;
}

.tag-item::before,
.post-tag::before,
.link-tag::before {
  content: '#';
  opacity: 0.6;
  font-weight: 600;
}

.tag-item:hover,
.post-tag:hover,
.link-tag:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(94, 114, 228, 0.3);
}

.tag-item:active,
.post-tag:active,
.link-tag:active {
  transform: translateY(0);
}

body.dark-mode .tag-item,
body.dark-mode .post-tag,
body.dark-mode .link-tag {
  background: linear-gradient(135deg, rgba(94, 114, 228, 0.15) 0%, rgba(94, 114, 228, 0.25) 100%);
  border-color: rgba(94, 114, 228, 0.3);
  color: #7c96ff;
}

body.dark-mode .tag-item:hover,
body.dark-mode .post-tag:hover,
body.dark-mode .link-tag:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(94, 114, 228, 0.4);
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
  background: rgba(94, 114, 228, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* 返回顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(94, 114, 228, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #4c63d2;
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(94, 114, 228, 0.5);
}

.back-to-top:active {
  transform: translateY(-2px);
}

.back-to-top svg {
  flex-shrink: 0;
}

body.dark-mode .back-to-top {
  background: rgba(94, 114, 228, 0.9);
}

/* 移动端样式 */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
  }
  
  .back-to-top svg {
    width: 20px;
    height: 20px;
  }
}
