/* ============================================================
   首页样式 —— 对齐 lanhu_ai 设计稿
   配色：紫渐变 #552FF4 → #964CF6（标题），按钮 #DA83F2 → #7D72FB
   ============================================================ */

/* ============ 主区背景：AI 抽象图铺满侧边栏右侧整个区域 ============
   layout 的 body = sidebar + .content，没有 .main 元素，且 .content 受
   max-width:100rem 限制。把背景挂在 body 上，从侧边栏右沿铺到视口右边，
   body 的 padding-left 正好等于 --sidebar-w，背景左对齐内容区起始位置。
   用分项属性 + !important 防止 common.css 的 body{background:...} shorthand
   把 background-image 清掉。 */
body {
    background-color: #FBFBFD !important;
    background-image: url("/img/home-hero-bg.png") !important;
    background-repeat: no-repeat !important;
    background-position: var(--sidebar-w) top !important;
    background-size: calc(100% - var(--sidebar-w)) auto !important;
    background-attachment: scroll !important;
}
/* 平板：侧边栏收起为图标栏 */
@media (max-width: 1023px) {
    body {
        background-position: var(--sidebar-w-mid) top !important;
        background-size: calc(100% - var(--sidebar-w-mid)) auto !important;
    }
}
/* 手机：侧边栏转抽屉，背景铺满整宽 */
@media (max-width: 767px) {
    body {
        background-position: top !important;
        background-size: 100% auto !important;
    }
}

