/* ============================================================
   macOS Desktop Theme - Window
   ============================================================ */

.macos-window {
  width: 100%;
  max-width: 1100px;
  height: calc(100vh - var(--macos-statusbar-height) - var(--macos-dock-height) - 60px);
  max-height: 800px;
  background: var(--macos-window-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-radius: var(--macos-radius);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: windowOpen 0.4s var(--macos-transition) both;
  position: relative;
}

.macos-window.minimized {
  animation: windowMinimize 0.4s var(--macos-transition) forwards;
}

.macos-window.maximized {
  width: calc(100vw - 40px);
  max-width: none;
  height: calc(100vh - var(--macos-statusbar-height) - var(--macos-dock-height) - 40px);
  max-height: none;
  border-radius: 12px;
}

/* 窗口标题栏 */
.window-titlebar {
  height: 38px;
  min-height: 38px;
  background: linear-gradient(180deg, #e8e8e8 0%, #d4d4d4 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  padding: 0 12px;
  position: relative;
  user-select: none;
}

.traffic-lights {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 12px;
}

.traffic-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: filter 0.15s;
}

.traffic-light.close {
  background: #ff5f57;
  border: 1px solid #e0443e;
}

.traffic-light.minimize {
  background: #febc2e;
  border: 1px solid #dea123;
}

.traffic-light.maximize {
  background: #28c840;
  border: 1px solid #1aab29;
}

.traffic-lights:hover .traffic-light.close::after {
  content: '×';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  font-size: 10px;
  color: rgba(0, 0, 0, 0.6);
  font-weight: bold;
}

.traffic-lights:hover .traffic-light.minimize::after {
  content: '−';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  font-size: 12px;
  color: rgba(0, 0, 0, 0.6);
  font-weight: bold;
}

.traffic-lights:hover .traffic-light.maximize::after {
  content: '+';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  font-size: 10px;
  color: rgba(0, 0, 0, 0.6);
  font-weight: bold;
}

.window-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.window-controls-right {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.window-btn {
  width: 28px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 13px;
  transition: all 0.15s;
}

.window-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}

/* 窗口工具栏 */
.window-toolbar {
  height: 44px;
  min-height: 44px;
  background: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
}

.toolbar-nav {
  display: flex;
  gap: 4px;
}

.toolbar-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 12px;
  transition: all 0.15s;
}

.toolbar-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #333;
}

.toolbar-path {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #555;
  overflow: hidden;
}

.toolbar-path i {
  color: #888;
  font-size: 12px;
}

.toolbar-path a {
  color: #555;
}

.toolbar-path a:hover {
  color: var(--macos-blue);
}

.path-separator {
  color: #bbb;
}

.path-current {
  color: #333;
  font-weight: 500;
}

.toolbar-actions {
  display: flex;
  gap: 4px;
}

/* 窗口内容 */
.window-content {
  flex: 1 1 0;
  height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(255, 255, 255, 0.5);
}

/* 页面内容 */
.page-content {
  flex: 1;
  padding: 40px 60px;
  overflow-y: auto;
}

/* 归档内容 */
.archive-content,
.category-content,
.tag-content {
  flex: 1;
  padding: 32px 48px;
  overflow-y: auto;
}

.archive-year-group {
  margin-bottom: 24px;
}

.archive-year {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

.archive-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}

.archive-item:hover {
  background: rgba(0, 122, 255, 0.08);
}

.archive-date {
  font-size: 13px;
  color: #888;
  min-width: 60px;
  font-variant-numeric: tabular-nums;
}

.archive-title {
  flex: 1;
  font-size: 15px;
  color: #333;
}

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

.archive-category {
  font-size: 12px;
}

.archive-category a {
  background: rgba(0, 122, 255, 0.1);
  color: var(--macos-blue);
  padding: 3px 10px;
  border-radius: 10px;
}

/* 分类页 */
.category-header,
.tag-header {
  text-align: center;
  margin-bottom: 32px;
}

.category-header h1,
.tag-header h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.category-header p,
.tag-header p {
  color: #888;
  font-size: 14px;
}

.category-post-item {
  display: flex;
  gap: 20px;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.6);
  transition: all 0.2s;
}

.category-post-item:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateX(4px);
}

.post-cover-link {
  width: 160px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.post-cover-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-info {
  flex: 1;
  min-width: 0;
}

.post-info h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.post-info h3 a {
  color: #333;
}

.post-info h3 a:hover {
  color: var(--macos-blue);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: #888;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.post-tags-inline a {
  color: var(--macos-blue);
  margin-right: 6px;
}

.post-excerpt {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 标签页 */
.tag-post-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  transition: background 0.15s;
}

.tag-post-item:hover {
  background: rgba(0, 122, 255, 0.08);
}

.tag-post-date {
  font-size: 13px;
  color: #888;
  min-width: 100px;
}

.tag-post-title {
  font-size: 15px;
  color: #333;
}

.tag-post-title:hover {
  color: var(--macos-blue);
}

/* 通用分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.pagination .pagination-btn {
  width: auto;
  height: auto;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
  color: #333;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination .pagination-btn:hover {
  background: var(--macos-blue);
  color: #fff;
  transform: none;
}

.pagination-info {
  font-size: 14px;
  color: #888;
}

@keyframes windowOpen {
  0% {
    opacity: 0;
    transform: scale(0.85) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes windowMinimize {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.1) translateY(300px);
  }
}

/* 响应式 */
@media (max-width: 768px) {
  .macos-window {
    height: calc(100vh - var(--macos-statusbar-height) - var(--macos-dock-height) - 20px);
    max-height: none;
    border-radius: 8px;
  }

  .window-content {
    flex-direction: column;
  }

  .page-content,
  .archive-content,
  .category-content,
  .tag-content {
    padding: 20px;
  }

  .category-post-item {
    flex-direction: column;
  }

  .post-cover-link {
    width: 100%;
    height: 160px;
  }
}
