/* ==================== CSS 变量 & 重置 ==================== */
:root {
    --primary: #7C3AED;
    --primary-light: #A78BFA;
    --primary-dark: #5B21B6;
    --accent: #EC4899;
    --bg: #F8FAFC;
    --bg-card: #FFFFFF;
    --text: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -4px rgba(0,0,0,0.04);
    --sidebar-width: 240px;
    --topbar-height: 64px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea { font-family: inherit; }

/* ==================== 登录/注册页面 ==================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.auth-bg__circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    animation: float 20s infinite ease-in-out;
}
.auth-bg__circle--1 { width: 400px; height: 400px; top: -100px; right: -100px; animation-delay: 0s; }
.auth-bg__circle--2 { width: 300px; height: 300px; bottom: -80px; left: -80px; animation-delay: -7s; }
.auth-bg__circle--3 { width: 200px; height: 200px; top: 50%; left: 60%; animation-delay: -14s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    z-index: 1;
}

.auth-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.auth-card__logo { text-align: center; margin-bottom: 32px; }
.logo-icon {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
}
.auth-card__logo h1 {
    font-size: 24px; font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-card__logo p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* ==================== 表单 ==================== */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input {
    width: 100%; padding: 12px 16px;
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-size: 15px; color: var(--text);
    transition: var(--transition); background: var(--bg);
    outline: none;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    background: #fff;
}
.form-input--textarea { min-height: 80px; resize: vertical; }
.form-error {
    padding: 10px 14px; background: #FEF2F2; color: var(--danger);
    border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px;
}

/* ==================== 按钮 ==================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}
.btn--primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,58,237,0.4); }
.btn--ghost {
    color: var(--text-secondary); background: transparent;
}
.btn--ghost:hover { background: var(--border-light); color: var(--text); }
.btn--full { width: 100%; }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #DC2626; }
.btn--danger-outline { border: 1px solid var(--danger); color: var(--danger); }
.btn--danger-outline:hover { background: #FEF2F2; }

/* ==================== 登录页底部 ==================== */
.auth-footer {
    text-align: center; margin-top: 24px; padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 14px; color: var(--text-secondary);
}
.auth-link { color: var(--primary); font-weight: 600; }
.auth-link:hover { text-decoration: underline; }

/* ==================== 应用布局 ==================== */
.app-layout {
    display: flex; flex-direction: column; min-height: 100vh;
}

/* 顶部导航 */
.topbar {
    height: var(--topbar-height); background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; position: sticky; top: 0; z-index: 100;
}
.topbar__logo {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 18px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.topbar__right { display: flex; align-items: center; gap: 16px; }
.user-badge {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 12px 4px 4px; border-radius: 20px;
    background: var(--border-light);
}
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.user-badge span { font-size: 14px; font-weight: 500; }

/* ==================== 左侧边栏 ==================== */
.sidebar {
    width: var(--sidebar-width); background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: var(--topbar-height); bottom: 0;
    padding: 20px 0; overflow-y: auto;
}
.sidebar__section { flex: 1; }
.sidebar__title {
    font-size: 11px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px;
    padding: 0 20px; margin-bottom: 12px;
}
.sidebar__item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; cursor: pointer;
    color: var(--text-secondary); font-size: 14px; font-weight: 500;
    transition: var(--transition); border-left: 3px solid transparent;
}
.sidebar__item:hover {
    background: var(--border-light); color: var(--text);
}
.sidebar__item--active {
    background: linear-gradient(90deg, rgba(124,58,237,0.08), transparent);
    color: var(--primary); border-left-color: var(--primary);
    font-weight: 600;
}
.sidebar__icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar__count {
    margin-left: auto; background: var(--border-light);
    padding: 2px 8px; border-radius: 10px;
    font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.sidebar__item--active .sidebar__count {
    background: rgba(124,58,237,0.1); color: var(--primary);
}
.sidebar__footer {
    padding: 16px 20px; border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-muted);
}

/* ==================== 主内容区 ==================== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 24px; min-height: calc(100vh - var(--topbar-height));
}

/* 工具栏 */
.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.toolbar__title {
    font-size: 24px; font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.toolbar__right { display: flex; align-items: center; gap: 12px; }

/* 搜索框 */
.search-box {
    position: relative;
}
.search-box__icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; color: var(--text-muted);
}
.search-box__input {
    padding: 10px 16px 10px 40px;
    border: 2px solid var(--border); border-radius: var(--radius);
    font-size: 14px; width: 260px;
    transition: var(--transition); outline: none; background: var(--bg-card);
}
.search-box__input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
    width: 320px;
}

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

.project-card {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); overflow: hidden;
    transition: var(--transition);
}
.project-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}
.project-card__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--border-light);
}
.project-card__type {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; padding: 3px 10px; border-radius: 20px;
}
.project-card__type--script { background: rgba(124,58,237,0.1); color: var(--primary); }
.project-card__type--storyboard { background: rgba(236,72,153,0.1); color: var(--accent); }

