/* ============================================================
   macOS Desktop Theme - macOS Overall Style
   ============================================================ */

.macos-body {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.macos-desktop {
  position: absolute;
  top: var(--macos-statusbar-height);
  left: 0;
  right: 0;
  bottom: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

/* 桌面内容容器 */
.window-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

/* 首页时隐藏窗口容器背景 */
.is-home .window-container {
  pointer-events: none;
  justify-content: flex-end;
  align-items: flex-start;
  padding-top: 40px;
  padding-right: 60px;
}

.is-home .window-container > * {
  pointer-events: auto;
}

/* 桌面小部件 */
.desktop-widgets {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 280px;
  max-height: calc(100vh - var(--macos-statusbar-height) - var(--macos-dock-height) - 60px);
  overflow-y: auto;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.widget {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--macos-radius);
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
  animation: widgetFadeIn 0.5s var(--macos-transition) both;
}

.widget-title {
  padding: 12px 16px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.widget-content {
  padding: 0 16px 16px;
}

/* Profile Widget */
.profile-widget .widget-content {
  text-align: center;
  padding: 20px 16px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 28px;
}

.profile-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.profile-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
  line-height: 1.5;
}

.profile-social {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.social-link {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: #333;
  font-size: 14px;
  transition: all 0.2s var(--macos-transition);
}

.social-link:hover {
  background: var(--macos-blue);
  color: #fff;
  transform: translateY(-2px);
}

/* Recent Posts Widget */
.recent-list li,
.category-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.recent-list li:last-child,
.category-list li:last-child {
  border-bottom: none;
}

.recent-list a,
.category-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #333;
}

.recent-list a:hover,
.category-list a:hover {
  color: var(--macos-blue);
}

.recent-list i,
.category-list i {
  color: #999;
  font-size: 12px;
  width: 16px;
}

.category-list .count {
  margin-left: auto;
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: #666;
}

/* Tag Cloud Widget */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud-item {
  padding: 4px 10px;
  background: rgba(0, 122, 255, 0.1);
  border-radius: 12px;
  color: var(--macos-blue);
  font-size: 12px;
  transition: all 0.2s var(--macos-transition);
}

.tag-cloud-item:hover {
  background: var(--macos-blue);
  color: #fff;
}

/* Archive Widget */
.archive-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #333;
}

.archive-link:hover {
  color: var(--macos-blue);
}

.archive-link .count {
  margin-left: auto;
  background: var(--macos-blue);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

@keyframes widgetFadeIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 回到顶部 */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: calc(var(--macos-dock-height) + 24px);
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--macos-transition);
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: #333;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--macos-blue);
  color: #fff;
  transform: translateY(-2px);
}

/* 阅读进度条 */
.reading-progress {
  position: fixed;
  top: var(--macos-statusbar-height);
  left: 0;
  height: 3px;
  background: var(--macos-blue);
  width: 0;
  z-index: 1001;
  transition: width 0.1s linear;
}

/* 搜索覆盖层 */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--macos-transition);
}

.search-overlay.active {
  opacity: 1;
  visibility: visible;
}

.search-panel {
  width: 90%;
  max-width: 600px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(-20px) scale(0.95);
  transition: transform 0.3s var(--macos-transition);
}

.search-overlay.active .search-panel {
  transform: translateY(0) scale(1);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  gap: 12px;
}

.search-icon {
  color: #999;
  font-size: 18px;
}

.search-input-wrapper input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 18px;
  background: transparent;
  font-family: inherit;
}

.search-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.search-close:hover {
  background: rgba(0, 0, 0, 0.15);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

.search-hint {
  padding: 40px 20px;
  text-align: center;
  color: #999;
  font-size: 14px;
}

.search-hint i {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.search-result-item {
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: rgba(0, 122, 255, 0.1);
}

.search-result-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}

.search-result-meta {
  font-size: 12px;
  color: #999;
}

/* 点击特效 */
.click-effect {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  animation: clickFloat 0.8s ease-out forwards;
  color: #FF6B6B;
  font-size: 20px;
}

@keyframes clickFloat {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -100px) scale(1.5);
  }
}
