/* =============================================
   HOME PAGE: Redesigned Layout
   ============================================= */

/* =============================================
   HOME PAGE — Redesigned Layout
   温馨 · 高端 · 家庭 / 情侣场景
   ============================================= */

/* ── 页面容器 ── */
.home-shell {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  padding-top: 48px;
  padding-bottom: 80px;
}

/* ── Hero 区 ── */
.home-hero-section {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 56px;
}

.home-hero-inner {
  flex: 1;
  min-width: 0;
}

.home-eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.85;
}

.home-title {
  margin: 0 0 16px;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #8e3f1e 0%, #c06432 40%, #d4865a 70%, #a05030 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* emoji 单独隔离，不受渐变 text-fill 影响 */
.home-title-emoji,
.navbar-brand-emoji {
  -webkit-text-fill-color: initial;
  background: none;
  background-clip: initial;
}

.home-subtitle {
  margin: 0 0 28px;
  font-size: 1.15rem;
  color: var(--muted);
  line-height: 1.65;
}

/* 功能介绍胶囊 */
.home-feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-pill {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.9);
  border: 1px solid rgba(184, 92, 56, 0.18);
  color: var(--brand-dark);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(74, 44, 24, 0.07);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.feature-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(74, 44, 24, 0.12);
  background: rgba(255, 255, 255, 0.98);
}

.feature-pill-button {
  cursor: pointer;
  font: inherit;
}

/* 管理员 stat 卡片组 */
.home-stats-panel {
  display: grid;
  gap: 12px;
  min-width: 200px;
}

/* ── 主内容区 ── */
.home-main {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.home-aside {
  display: grid;
  gap: 18px;
}

/* ── 折叠登录触发器 ── */
.auth-collapse-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-radius: 22px;
  background: rgba(255, 252, 247, 0.92);
  border: 1px solid rgba(184, 92, 56, 0.16);
  box-shadow: 0 8px 24px rgba(74, 44, 24, 0.08);
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.16s ease;
  backdrop-filter: blur(8px);
}

.auth-collapse-trigger:hover {
  box-shadow: 0 12px 32px rgba(74, 44, 24, 0.13);
  border-color: rgba(184, 92, 56, 0.28);
  transform: translateY(-1px);
}

.auth-collapse-trigger.is-open {
  border-color: rgba(184, 92, 56, 0.36);
  box-shadow: 0 14px 36px rgba(74, 44, 24, 0.14);
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.auth-trigger-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-trigger-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.auth-trigger-inner strong {
  display: block;
  font-size: 1rem;
  color: var(--brand-dark);
}

.auth-trigger-inner p {
  margin: 2px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.auth-collapse-arrow {
  font-size: 1.1rem;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.auth-collapse-trigger.is-open .auth-collapse-arrow {
  transform: rotate(180deg);
}

/* 折叠体动画 */
.auth-collapse-body {
  overflow: hidden;
}

.auth-collapse-body:not(.hidden) {
  animation: collapse-reveal 0.22s ease;
}

@keyframes collapse-reveal {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 登录面板 */
.auth-panel {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  margin-top: -1px;
}

/* ── 已登录用户信息面板 ── */
.user-info-panel {
  display: grid;
  gap: 16px;
}

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

.user-info-text h3 {
  margin: 0 0 2px;
  font-size: 1rem;
}

.logout-inline-button {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(166, 59, 50, 0.12);
  color: var(--danger);
  border: 1px solid rgba(166, 59, 50, 0.18);
  font-size: 0.86rem;
  margin-left: auto;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.logout-inline-button:hover {
  background: rgba(166, 59, 50, 0.2);
  border-color: rgba(166, 59, 50, 0.3);
  transform: none;
  filter: none;
}

/* 头像设置折叠 */
.avatar-settings-details {
  border-top: 1px solid rgba(68, 52, 40, 0.08);
  padding-top: 14px;
}

.avatar-settings-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  user-select: none;
  padding: 4px 0;
}

.avatar-settings-summary::-webkit-details-marker {
  display: none;
}

.avatar-settings-summary::before {
  content: "▸ ";
  transition: transform 0.15s ease;
}

.avatar-settings-details[open] .avatar-settings-summary::before {
  content: "▾ ";
}

.avatar-settings-body {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

/* 模块权限折叠 */
.module-vis-details {
  border: 1px solid rgba(68, 52, 40, 0.1);
  border-radius: 14px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.5);
}

.module-vis-summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

.module-vis-summary::-webkit-details-marker {
  display: none;
}

.module-vis-details[open] .home-module-visibility-grid {
  margin-top: 14px;
}

/* ── 空间列表区标题 ── */
.home-space-section {
  min-width: 0;
}

.home-section-head {
  margin-bottom: 24px;
}

.home-section-head h2 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.home-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── 空间方块网格 ── */
.space-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

/* 空间方块卡片 */
.space-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 22px 20px 18px;
  border-radius: 24px;
  background: rgba(255, 252, 247, 0.9);
  border: 1px solid rgba(184, 92, 56, 0.12);
  box-shadow: 0 8px 24px rgba(74, 44, 24, 0.07);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  backdrop-filter: blur(6px);
  text-decoration: none;
  color: inherit;
  min-height: 180px;
  overflow: hidden;
}

.space-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.6) 0%, transparent 60%);
  pointer-events: none;
}

