/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: #333;
    background: #f8f9fa;
}

/* 顶部标题栏 */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #2c3e50, #2980b9);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.header-content {
    display: flex;
    align-items: center;
    height: 100%;
    width: 100%;
    /* 确保容器占满整个顶栏宽度 */
    padding: 0 20px;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
}

.menu-toggle-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 10px;
    margin-right: 15px;
    transition: transform 0.2s ease;
}

.menu-toggle-btn:hover {
    transform: scale(1.1);
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

/* 新增：搜索框样式 */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 15px;
    color: #95a5a6;
}

#search-input {
    width: 250px;
    height: 36px;
    padding: 0 20px 0 40px;
    border: none;
    border-radius: 18px;
    background-color: #ecf0f1;
    color: #2c3e50;
    font-size: 14px;
    transition: width 0.3s ease-in-out, background-color 0.2s;
}

#search-input::placeholder {
    color: #95a5a6;
}

#search-input:focus {
    outline: none;
    width: 300px;
    background-color: #fff;
}


.logo {
    height: 40px;
    margin-right: 10px;
    filter: brightness(0) invert(1);
}

.header-title {
    font-size: 20px;
    color: white;
    margin: 0;
    font-weight: 500;
}

/* 布局容器 */
.manage-container {
    display: flex;
    height: calc(100vh - 60px);
    margin-top: 60px;
}

/* 侧边栏 */
.sidebar {
    width: 250px;
    background: white;
    border-right: 1px solid #e9ecef;
    padding: 20px;
    overflow-y: auto;
    transition: transform 0.3s ease;
    height: 100%;
}

.sidebar-nav {
    margin-bottom: 20px;
}

/* 导航组样式 */
.nav-group {
    margin-bottom: 20px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    padding: 10px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 16px;
    border-radius: 5px;
    background: #e9ecef;
    margin-bottom: 5px;
    cursor: pointer;
}

.nav-group-header i {
    margin-right: 10px;
    color: #3498db;
}

.nav-group-items {
    padding-left: 15px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    color: #495057;
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 3px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.nav-item:hover {
    background: #e9ecef;
    color: #2c3e50;
}

.nav-item.active {
    background: #3498db;
    color: white;
}

.nav-item.active i {
    color: white;
}

.nav-item i {
    margin-right: 10px;
    color: #6c757d;
    font-size: 12px;
}

/* 拖拽手柄 */
.drag-handle {
    cursor: grab;
    color: #adb5bd;
    margin-right: 10px;
    transition: color 0.2s ease;
}

.drag-handle:hover {
    color: #6c757d;
}

.drag-handle:active {
    cursor: grabbing;
}

/* 目录项样式 */
.directory-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.directory-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.directory-name {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    background: #e9ecef;
}

/* 拖拽时的视觉效果 */
.sortable-ghost {
    opacity: 0.4;
    background: #e9ecef !important;
}

.sortable-chosen {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sortable-drag {
    opacity: 0.9;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* 项目编辑器样式 */
.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px;
}

.category-name,
.category-leader {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s ease;
}

.category-name:focus,
.category-leader:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.category-leader {
    flex: 0.8;
    min-width: 120px;
}

/* 拖拽提示 */
.subdirectory-list {
    min-height: 50px;
    padding: 10px;
    border-radius: 4px;
    background: #f8f9fa;
    transition: background-color 0.2s ease;
}

.subdirectory-list:empty {
    padding: 20px;
    border: 2px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subdirectory-list:empty::after {
    content: '拖动项目到这里';
    color: #adb5bd;
    font-size: 14px;
    font-style: italic;
}

/* 拖拽时的目标区域高亮 */
.subdirectory-list.sortable-drag-enabled {
    background: #e9ecef;
    border: 2px dashed #adb5bd;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #f8f9fa;
    transition: opacity 0.3s ease;
}

/* 类别部分 */
.category-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-title {
    font-size: 24px;
    color: #2c3e50;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #3498db;
}

/* 项目网格 */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

/* 项目卡片 */
.project-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    animation: cardFadeIn 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
    cursor: pointer;
}

@keyframes cardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* 新增：卡片操作按钮容器 (与manage页面保持一致) */
.card-actions {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    display: flex;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
}

.project-card:hover .card-actions {
    opacity: 1;
    pointer-events: auto;
}

/* 新增：通用操作按钮样式 (与manage页面保持一致) */
.action-btn {
    background-color: rgba(44, 62, 80, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 10;
    /* 确保在图片上层 */
}

.action-btn:hover {
    background-color: rgba(44, 62, 80, 1);
    transform: scale(1.1);
}

/* 项目卡片图片 */
.project-image {
    width: 100%;
    padding-top: 100%;
    /* 使容器成为正方形 */
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    background: #f8f9fa;
}

.project-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 改为cover以裁剪成正方形 */
    transition: transform 0.3s ease;
    padding: 20px;
}

.project-card:hover .project-image img {
    transform: scale(1.1);
}

/* 项目卡片内容样式 */
.project-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: white;
    border-radius: 0 0 8px 8px;
}

.project-info h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #2c3e50;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-leader {
    font-size: 14px;
    color: #6c757d;
    margin: 0 0 10px 0;
}

