* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3B82F6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-hover: #f3f4f6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-search {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.header-search input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.header-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Layout */
.app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    gap: 24px;
    flex: 1;
    width: 100%;
}

/* Sidebar */
.app-sidebar {
    width: 220px;
    flex-shrink: 0;
}

.sidebar-section {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.sidebar-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
}

.menu-item:hover {
    background: var(--bg-hover);
}

.menu-item.active {
    background: var(--primary-color);
    color: white;
    font-weight: 500;
}

/* Content */
.app-content {
    flex: 1;
    min-width: 0;
}

.content-header {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.content-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-title h2 {
    font-size: 20px;
    font-weight: 700;
}

.count {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.sort-menu {
    display: flex;
    gap: 8px;
}

.sort-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.sort-btn:hover {
    background: var(--bg-hover);
}

.sort-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Software List */
.software-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.software-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
}

.software-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.software-icon {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    overflow: hidden;
}

.software-icon img,
.software-icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.software-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.software-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.software-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.software-version {
    color: var(--text-muted);
    font-size: 14px;
}

.software-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.software-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: auto;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 13px;
}

.meta-item svg {
    width: 16px;
    height: 16px;
}

/* Loading & Empty States */
.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    background: var(--bg-primary);
    border-radius: 12px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-state p,
.empty-state p {
    margin-top: 16px;
    color: var(--text-secondary);
}

.empty-state h3 {
    margin-top: 16px;
    color: var(--text-primary);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 14px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    margin-top: 24px;
}

/* Responsive */
@media (max-width: 1024px) {
    .app-sidebar {
        width: 180px;
    }
}

@media (max-width: 768px) {
    .app-main {
        flex-direction: column;
        padding: 16px;
    }

    .app-sidebar {
        width: 100%;
    }

    .sidebar-section {
        padding: 16px;
    }

    .sidebar-menu {
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
    }

    .menu-item {
        white-space: nowrap;
    }

    .header-content {
        flex-direction: column;
        gap: 16px;
    }

    .header-search {
        max-width: 100%;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .software-card {
        flex-direction: column;
        padding: 16px;
    }

    .software-icon {
        width: 64px;
        height: 64px;
    }

    .software-name {
        font-size: 16px;
    }

    .software-meta {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: 12px;
    }

    .logo h1 {
        font-size: 16px;
    }

    .software-card {
        padding: 12px;
    }

    .software-icon {
        width: 56px;
        height: 56px;
    }
}


/* 双层分类菜单样式 */
.menu-group {
    margin-bottom: 4px;
}

.menu-parent {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.menu-parent:hover {
    background: var(--bg-hover);
}

.menu-parent .expand-icon {
    transition: transform 0.2s;
    color: var(--text-muted);
}

.menu-group.expanded .menu-parent .expand-icon {
    transform: rotate(90deg);
}

.menu-submenu {
    max-height: 0;
    overflow: hidden;
    padding-left: 12px;
}

.menu-group.expanded .menu-submenu {
    max-height: 500px;
    transition: max-height 0.3s ease-out;
}

.menu-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
    cursor: pointer;
    margin-top: 2px;
}

.menu-child:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.menu-child.active {
    background: var(--primary-color);
    color: white;
}

.count-badge {
    background: var(--bg-secondary);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.count-badge.empty {
    background: #FEF3C7;
    color: #D97706;
    font-size: 10px;
}

.menu-child.active .count-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.menu-child.menu-empty {
    opacity: 0.6;
    cursor: default;
}

.menu-child.menu-empty:hover {
    background: transparent;
}

.menu-child.menu-empty.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.menu-child.menu-empty.active .count-badge.empty {
    background: #FCD34D;
    color: #92400E;
}

/* 分页样式 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: 12px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(.disabled):not(.active) {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 500;
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-ellipsis {
    padding: 0 8px;
    color: var(--text-muted);
}

.page-info {
    margin-left: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}