/* ============ Hero 区（透明，文字直接落在 .content 背景图上） ============ */
.hero {
    margin-bottom: 2.5rem;
    padding: 3.25rem 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    animation: heroFadeUp 0.6s var(--ease) both;
}
@keyframes heroFadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.hero__inner { width: 100%; max-width: 44rem; }
/* 标题：设计稿紫色渐变 #552FF4 → #964CF6 */
.hero__title {
    font-size: clamp(2rem, 1.2rem + 2.8vw, 2.75rem);
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 0.4rem;
    background-image: linear-gradient(180deg, #552FF4 0%, #964CF6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.02em;
}
.hero__subtitle {
    font-size: clamp(1.6rem, 1rem + 1.8vw, 2.1rem);
    font-weight: 700;
    color: #333;
    line-height: 1.2;
    margin: 0 0 1rem;
}
.hero__desc {
    font-size: 0.875rem;
    line-height: 1.7;
    color: #8A88A5;
    margin: 0 0 1.75rem;
    max-width: 30rem;
}
/* 搜索框：设计稿 980×58，白底，圆角 29px */
.search {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border-radius: 29px;
    width: 980px;
    max-width: 100%;
    height: 58px;
    padding: 0 6px 0 30px;
    box-shadow: 0 8px 24px rgba(48, 42, 65, 0.12);
    transition: box-shadow 0.25s var(--ease);
}
.search:focus-within { box-shadow: 0 8px 28px rgba(85, 47, 244, 0.22); }
.search img { width: 18px; height: 18px; opacity: 0.6; flex-shrink: 0; margin-right: 10px; }
.search input {
    flex: 1; border: none; outline: none;
    font-size: 14px; background: transparent; color: #333;
    min-width: 0; height: 100%;
}
.search input::placeholder { color: #B6B6B6; }
/* 搜索按钮：设计稿 80×46，渐变 -25deg，圆角 23px */
.search button {
    width: 80px; height: 46px;
    background: linear-gradient(-25deg, #DA83F2 0%, #7D72FB 100%);
    color: #fff; border: none;
    border-radius: 23px;
    font-size: 14px; font-weight: 500;
    cursor: pointer; white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.2s var(--ease), transform 0.15s var(--ease);
}
.search button:hover { opacity: 0.92; }
.search button:active { transform: scale(0.96); }

@media (max-width: 767px) {
    .search { width: 100%; padding: 0 4px 0 18px; }
    .search img { width: 16px; height: 16px; }
}

/* ============ 区块标题（图标 + 标题 + 查看更多） ============ */
.section { margin-bottom: 2.25rem; }
.section__head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem;
}
.section__head-left {
    display: flex; align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}
.section__head-left::before {
    content: ""; width: 1.125rem; height: 1.375rem;
    background: url("/img/home-agent.png") center / contain no-repeat;
    flex-shrink: 0;
}
/* 热门推荐标题图标用 home-hot.png */
.section--hot .section__head-left::before {
    background-image: url("/img/home-hot.png");
}
.section__title {
    font-size: 1.125rem; font-weight: 700; color: var(--c-text);
    line-height: 1.4;
}
.section__more {
    font-size: 0.8rem; color: var(--c-text-sub);
    display: flex; align-items: center; gap: 0.2rem;
    transition: color 0.15s var(--ease), gap 0.15s var(--ease);
}
.section__more::after { content: "›"; font-size: 1.1rem; line-height: 1; }
.section__more:hover { color: var(--c-primary); gap: 0.4rem; }

/* ============ 二级分类 tab 条 ============ */
.section__tabs {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 0.15rem 0;
    max-width: 100%;
}
.section__tabs::-webkit-scrollbar { height: 0; }
.section__tab {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.3rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.78rem;
    color: var(--c-text-sub);
    background: #f4f2f8;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.section__tab:hover { background: var(--c-primary-soft); color: var(--c-primary); }
.section__tab.active {
    background: linear-gradient(90deg, #6c5ce7 0%, #964cf6 100%);
    color: #fff;
    box-shadow: 0 3px 10px rgba(108, 92, 231, 0.3);
}

/* tab panel：默认隐藏，active 显示 */
.section__panels .panel { display: none; }
.section__panels .panel.active { display: grid; }

/* ============ 卡片网格（设计稿：6 列，每行 6 个） ============ */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1.25rem;
}

/* 卡片：白底 + 10px 圆角 + 浅阴影；进入视区淡入 */
.card {
    background: var(--c-bg);
    border: 1px solid transparent;
    border-radius: 0.625rem;
    padding: 1rem;
    display: flex; align-items: center; gap: 0.75rem;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(48, 42, 65, 0.18);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
    opacity: 0;
    transform: translateY(12px);
}
.card.in-view { animation: cardFadeUp 0.5s var(--ease) forwards; }
@keyframes cardFadeUp {
    to { opacity: 1; transform: translateY(0); }
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(48, 42, 65, 0.22);
}
.card.selected { border-color: var(--c-primary); }
.card__icon {
    width: 2.5rem; height: 2.5rem;
    border-radius: 0.5rem;
    background: #efeff1;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; overflow: hidden;
    transition: transform 0.25s var(--ease);
}
.card__icon img { width: 100%; height: 100%; object-fit: contain; }
.card:hover .card__icon { transform: scale(1.08); }
.card__body { min-width: 0; flex: 1; overflow: hidden; }
.card__name {
    font-size: 0.95rem; font-weight: 600; color: #333;
    margin-bottom: 0.15rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card__desc {
    font-size: 0.75rem; color: #969ba4;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.grid-empty {
    grid-column: 1 / -1;
    text-align: center; padding: 2rem; color: var(--c-text-sub); font-size: 0.875rem;
}

/* ============ 响应式 ============ */
@media (max-width: 1023px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
}
@media (max-width: 767px) {
    .grid { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
}

/* ============ 二级分类切换：加载中占位 ============ */
.grid-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.5rem 1rem;
    min-height: 10rem;
}
.grid-loading__spinner {
    width: 1.75rem;
    height: 1.75rem;
    border: 3px solid var(--c-primary-soft, #efeff1);
    border-top-color: var(--c-primary, #6c5ce7);
    border-radius: 50%;
    animation: gridSpin 0.7s linear infinite;
}
.grid-loading__text {
    font-size: 0.85rem;
    color: var(--c-text-sub, #969ba4);
}
@keyframes gridSpin {
    to { transform: rotate(360deg); }
}
