/* ============================================================
   macOS Desktop Theme - Desktop Icons & Grid
   ============================================================ */

/* 桌面图标容器 - macOS 默认从右侧开始排列 */
.desktop-icons-container {
  position: absolute;
  top: 20px;
  right: 20px;
  display: grid;
  grid-template-columns: repeat(5, 100px);
  grid-auto-rows: 110px;
  gap: 16px;
  z-index: 2;
  direction: rtl;
}

.desktop-icons-container > * {
  direction: ltr;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s var(--macos-transition);
  animation: iconBounceIn 0.5s var(--macos-transition) both;
  user-select: none;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.2);
}

.desktop-icon.selected {
  background: rgba(0, 122, 255, 0.3);
}

.desktop-icon-image {
  width: 64px;
  height: 64px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.desktop-icon-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.icon-placeholder {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #fff 0%, #e0e0e0 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #888;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.desktop-icon-label {
  font-size: 12px;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  line-height: 1.3;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

/* 桌面文章网格 - macOS 风格从右侧开始排列 */
.desktop-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 24px;
  max-width: 900px;
  width: 100%;
  padding: 40px;
  align-content: start;
  justify-content: end;
  direction: rtl;
  margin-left: auto;
}

.desktop-posts-grid > * {
  direction: ltr;
}

.desktop-file-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 12px;
  border-radius: 12px;
  transition: all 0.25s var(--macos-transition);
  animation: fileItemIn 0.5s var(--macos-transition) both;
  user-select: none;
}

.desktop-file-item:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-4px);
}

.desktop-file-item.selected {
  background: rgba(0, 122, 255, 0.35);
}

.file-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.file-icon img.file-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.file-icon-default {
  width: 80px;
  height: 80px;
  background: linear-gradient(145deg, #ffffff, #d4d4d4);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #666;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.file-name {
  font-size: 13px;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  line-height: 1.4;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

/* 分页 */
.desktop-pagination {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  padding: 8px 20px;
  border-radius: 20px;
}

.pagination-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  transition: all 0.2s;
}

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

.pagination-info {
  color: #fff;
  font-size: 14px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* 空状态 */
.desktop-empty {
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.desktop-empty i {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.8;
}

.desktop-empty p {
  font-size: 18px;
  margin-bottom: 8px;
}

.desktop-empty .hint {
  font-size: 14px;
  opacity: 0.7;
}

@keyframes iconBounceIn {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
  }
  60% {
    transform: scale(1.1) translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fileItemIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===== 首页欢迎时钟 ===== */
.desktop-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  animation: welcomeFadeIn 1s ease both;
}

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

.welcome-clock {
  margin-bottom: 20px;
}

.clock-time {
  font-size: 72px;
  font-weight: 200;
  letter-spacing: -2px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.clock-date {
  font-size: 18px;
  font-weight: 400;
  margin-top: 8px;
  opacity: 0.9;
}

.welcome-greeting {
  font-size: 20px;
  font-weight: 400;
  opacity: 0.95;
  animation: greetingPulse 3s ease-in-out infinite;
}

@keyframes greetingPulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; }
}

/* 首页容器调整（左侧有小组件时） */
.home-container {
  justify-content: center !important;
  align-items: center !important;
  padding-left: 320px !important;
  padding-top: 0 !important;
  padding-right: 40px !important;
}

@media (max-width: 900px) {
  .home-container {
    padding-left: 20px !important;
  }
  .clock-time {
    font-size: 48px;
  }
}
