/* =========================================
 * 米米工具站 — 首页 + 详情页布局样式(蛙蛙工具风)
 * 顶栏(70px)+ 左固定深色栏(220px)+ 中部 + 右固定栏(220px)
 * ========================================= */

/* ========== 全局微调 ========== */
body {
    transition: background-color .2s, color .2s;
}

/* ========== 三列布局壳 ========== */
.home-shell {
    display: block;
    margin: 0;
    padding: 0;
}

.home-shell__main {
    margin-left: 220px;
    margin-right: 220px;
    padding: 18px 24px 30px;
    min-height: calc(100vh - 70px);
}

/* ========== 左侧分类导航(浅色固定) ========== */
.home-shell__left {
    position: fixed;
    left: 0;
    top: 70px;
    width: 220px;
    height: calc(100vh - 70px);
    background: var(--mi-card);
    border-right: 1px solid var(--mi-border);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 90;
    color: var(--mi-text-secondary);
    -webkit-font-smoothing: antialiased;
}

.home-shell__left::-webkit-scrollbar {
    width: 6px;
}

.home-shell__left::-webkit-scrollbar-thumb {
    background: var(--mi-border);
    border-radius: 3px;
}

.home-shell__left::-webkit-scrollbar-thumb:hover {
    background: var(--mi-border-strong);
}

.left-nav__brand {
    text-align: center;
    padding: 16px 12px 14px;
    border-bottom: 1px solid var(--mi-border);
}