.item-count {
    font-size: 14px;
    color: #6c757d;
    margin: 0;
}

/* 项目卡片计数器 */
.project-items {
    counter-reset: item;
}

.project-items li {
    counter-increment: item;
}

.project-items li:before {
    content: counter(item);
    background: #3498db;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: normal;
    margin-right: 12px;
}

/* 卡片状态指示器 */
.project-card {
    position: relative;
    overflow: visible;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #3498db;
    border-radius: 4px 0 0 4px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .project-items li {
        padding: 6px 10px;
        font-size: 13px;
    }

    .project-items li:before {
        width: 18px;
        height: 18px;
        font-size: 11px;
        margin-right: 10px;
    }

    .project-image {
        height: 140px;
        padding: 15px;
    }

    .project-info {
        padding: 15px;
    }
}

/* 卡片动画效果 */
.project-card {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 为不同卡片添加延迟动画 */
.project-card:nth-child(1) {
    animation-delay: 0.1s;
}

.project-card:nth-child(2) {
    animation-delay: 0.2s;
}

.project-card:nth-child(3) {
    animation-delay: 0.3s;
}

.project-card:nth-child(4) {
    animation-delay: 0.4s;
}

.project-card:nth-child(5) {
    animation-delay: 0.5s;
}

.project-card:nth-child(6) {
    animation-delay: 0.6s;
}

.project-card:nth-child(7) {
    animation-delay: 0.7s;
}

.project-card:nth-child(8) {
    animation-delay: 0.8s;
}

.project-card:nth-child(9) {
    animation-delay: 0.9s;
}

.project-card:nth-child(10) {
    animation-delay: 1s;
}

/* 管理按钮 */
.manage-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    margin-top: 20px;
}

.manage-nav-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.manage-nav-btn i {
    margin-right: 8px;
    font-size: 16px;
}

/* 按钮样式 */
.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: #e9ecef;
    color: #495057;
    transition: all 0.2s ease;
}

.btn:hover {
    background: #dee2e6;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-delete {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: #dc3545;
    color: white;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -250px;
        top: 60px;
        bottom: 0;
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(250px);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        padding: 20px;
    }

    .category-section {
        padding: 20px;
        margin-bottom: 20px;
    }

    .category-title {
        font-size: 20px;
        margin-bottom: 20px;
        padding-bottom: 12px;
    }

    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }

    .project-card {
        padding: 15px;
    }

    .project-info h3 {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .project-items li {
        font-size: 13px;
        padding: 6px 0;
    }
}

/* 加载动画 */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-container p {
    margin-top: 15px;
    color: #2c3e50;
    font-size: 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 悬浮按钮 */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #3498db;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 900;
}

.fab:hover {
    transform: scale(1.1);
    background: #2980b9;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content.large {
    max-width: 800px;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    border: none;
    background: none;
    padding: 5px;
    line-height: 1;
}

.close-button:hover {
    color: #343a40;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #495057;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 16px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 面包屑导航 */
.breadcrumb {
    margin-bottom: 20px;
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #6c757d;
}

.breadcrumb a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: #2980b9;
}

.breadcrumb .separator {
    color: #adb5bd;
}

/* 返回按钮 */
.back-button {
    display: inline-flex;
    align-items: center;
    padding: 8px 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #495057;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    margin-bottom: 20px;
}

.back-button i {
    margin-right: 8px;
}

.back-button:hover {
    background: #e9ecef;
    color: #2c3e50;
}