.project-card__status {
    font-size: 11px; font-weight: 600;
    padding: 3px 10px; border-radius: 20px;
}
.project-card__status--draft { background: #F1F5F9; color: var(--text-muted); }
.project-card__status--in_progress { background: #FEF3C7; color: #D97706; }
.project-card__status--completed { background: #D1FAE5; color: #059669; }

.project-card__body { padding: 20px 16px; }
.project-card__name {
    font-size: 16px; font-weight: 700; margin-bottom: 6px;
    color: var(--text);
}
.project-card__desc {
    font-size: 13px; color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.project-card__footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-top: 1px solid var(--border-light);
}
.project-card__meta {
    display: flex; gap: 12px; font-size: 12px; color: var(--text-muted);
}
.project-card__actions { display: flex; gap: 4px; }

.action-btn {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); color: var(--text-muted);
    transition: var(--transition);
}
.action-btn:hover { background: var(--border-light); color: var(--text); }
.action-btn--danger:hover { background: #FEF2F2; color: var(--danger); }

/* ==================== 空状态 ==================== */
.empty-state {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 80px 20px; text-align: center;
}
.empty-state svg { margin-bottom: 24px; color: var(--text-muted); opacity: 0.4; }
.empty-state h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { color: var(--text-muted); margin-bottom: 24px; }
.empty-small { text-align: center; color: var(--text-muted); padding: 16px; font-size: 13px; }

/* ==================== 模态框 ==================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; visibility: hidden;
    transition: var(--transition);
}
.modal-overlay.modal--open { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-card); border-radius: var(--radius-lg);
    width: 90%; max-width: 520px; max-height: 90vh;
    overflow-y: auto; box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    transform: scale(0.95) translateY(10px);
    transition: var(--transition);
}
.modal--open .modal { transform: scale(1) translateY(0); }
.modal--wide { max-width: 600px; }
.modal--sm { max-width: 400px; }

.modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 18px; font-weight: 700; }
.modal__close {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); font-size: 20px; color: var(--text-muted);
    transition: var(--transition);
}
.modal__close:hover { background: var(--border-light); color: var(--text); }
.modal__body { padding: 24px; }
.modal__footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 16px 24px; border-top: 1px solid var(--border);
}

/* ==================== 类型选择器 ==================== */
.type-selector {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.type-option input { display: none; }
.type-option__card {
    padding: 20px 16px; border: 2px solid var(--border);
    border-radius: var(--radius); text-align: center;
    transition: var(--transition); cursor: pointer;
}
.type-option__card svg { color: var(--text-muted); margin-bottom: 8px; }
.type-option__card span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.type-option__card p { font-size: 12px; color: var(--text-muted); margin: 0; }
.type-option.active .type-option__card {
    border-color: var(--primary);
    background: rgba(124,58,237,0.04);
}
.type-option.active .type-option__card svg { color: var(--primary); }

/* ==================== 协作 ==================== */
.collab-search { margin-bottom: 16px; }
.collab-results { margin-bottom: 16px; }
.collab-user {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    cursor: pointer; transition: var(--transition);
}
.collab-user:hover { background: var(--border-light); }
.collab-user__avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.collab-user__info { flex: 1; min-width: 0; }
.collab-user__name {
    display: block; font-size: 14px; font-weight: 600;
    color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.collab-user__email, .collab-user__role {
    font-size: 12px; color: var(--text-muted);
}
.collab-list { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.collab-list__title {
    font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text-secondary);
}

/* ==================== Toast ==================== */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    padding: 12px 20px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; color: #fff;
    background: var(--text); z-index: 2000;
    transform: translateY(100px); opacity: 0;
    transition: var(--transition);
}
.toast--show { transform: translateY(0); opacity: 1; }
.toast--success { background: linear-gradient(135deg, #10B981, #059669); }
.toast--error { background: linear-gradient(135deg, #EF4444, #DC2626); }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar__right { flex-direction: column; }
    .search-box__input { width: 100%; }
    .search-box__input:focus { width: 100%; }
    .project-grid { grid-template-columns: 1fr; }
}
/* ... 前面的所有样式保持原样 ... */

/* 在末尾追加这几行 */
.project-card__name { cursor: pointer; transition: color 0.2s; }
.project-card__name:hover { color: var(--primary); }

/* Toast 动画优化 */
.toast--show { animation: slideIn 0.3s ease forwards; }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 修复弹窗遮挡点击问题 */
.modal-overlay {
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.modal-overlay.modal--open { pointer-events: auto; }
.project-card__name { cursor: pointer; transition: color 0.2s; }
.project-card__name:hover { color: var(--primary); }