.space-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 48px rgba(74, 44, 24, 0.14);
  border-color: rgba(184, 92, 56, 0.26);
}

.space-tile-locked {
  border-style: dashed;
  opacity: 0.88;
}

.space-tile-icon {
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 2px;
}

.space-tile-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}

.space-tile-owner {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.space-tile-lock {
  font-size: 0.8rem;
  color: var(--brand);
  background: rgba(184, 92, 56, 0.1);
  padding: 3px 8px;
  border-radius: 999px;
}

.space-tile-enter {
  display: inline-flex;
  align-items: center;
  margin-top: auto;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff7f0;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  transition: filter 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
  box-shadow: 0 4px 12px rgba(142, 66, 36, 0.22);
}

.space-tile-enter:hover {
  filter: brightness(1.08);
  transform: translateX(2px);
  box-shadow: 0 6px 18px rgba(142, 66, 36, 0.32);
}

/* 删除按钮（悬停显示） */
.space-tile-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(166, 59, 50, 0.2);
  background: rgba(255, 255, 255, 0.85);
  color: var(--danger);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.18s ease, background 0.15s ease;
  padding: 0;
  box-shadow: none;
  transform: none;
}

.space-tile:hover .space-tile-delete {
  opacity: 1;
}

.space-tile-delete:hover {
  background: rgba(166, 59, 50, 0.14);
  transform: scale(1.1) !important;
  filter: none !important;
}

/* 空状态 */
.space-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 24px;
  border-radius: 24px;
  border: 2px dashed rgba(184, 92, 56, 0.2);
  background: rgba(255, 252, 247, 0.7);
  text-align: center;
}

.space-empty-icon {
  font-size: 2.8rem;
  opacity: 0.7;
}

.space-empty-state h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--muted);
}

.space-empty-state p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  opacity: 0.8;
}

.dropdown-reward-btn {
  width: 100%;
  margin-bottom: 10px;
}

.reward-modal-card {
  max-width: 760px;
}

.reward-modal-copy p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.reward-panel {
  border-radius: 20px;
  padding: 20px;
  background: rgba(255, 252, 247, 0.9);
  border: 1px solid rgba(184, 92, 56, 0.14);
  text-align: center;
}

.reward-panel h3 {
  margin: 0 0 14px;
  color: var(--text);
}

.reward-panel img {
  width: min(100%, 260px);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(184, 92, 56, 0.12);
}

.reward-panel p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  word-break: break-all;
}

/* ── 响应式 ── */
@media (max-width: 980px) {
  .home-main {
    grid-template-columns: 1fr;
  }

  .home-aside {
    order: 2;
  }

  .home-space-section {
    order: 1;
  }

  .home-hero-section {
    flex-direction: column;
    gap: 24px;
    margin-bottom: 36px;
  }

  .home-stats-panel {
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 600px) {
  .home-title {
    font-size: 2.2rem;
  }

  .space-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-stats-panel {
    grid-template-columns: 1fr;
  }

  .reward-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  .space-card-grid {
    grid-template-columns: 1fr;
  }
}
