/**
 * V2 spend category tree (home aside)
 */

.v2-home-aside .v2-cat-panel, .classic-home-aside .v2-cat-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-right: none;
    box-shadow: none;
}

.v2-home-aside .v2-cat-panel__header, .classic-home-aside .v2-cat-panel__header {
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--v2-border);
    flex-shrink: 0;
}

.v2-home-aside .v2-cat-panel__title, .classic-home-aside .v2-cat-panel__title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--v2-text);
    letter-spacing: -0.01em;
}

.v2-home-aside .v2-cat-panel__subtitle, .classic-home-aside .v2-cat-panel__subtitle {
    margin: 0 0 14px;
    font-size: 12px;
    color: var(--v2-text-secondary);
    line-height: 1.4;
}

.v2-home-aside .v2-cat-search-wrap, .classic-home-aside .v2-cat-search-wrap {
    position: relative;
    margin-bottom: 10px;
}

.v2-home-aside .v2-cat-search-icon, .classic-home-aside .v2-cat-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--v2-text-muted);
    pointer-events: none;
    display: flex;
}

.v2-home-aside .v2-cat-search-input, .classic-home-aside .v2-cat-search-input {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 36px;
    font-family: inherit;
    font-size: 13px;
    border: 1px solid var(--v2-border-strong);
    border-radius: var(--v2-radius);
    background: var(--v2-surface);
    color: var(--v2-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.v2-home-aside .v2-cat-search-input::placeholder, .classic-home-aside .v2-cat-search-input::placeholder {
    color: var(--v2-text-muted);
}

.v2-home-aside .v2-cat-search-input:focus, .classic-home-aside .v2-cat-search-input:focus {
    border-color: var(--v2-primary);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.12);
}

.v2-home-aside .v2-cat-toolbar, .classic-home-aside .v2-cat-toolbar {
    display: flex;
    gap: 4px;
}

.v2-home-aside .v2-cat-toolbar .v2-btn-ghost, .classic-home-aside .v2-cat-toolbar .v2-btn-ghost {
    flex: 1;
    justify-content: center;
    height: 32px;
    font-size: 12px;
}

.v2-home-aside .v2-cat-meta, .classic-home-aside .v2-cat-meta {
    margin: 0;
    padding: 10px 18px;
    font-size: 12px;
    font-weight: 500;
    color: var(--v2-text-muted);
    border-bottom: 1px solid var(--v2-border);
    background: #fafbfc;
    flex-shrink: 0;
}

.v2-home-aside .v2-cat-scroll, .classic-home-aside .v2-cat-scroll {
    flex: 1;
    overflow-x: hidden;
    overflow-y: visible;
    overscroll-behavior: auto;
    padding: 8px 0 14px;
    min-height: 0;
    position: relative;
}

.v2-home-aside .v2-cat-scroll.is-scrollable, .classic-home-aside .v2-cat-scroll.is-scrollable {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.v2-cat-scroll-hint {
    position: sticky;
    bottom: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: fit-content;
    margin: 14px auto 6px;
    padding: 9px 16px;
    border: 1px solid rgba(186, 230, 253, 0.9);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--v2-primary, #005f9c);
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    pointer-events: none;
}

.v2-cat-scroll-hint::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -18px;
    width: min(280px, 100%);
    height: 72px;
    transform: translateX(-50%);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.82) 42%, rgba(255, 255, 255, 0.98));
    pointer-events: none;
    z-index: -1;
}

.v2-cat-scroll-hint__icon {
    flex-shrink: 0;
    animation: v2-cat-scroll-hint-bounce 1.2s ease-in-out infinite;
}

.v2-cat-scroll-hint[hidden] {
    display: none !important;
}

@keyframes v2-cat-scroll-hint-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

.v2-home-aside .v2-cat-tree, .classic-home-aside .v2-cat-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.v2-home-aside .v2-cat-node, .classic-home-aside .v2-cat-node {
    user-select: none;
}

.v2-home-aside .v2-cat-row, .classic-home-aside .v2-cat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 4px 10px;
    margin: 1px 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--v2-text);
    border-radius: var(--v2-radius-sm);
    transition: background 0.12s ease;
}

.v2-home-aside .v2-cat-row:hover, .classic-home-aside .v2-cat-row:hover {
    background: #f3f4f6;
}

.v2-home-aside .v2-cat-row.is-selected, .classic-home-aside .v2-cat-row.is-selected {
    background: var(--v2-primary-muted);
    color: var(--v2-primary);
}

.v2-home-aside .v2-cat-row.is-match:not(.is-selected), .classic-home-aside .v2-cat-row.is-match:not(.is-selected) {
    background: var(--v2-primary-soft);
}

.v2-home-aside .v2-cat-toggle, .classic-home-aside .v2-cat-toggle {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--v2-text-muted);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--v2-radius-sm);
    transition: background 0.12s, color 0.12s, transform 0.15s ease;
}

