/* ============================================================
   nav.css - 资源导航专用样式
   ============================================================ */

.nav-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.nav-main {
    flex: 1;
    min-width: 0;
}
.nav-sidebar {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.nav-category {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    border: 2px solid var(--border);
    background: var(--bg-surface);
    cursor: pointer;
    transition: border-color 0.2s, background 0.15s;
    user-select: none;
    margin-bottom: 2px;
}
.nav-category:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}
.nav-category .cat-left {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-white);
}
.nav-category .toggle-icon {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 10px;
    color: var(--accent);
}
.nav-category .toggle-icon.collapsed {
    transform: rotate(-90deg);
}
.nav-category .badge {
    font-size: 9px;
    padding: 0 6px;
    border: 1px solid var(--border);
    color: var(--text-light);
    border-radius: 2px;
}
.nav-category .cat-count {
    font-size: 9px;
    color: var(--text-light);
    border: 1px solid var(--border);
    padding: 0 8px;
}

.nav-grid-wrap {
    overflow: hidden;
    transition: max-height 0.25s ease;
    max-height: 2000px;
}
.nav-grid-wrap.collapsed {
    max-height: 0 !important;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 12px 6px 8px 6px;
    border: 2px solid var(--border);
    border-top: none;
    background: var(--bg-card);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    border: 2px solid var(--border);
    background: var(--bg-surface);
    text-align: center;
    transition: border-color 0.2s, background 0.15s;
    min-height: 56px;
    cursor: default;
}
.nav-btn.has-link {
    cursor: pointer;
}
.nav-btn.has-link:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}
.nav-btn .label {
    font-size: 10px;
    color: var(--text-white);
    font-weight: bold;
}
.nav-btn .desc {
    font-size: 8px;
    color: var(--text-light);
    margin-top: 1px;
}
.nav-btn .badge-tag {
    font-size: 7px;
    padding: 0 6px;
    border: 1px solid var(--border);
    color: var(--text-light);
    margin-top: 3px;
    border-radius: 2px;
}
.nav-btn .badge-tag.new {
    border-color: var(--accent);
    color: var(--accent);
}
.nav-btn .badge-tag.hot {
    border-color: var(--danger);
    color: var(--danger);
}

.sidebar-ad {
    border: 2px solid var(--border);
    background: var(--bg-card);
    padding: 8px 10px;
    text-align: center;
}
.sidebar-ad .ad-label {
    font-size: 8px;
    color: var(--text-light);
    letter-spacing: 2px;
}
.sidebar-ad img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    margin: 4px 0;
    display: block;
}
.sidebar-ad .ad-text {
    font-size: 8px;
    color: var(--text-light);
}

.sidebar-links {
    border: 2px solid var(--border);
    background: var(--bg-card);
    padding: 10px 12px;
}
.sidebar-links .s-title {
    font-size: 10px;
    color: var(--text-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 4px;
    margin-bottom: 6px;
}
.sidebar-links .s-title .count {
    font-size: 8px;
    color: var(--text-light);
    border: 1px solid var(--border);
    padding: 0 6px;
    border-radius: 2px;
}
.sidebar-link-item {
    display: block;
    font-size: 9px;
    color: var(--text);
    padding: 3px 0;
    border-bottom: 1px solid var(--bg-surface);
    transition: color 0.15s;
}
.sidebar-link-item:hover {
    color: var(--accent);
}
.sidebar-link-item .link-desc {
    font-size: 7px;
    color: var(--text-light);
    margin-left: 4px;
}
.sidebar-link-item.empty {
    color: var(--text-light);
    cursor: default;
    font-size: 8px;
    border-bottom: none;
    padding-top: 4px;
}
.sidebar-link-item.empty:hover {
    color: var(--text-light);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--bg-card);
    border: 2px solid var(--border);
    padding: 22px 26px;
    max-width: 600px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    font-family: var(--font);
}
.modal-box::before {
    content: '╔';
    position: absolute;
    top: -10px;
    left: -4px;
    color: var(--accent);
    font-size: 14px;
}
.modal-box::after {
    content: '╗';
    position: absolute;
    top: -10px;
    right: -4px;
    color: var(--accent);
    font-size: 14px;
}
.modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
    font-family: var(--font);
    transition: color 0.15s;
}
.modal-close:hover {
    color: var(--text-white);
}
.modal-title {
    font-size: 14px;
    color: var(--text-white);
    margin-bottom: 14px;
    font-family: var(--font);
}
.modal-body {
    font-size: 11px;
    color: var(--text);
    font-family: var(--font);
}

.modal-body .share-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin: 6px 0;
}
.modal-body .share-row label {
    font-size: 10px;
    color: var(--text);
    min-width: 60px;
}
.modal-body .share-row input {
    flex: 1;
    min-width: 120px;
}
.modal-body #modalCardCanvas {
    border: 2px solid var(--border);
    max-width: 100%;
    image-rendering: pixelated;
}

@media (max-width: 768px) {
    .nav-layout {
        flex-direction: column;
    }
    .nav-sidebar {
        flex: 1;
        width: 100%;
    }
    .nav-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    .modal-box {
        padding: 16px 18px;
        width: 96%;
    }
}

@media (max-width: 480px) {
    .nav-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 6px;
        padding: 8px 4px 6px 4px;
    }
    .nav-btn {
        padding: 8px 4px;
        min-height: 48px;
    }
    .nav-btn .label {
        font-size: 9px;
    }
    .nav-btn .desc {
        font-size: 7px;
    }
    .nav-category {
        padding: 6px 10px;
    }
    .nav-category .cat-left {
        font-size: 9px;
    }
}