.left-nav__logo {
    display: inline-flex;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffd9b3, #ea8606);
    color: #fff;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

.left-nav__name {
    color: var(--mi-text);
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.left-nav__tip {
    color: var(--mi-text-muted);
    font-size: 11px;
    margin: 1px 0 0;
}

/* dl/dt/dd 折叠菜单 */
.left-menu {
    padding: 4px 0 24px;
}

.left-menu .link {
    text-align: center;
    padding: 0;
}

.left-menu .link a {
    display: block;
    padding: 8px 12px;
    color: var(--mi-text-secondary);
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid var(--mi-border);
    transition: color .15s, background .15s;
}

.left-menu .link a:hover {
    color: var(--mi-primary);
    background: var(--mi-primary-soft);
}

.left-menu .link a.is-active {
    color: var(--mi-primary);
    background: var(--mi-primary-soft);
    font-weight: 600;
}

.left-menu dl {
    margin: 0;
    padding: 0;
}

.left-menu dt {
    color: var(--mi-text-secondary);
    cursor: pointer;
    text-align: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--mi-border);
    font-size: 13px;
    user-select: none;
    transition: all .15s;
    margin: 0;
}

.left-menu dt:hover {
    color: var(--mi-primary);
    background: var(--mi-primary-soft);
}

.left-menu dt.is-current {
    color: var(--mi-primary);
    background: var(--mi-primary-soft);
    font-weight: 600;
    border-bottom-color: var(--mi-primary-soft-2);
}

.left-menu dd {
    display: none;
    padding: 8px 0 10px;
    background: #fafafa;
    border-bottom: 1px solid var(--mi-border);
    margin: 0;
}

.left-menu dt.is-current + dd,
.left-menu dd.is-open {
    display: block;
}

.left-menu dd ul {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: center;
}

.left-menu dd li {
    line-height: 1.8;
    margin: 0;
}

.left-menu dd li a {
    display: inline-block;
    color: var(--mi-text-secondary);
    text-decoration: none;
    font-size: 12.5px;
    padding: 2px 10px;
    transition: color .15s;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.left-menu dd li a:hover {
    color: var(--mi-primary);
}

.left-menu dd li.is-current a {
    color: var(--mi-primary);
    font-weight: 600;
}

.left-menu dd li.left-menu__more a {
    color: var(--mi-text-muted);
    font-size: 11.5px;
    padding-top: 6px;
}

/* 暗黑模式下左栏色阶 */
body.dark .home-shell__left {
    background: #171717;
    border-right-color: #2a2a2a;
    color: #b8b8b8;
}

body.dark .home-shell__left::-webkit-scrollbar-thumb {
    background: #333;
}

body.dark .home-shell__left::-webkit-scrollbar-thumb:hover {
    background: #555;
}

body.dark .left-nav__brand {
    border-bottom-color: #2a2a2a;
}

body.dark .left-nav__name {
    color: #fff;
}

body.dark .left-nav__tip {
    color: #777;
}

body.dark .left-menu .link a {
    color: #b8b8b8;
    border-bottom-color: #1f1f1f;
}

body.dark .left-menu .link a:hover,
body.dark .left-menu .link a.is-active {
    color: var(--mi-primary);
    background: rgba(234, 134, 6, .12);
}

body.dark .left-menu dt {
    color: #b8b8b8;
    border-bottom-color: #1f1f1f;
}

body.dark .left-menu dt:hover {
    color: #fff;
    background: rgba(255, 255, 255, .04);
}

body.dark .left-menu dt.is-current {
    color: #fff;
    background: #1f1f1f;
    border-bottom-color: #333;
}

body.dark .left-menu dd {
    background: #2c2c2c;
    border-bottom-color: #333;
}

body.dark .left-menu dd li a {
    color: #b8b8b8;
}

body.dark .left-menu dd li a:hover,
body.dark .left-menu dd li.is-current a {
    color: var(--mi-primary);
}

body.dark .left-menu dd li.left-menu__more a {
    color: #888;
}

/* ========== 右侧固定栏(浅色) ========== */
.home-shell__right {
    position: fixed;
    right: 0;
    top: 70px;
    width: 220px;
    height: calc(100vh - 70px);
    background: var(--mi-card);
    border-left: 1px solid var(--mi-border);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    z-index: 90;
}

.home-shell__right::-webkit-scrollbar {
    width: 6px;
}

.home-shell__right::-webkit-scrollbar-thumb {
    background: var(--mi-border);
    border-radius: 3px;
}

/* 通用 widget */
.widget {
    background: var(--mi-card);
    border: 1px solid var(--mi-border);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.widget__head {
    padding: 8px 12px;
    border-bottom: 1px solid var(--mi-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--mi-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.widget__head::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 12px;
    background: var(--mi-primary);
    border-radius: 2px;
}

.widget__body {
    padding: 10px 12px;
}

/* 日期 widget */
.widget-date {
    border: 2px dotted #ffd08d;
    text-align: center;
    padding: 12px 8px;
    background: #fffbf3;
    border-radius: 10px;
    color: #9d5d01;
    margin-bottom: 12px;
}

body.dark .widget-date {
    border-color: #4a3018;
    background: #2a1f12;
    color: #ffd08d;
}

.widget-date__year {
    font-size: 11px;
    margin: 0;
    opacity: .85;
}

.widget-date__date {
    font-size: 16px;
    font-weight: 700;
    margin: 4px 0 2px;
}

.widget-date__day {
    font-size: 12px;
    margin: 0;
    opacity: .85;
}

/* 便签 widget */
.widget-notes textarea {
    width: 100%;
    min-height: 110px;
    border: 1px solid var(--mi-border);
    border-radius: 6px;
    padding: 8px;
    font-size: 12px;
    color: var(--mi-text);
    background: var(--mi-bg);
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
    box-shadow: none;
    box-sizing: border-box;
}

.widget-notes textarea:focus {
    border-color: var(--mi-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(234, 134, 6, .12);
}

/* 迷你搜索 */
.widget-search__input {
    width: 100%;
    height: 32px;
    padding: 4px 8px;
    border: 1px solid var(--mi-border);
    border-radius: 6px;
    font-size: 12px;
    margin: 0 0 6px;
    background: var(--mi-card);
    color: var(--mi-text);
    box-shadow: none;
    box-sizing: border-box;
}

.widget-search__input:focus {
    border-color: var(--mi-primary);
    outline: none;
}

.widget-search__btn {
    width: 100%;
    background: var(--mi-primary);
    color: #fff;
    border: 1px solid var(--mi-primary);
    border-radius: 6px;
    padding: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.5;
    transition: background .15s;
}

.widget-search__btn:hover {
    background: var(--mi-primary-hover);
    border-color: var(--mi-primary-hover);
    color: #fff;
}

/* 推荐工具 */
.widget-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.widget-list__item {
    padding: 5px 0;
    border-bottom: 1px dashed var(--mi-border);
    font-size: 12px;
    line-height: 1.4;
}

.widget-list__item:last-child {
    border-bottom: none;
}

.widget-list__item a {
    color: var(--mi-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}

.widget-list__item a:hover {
    color: var(--mi-primary);
}

.widget-list__item a .fa {
    color: #ef4444;
    font-size: 10px;
    flex-shrink: 0;
}

.widget-list__item a span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* 反馈链接 */
.widget-feedback {
    display: block;
    background: linear-gradient(135deg, var(--mi-primary-soft), var(--mi-primary-soft-2));
    border: 1px solid var(--mi-primary-soft-2);
    border-radius: 10px;
    text-align: center;
    color: var(--mi-primary);
    font-size: 12px;
    text-decoration: none;
    padding: 10px;
    margin-bottom: 12px;
    transition: all .15s;
}

.widget-feedback:hover {
    background: linear-gradient(135deg, var(--mi-primary-soft-2), var(--mi-primary-soft));
    color: var(--mi-primary-hover);
}

/* ========== 右下角浮动按钮组 ========== */
.scroll-nav {
    position: fixed;
    right: 232px;
    bottom: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.scroll-nav__btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--mi-card);
    border: 1px solid var(--mi-border);
    color: var(--mi-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    box-shadow: var(--mi-shadow-md);
    position: relative;
}

.scroll-nav__btn:hover {
    background: var(--mi-primary);
    color: #fff;
    border-color: var(--mi-primary);
    transform: translateY(-1px);
}

.scroll-nav__btn .fa {
    font-size: 14px;
}

#scroll-go-top {
    display: none;
}

#scroll-go-top.is-visible {
    display: flex;
}

.scroll-nav__btn::after {
    content: attr(data-tip);
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, .8);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}

.scroll-nav__btn:hover::after {
    opacity: 1;
}

/* ========== 欢迎条 ========== */
.welcome-bar {
    background: linear-gradient(135deg, #fff7ed, #ffeacf);
    border: 1px solid #f5d4a7;
    border-radius: 10px;
    padding: 12px 18px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--mi-text);
    line-height: 1.7;
    display: flex;
    align-items: center;
    gap: 8px;
}

body.dark .welcome-bar {
    background: linear-gradient(135deg, #2a2014, #3a2818);
    border-color: #4a3520;
    color: var(--mi-text);
}

.welcome-bar__main {
    flex: 1;
}

.welcome-bar__rocket {
    font-size: 18px;
    flex-shrink: 0;
}

/* ========== Section 卡 ========== */
.section-block {
    background: var(--mi-card);
    border: 1px solid var(--mi-border);
    border-radius: 10px;
    padding: 14px 16px 16px;
    margin-bottom: 12px;
    scroll-margin-top: 80px;
}

.section-block__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.section-block__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--mi-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-block__title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 14px;
    background: var(--mi-primary);
    border-radius: 2px;
}

.section-block__hot {
    background: linear-gradient(135deg, #ff5757, #ff3030);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
    line-height: 1.6;
}

.section-block__more {
    margin-left: auto;
    font-size: 12px;
    color: var(--mi-text-muted);
    text-decoration: none;
    transition: color .15s;
}

.section-block__more:hover {
    color: var(--mi-primary);
}

/* ========== 工具卡 ========== */
.tool-grid-v2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.tool-card-v2 {
    position: relative;
    background: var(--mi-card);
    border: 1px solid var(--mi-border);
    border-radius: 8px;
    transition: all .15s;
    min-height: 78px;
    overflow: hidden;
}

.tool-card-v2:hover {
    border-color: var(--mi-primary);
    box-shadow: 0 2px 8px rgba(234, 134, 6, .1);
    transform: translateY(-1px);
}

.tool-card-v2__main {
    display: flex;
    flex-direction: column;
    padding: 11px 36px 11px 12px;
    text-decoration: none;
    color: var(--mi-text);
    height: 100%;
}

.tool-card-v2__main:hover {
    color: var(--mi-text);
}

.tool-card-v2__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.tool-card-v2__icon {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.tool-card-v2__name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--mi-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tool-card-v2:hover .tool-card-v2__name {
    color: var(--mi-primary);
}

.tool-card-v2__heart {
    position: absolute;
    top: 11px;
    right: 12px;
    z-index: 2;
    color: var(--mi-text-muted);
    font-size: 13px;
    transition: color .15s;
    cursor: pointer;
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 4px;
    text-decoration: none;
    line-height: 1;
}

.tool-card-v2__heart:hover {
    color: #ef4444;
}

.tool-card-v2__heart--on {
    color: #ef4444;
}

.tool-card-v2__desc {
    font-size: 12px;
    color: var(--mi-text-muted);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0;
}

/* ========== 颜色循环 ========== */
.icon-c0 { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.icon-c1 { background: linear-gradient(135deg, #34d399, #059669); }
.icon-c2 { background: linear-gradient(135deg, #fbbf24, #d97706); }
.icon-c3 { background: linear-gradient(135deg, #f87171, #dc2626); }
.icon-c4 { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.icon-c5 { background: linear-gradient(135deg, #f472b6, #db2777); }
.icon-c6 { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.icon-c7 { background: linear-gradient(135deg, #fb923c, #ea580c); }

/* ========== 详情页面板 ========== */
.related-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.related-chips a {
    display: inline-block;
    padding: 6px 12px;
    background: var(--mi-card);
    border: 1px solid var(--mi-border);
    border-radius: 16px;
    color: var(--mi-text-secondary);
    text-decoration: none;
    font-size: 12px;
    transition: all .15s;
}

.related-chips a:hover {
    border-color: var(--mi-primary);
    color: var(--mi-primary);
    background: var(--mi-primary-soft);
}

.related-chips a.is-active {
    background: var(--mi-primary);
    border-color: var(--mi-primary);
    color: #fff;
}

.detail-block {
    background: var(--mi-card);
    border: 1px solid var(--mi-border);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.detail-block__head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--mi-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.detail-block__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--mi-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-block__title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 16px;
    background: var(--mi-primary);
    border-radius: 2px;
}

.detail-block__actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.detail-block__action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--mi-card);
    border: 1px solid var(--mi-border);
    border-radius: 14px;
    font-size: 12px;
    text-decoration: none;
    color: var(--mi-text-secondary);
    transition: all .15s;
}

.detail-block__action:hover {
    border-color: var(--mi-primary);
    color: var(--mi-primary);
    background: var(--mi-primary-soft);
}

.detail-block__action--collect {
    color: #ef4444;
    border-color: #fecaca;
}

.detail-block__action--collect:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #ef4444;
}

.detail-block__action--collect.is-on {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

.detail-block__action--collect.is-on:hover {
    background: #dc2626;
    color: #fff;
}

.detail-block__action--share {
    color: #3b82f6;
    border-color: #dbeafe;
}

.detail-block__action--share:hover {
    background: #eff6ff;
    color: #2563eb;
    border-color: #3b82f6;
}

.detail-block__body {
    padding: 16px 18px;
}

/* ========== 暗黑模式覆盖 ========== */
body.dark .tool-card-v2 {
    background: var(--mi-card);
}

body.dark .tool-card-v2:hover {
    box-shadow: 0 2px 8px rgba(234, 134, 6, .2);
}

body.dark .section-block {
    background: var(--mi-card);
}

body.dark .detail-block {
    background: var(--mi-card);
}

body.dark .detail-block__action--collect {
    background: var(--mi-card);
    border-color: rgba(239, 68, 68, .4);
}

body.dark .detail-block__action--share {
    background: var(--mi-card);
    border-color: rgba(59, 130, 246, .4);
}

body.dark .scroll-nav__btn {
    background: var(--mi-card);
}

body.dark .widget {
    background: var(--mi-card);
}

body.dark .widget-search__input {
    background: var(--mi-bg);
}

body.dark .widget-notes textarea {
    background: var(--mi-bg);
}

/* ========== 响应式 ========== */
@media (max-width: 1199px) {
    .home-shell__main { padding: 16px 18px 24px; }
    .tool-grid-v2 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 991px) {
    .home-shell__right { display: none; }
    .home-shell__main { margin-right: 0; }
    .scroll-nav { right: 16px; }
    .tool-grid-v2 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767px) {
    .home-shell__left { display: none; }
    .home-shell__main {
        margin-left: 0;
        margin-right: 0;
        padding: 12px;
    }
    .tool-grid-v2 { grid-template-columns: repeat(2, 1fr); }
    .section-block { padding: 12px; }
    .welcome-bar { padding: 10px 12px; font-size: 12px; }
    .scroll-nav { right: 12px; bottom: 12px; }
}

@media (max-width: 480px) {
    .tool-grid-v2 { grid-template-columns: 1fr; }
}

/* ========== with-shell footer 不再需要约束(原来在的样式继续保留兼容) ========== */
body.with-shell footer {
    margin-left: 220px;
    margin-right: 220px;
}

@media (max-width: 991px) {
    body.with-shell footer {
        margin-left: 220px;
        margin-right: 0;
    }
}

@media (max-width: 767px) {
    body.with-shell footer {
        margin-left: 0;
        margin-right: 0;
    }
}