.v2-home-aside .v2-cat-toggle:hover, .classic-home-aside .v2-cat-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--v2-text-secondary);
}

.v2-home-aside .v2-cat-toggle svg, .classic-home-aside .v2-cat-toggle svg {
    transition: transform 0.15s ease;
}

.v2-home-aside .v2-cat-toggle.is-expanded svg, .classic-home-aside .v2-cat-toggle.is-expanded svg {
    transform: rotate(90deg);
}

.v2-home-aside .v2-cat-toggle--leaf, .classic-home-aside .v2-cat-toggle--leaf {
    visibility: hidden;
    pointer-events: none;
}

.v2-home-aside .v2-cat-label, .classic-home-aside .v2-cat-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
    font-weight: 500;
}

.v2-home-aside .v2-cat-row.is-selected .v2-cat-label, .classic-home-aside .v2-cat-row.is-selected .v2-cat-label {
    font-weight: 600;
}

.v2-home-aside .v2-cat-count, .classic-home-aside .v2-cat-count {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--v2-text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 1ch;
    text-align: right;
}

.v2-home-aside .v2-cat-row.is-selected .v2-cat-count, .classic-home-aside .v2-cat-row.is-selected .v2-cat-count {
    color: var(--v2-primary);
    opacity: 0.85;
}

.v2-home-aside .v2-cat-count--zero, .classic-home-aside .v2-cat-count--zero {
    opacity: 0.45;
}

.v2-home-aside .v2-cat-children, .classic-home-aside .v2-cat-children {
    list-style: none;
    margin: 0;
    padding: 0;
}

.v2-home-aside .v2-cat-children[hidden], .classic-home-aside .v2-cat-children[hidden] {
    display: none;
}

.v2-home-aside .v2-cat-loading,
.classic-home-aside .v2-cat-loading,
.v2-home-aside .v2-cat-error, .classic-home-aside .v2-cat-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 18px;
    text-align: center;
    font-size: 13px;
    color: var(--v2-text-secondary);
}

.v2-home-aside .v2-cat-error, .classic-home-aside .v2-cat-error {
    color: var(--v2-danger);
}

.v2-home-aside .v2-cat-spinner, .classic-home-aside .v2-cat-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid var(--v2-border);
    border-top-color: var(--v2-primary);
    border-radius: 50%;
    animation: v2-cat-spin 0.7s linear infinite;
}

@keyframes v2-cat-spin {
    to {
        transform: rotate(360deg);
    }
}

.v2-home-aside .v2-cat-panel__title-row, .classic-home-aside .v2-cat-panel__title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.v2-home-aside .v2-cat-panel__title-row .v2-cat-panel__title, .classic-home-aside .v2-cat-panel__title-row .v2-cat-panel__title {
    margin: 0;
}

.v2-home-aside .v2-cat-aside-toggle, .classic-home-aside .v2-cat-aside-toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-sm);
    background: #fff;
    color: var(--v2-text-secondary);
    cursor: pointer;
    padding: 0;
}

.v2-home-aside .v2-cat-aside-toggle:hover, .classic-home-aside .v2-cat-aside-toggle:hover {
    background: #f3f4f6;
    color: var(--v2-text);
}

.v2-home-aside .v2-cat-breadcrumb, .classic-home-aside .v2-cat-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
}

.v2-home-aside .v2-cat-breadcrumb[hidden], .classic-home-aside .v2-cat-breadcrumb[hidden] {
    display: none !important;
}

.v2-home-aside .v2-cat-back, .classic-home-aside .v2-cat-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    min-width: 0;
    padding: 5px 10px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--v2-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.v2-home-aside .v2-cat-back__icon, .classic-home-aside .v2-cat-back__icon {
    flex-shrink: 0;
}

.v2-home-aside .v2-cat-back__label, .classic-home-aside .v2-cat-back__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-home-aside .v2-cat-back:hover, .classic-home-aside .v2-cat-back:hover {
    background: var(--v2-primary-muted);
}

.v2-home-aside .v2-cat-current-root, .classic-home-aside .v2-cat-current-root {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--v2-text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.v2-home-aside .v2-cat-toggle--industry, .classic-home-aside .v2-cat-toggle--industry {
    color: var(--v2-text-muted);
}

.v2-home-aside .v2-cat-toggle--industry svg, .classic-home-aside .v2-cat-toggle--industry svg {
    opacity: 0.85;
}

@media (max-width: 1100px) {
    .v2-home-aside .v2-cat-panel, .classic-home-aside .v2-cat-panel {
        height: auto;
        max-height: min(55vh, 520px);
        min-height: 280px;
        border-radius: var(--v2-radius-lg);
        border-top: 1px solid var(--v2-border);
        border-bottom: 1px solid var(--v2-border);
        box-shadow: var(--v2-shadow-sm);
    }
}
