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

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #252542;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --border-color: #2a2a4a;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

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

/* 侧边栏 */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 999;
    transition: transform 0.3s ease;
}

.sidebar-header {
    margin-bottom: 32px;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 统计卡片 */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 32px;
}

/* 6列统计布局 */
.stats.six-cols {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 分类列表 */
.categories h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.category-list {
    list-style: none;
    margin-bottom: 32px;
}

.category-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 0.9rem;
    min-height: 48px;
}

.category-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.category-item.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.category-item .icon {
    margin-right: 12px;
    font-size: 1.1rem;
}

/* 侧边栏页脚 */
.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.greet-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
}

.greet-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.sidebar-footer #message {
    text-align: center;
    color: var(--accent-success);
    font-weight: 500;
    min-height: 24px;
    margin-top: 12px;
    font-size: 0.875rem;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 32px;
}

/* 顶部栏 */
.top-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 12px 44px 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
    min-height: 48px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.sort-box {
    min-width: 150px;
}

.sort-box select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
    min-height: 48px;
}

.sort-box select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.add-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.add-btn:active {
    transform: translateY(0);
}

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

/* 项目卡片 */
.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.project-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.project-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.project-icon.frontend {
    background: rgba(99, 102, 241, 0.15);
}

.project-icon.backend {
    background: rgba(245, 158, 11, 0.15);
}

.project-icon.fullstack {
    background: rgba(16, 185, 129, 0.15);
}

.project-icon.tool {
    background: rgba(139, 92, 246, 0.15);
}

.card-actions {
    display: flex;
    gap: 8px;
}

.card-actions button {
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.card-actions button:hover {
    background: var(--accent-primary);
    color: white;
}

.project-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0;
    color: var(--text-primary);
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.priority-badge {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.project-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 10px 0;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border-left: 3px solid var(--accent-primary);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
}

.card-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.project-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.project-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.project-status.planned {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.project-status.in-progress {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.project-status.completed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.project-status.maintaining {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.project-status.archived {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.project-link:hover {
    color: var(--accent-secondary);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    display: none;
}

.empty-state.show {
    display: block;
}

.empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 0.875rem;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 16px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: var(--accent-danger);
    color: white;
}

#projectForm {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
    min-height: 48px;
}

.form-group textarea {
    min-height: auto;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

.form-group textarea::placeholder {
    color: var(--text-secondary);
}

/* 进度滑块 */
.progress-slider {
    width: 100%;
    height: 8px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
}

.progress-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: var(--accent-secondary);
}

.progress-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
}

.progress-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    background: var(--accent-secondary);
}

.progress-marks {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.submit-btn:hover {
    transform: translateY(-2px);
}

/* 汉堡菜单按钮 */
.menu-toggle {
    display: none;
}

/* 侧边栏遮罩层 */
.sidebar-overlay {
    display: none;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
    }

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

@media (max-width: 768px) {
    /* 汉堡菜单按钮 */
    .menu-toggle {
        display: flex;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 1001;
        background: var(--accent-primary);
        border: none;
        border-radius: 12px;
        width: 48px;
        height: 48px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        -webkit-touch-callout: none;
        user-select: none;
        -webkit-user-select: none;
    }

    .menu-toggle span {
        width: 20px;
        height: 2px;
        background: white;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    /* 侧边栏遮罩层 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

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

    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 85%;
        max-width: 320px;
        height: 100vh;
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        padding: 24px 20px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 76px;
    }

    .sidebar-header h1 {
        font-size: 1.25rem;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stats .stat-card:nth-child(n+5) {
        display: none;
    }

    .stat-card {
        padding: 12px 8px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.688rem;
    }

    .categories h3 {
        font-size: 0.813rem;
    }

    .category-item {
        padding: 12px;
        font-size: 0.875rem;
    }

    .category-item .icon {
        margin-right: 10px;
        font-size: 1rem;
    }

    .top-bar {
        flex-direction: column;
        gap: 12px;
    }

    .search-box,
    .sort-box,
    .add-btn {
        width: 100%;
    }

    .search-box input,
    .sort-box select {
        padding: 14px 44px 14px 16px;
        font-size: 1rem;
        border-radius: 12px;
    }

    .add-btn {
        padding: 14px 24px;
        font-size: 1rem;
        border-radius: 12px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .project-card {
        padding: 20px;
    }

    .project-name {
        font-size: 1rem;
    }

    .meta-item {
        font-size: 0.75rem;
    }

    .card-actions button {
        width: 36px;
        height: 36px;
        font-size: 0.938rem;
    }

    .modal-content {
        width: 100%;
        max-width: none;
        margin: 0;
        border-radius: 20px;
        max-height: 100%;
        overflow-y: auto;
        position: relative;
    }

    .modal {
        padding: 16px;
        align-items: flex-start;
    }

    .modal-header {
        padding: 20px;
        position: sticky;
        top: 0;
        background: var(--bg-secondary);
        z-index: 10;
    }

    .modal-header h2 {
        font-size: 1.125rem;
    }

    .close-btn {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    #projectForm {
        padding: 20px;
    }

    .form-group label {
        font-size: 0.875rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 14px 16px;
        font-size: 1rem;
    }

    .submit-btn {
        padding: 16px;
        font-size: 1rem;
    }

    .empty-state {
        padding: 48px 24px;
    }

    .empty-icon {
        font-size: 3rem;
    }
}

/* 超小屏幕优化 */
@media (max-width: 375px) {
    .sidebar {
        width: 90%;
    }

    .stats {
        gap: 6px;
    }

    .stat-card {
        padding: 10px 6px;
    }

    .stat-value {
        font-size: 1.125rem;
    }

    .stat-label {
        font-size: 0.625rem;
    }

    .sidebar-header h1 {
        font-size: 1.125rem;
    }

    .category-item {
        padding: 10px 12px;
        font-size: 0.813rem;
    }

    .top-bar {
        gap: 10px;
    }

    .project-card {
        padding: 16px;
    }

    .project-name {
        font-size: 0.938rem;
    }

    .project-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .card-actions button {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    .modal-header {
        padding: 16px;
    }

    #projectForm {
        padding: 16px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .modal {
        padding: 0;
    }

    .modal-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        max-height: 100vh;
    }
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.project-card {
    animation: fadeIn 0.3s ease;
}
