/* 分栏视图样式 */
.folder-view-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 600px;
}

.multi-column-layout {
    display: flex;
    height: 600px;
    overflow: hidden;
}

.columns-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.column {
    min-width: 250px;
    max-width: 350px;
    flex: 0 0 auto;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

.column:last-child {
    border-right: none;
}

.column-header {
    padding: 12px 16px;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
}

.column-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.column-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.column-controls label {
    color: #6b7280;
    margin: 0;
}

.form-control-small {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
}

.column-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* 分类项样式 */
.category-item {
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
}

.category-item:hover {
    background: #e5e7eb;
}

.category-item.selected {
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 500;
}

.category-item .category-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.category-item .category-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-item .category-count {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* 脚本项样式 */
.script-item {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: white;
}

.script-item:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.script-item.selected {
    background: #dbeafe;
    border-color: #3b82f6;
}

.script-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.script-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 8px;
}

.script-item-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    flex-shrink: 0;
}

.script-item-status.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.script-item-status.status-approved {
    background: #d1fae5;
    color: #065f46;
}

.script-item-status.status-rejected {
    background: #fee2e2;
    color: #991b1b;
}

.script-item-meta {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.script-item-date {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.script-item-owner {
    font-size: 11px;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 8px;
    flex-shrink: 0;
    margin-left: 8px;
}

/* 预览面板样式 */
.preview-panel {
    width: 400px;
    flex-shrink: 0;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    background: white;
}

.preview-header {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    min-height: 60px;
    display: flex;
    align-items: center;
}

.preview-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.empty-preview {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-preview-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-preview p {
    margin: 0;
    font-size: 14px;
}

/* 脚本预览卡片样式 */
.script-preview-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.script-card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.script-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}

.script-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    flex: 1;
    margin-right: 10px;
}

.script-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    flex-shrink: 0;
}

.script-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

.script-content-preview {
    padding: 15px 20px;
}

.script-preview-text {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 8;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.script-categories {
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.permission-info {
    padding: 10px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.owner-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #374151;
}

.owner-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.permission-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.permission-badge.owner {
    background: #dbeafe;
    color: #1d4ed8;
}

.permission-badge.view {
    background: #f3f4f6;
    color: #6b7280;
}

.shared-users {
    padding: 10px 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 5px;
}

.shared-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    margin-left: -5px;
}

.shared-user-avatar:first-child {
    margin-left: 0;
}

.shared-badge {
    background: #6b7280;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: 5px;
}

.script-actions {
    padding: 15px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f8f9fa;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* 保持原有的预览样式作为备用 */
.script-preview-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.script-preview-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.script-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
}

.script-preview-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.script-preview-body {
    padding: 16px;
}

.script-preview-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.script-preview-categories {
    margin-bottom: 16px;
}

.script-preview-categories h5 {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 8px 0;
}

.script-preview-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-info {
    background: #3b82f6;
    color: white;
}

.btn-info:hover {
    background: #2563eb;
}

.btn-primary {
    background: #1d4ed8;
    color: white;
}

.btn-primary:hover {
    background: #1e40af;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* 加载状态 */
.loading-small {
    text-align: center;
    padding: 20px;
    color: #9ca3af;
    font-size: 14px;
}

/* 空状态 */
.empty-state-small {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

.empty-state-small .empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-small p {
    margin: 0;
    font-size: 14px;
}

/* 视图切换按钮样式 */
.view-toggle-buttons {
    display: flex;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
}

.view-toggle-btn {
    padding: 8px 12px;
    border: none;
    background: white;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    border-right: 1px solid #d1d5db;
}

.view-toggle-btn:last-child {
    border-right: none;
}

.view-toggle-btn:hover {
    background: #f9fafb;
    color: #374151;
}

.view-toggle-btn.active {
    background: #3b82f6;
    color: white;
}

.view-toggle-btn svg {
    width: 14px;
    height: 14px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .column {
        min-width: 200px;
        max-width: 280px;
    }
    
    .preview-panel {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .multi-column-layout {
        flex-direction: column;
        height: auto;
    }
    
    .columns-container {
        flex-direction: column;
        max-height: 400px;
        overflow-y: auto;
    }
    
    .column {
        min-width: auto;
        max-width: none;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .column:last-child {
        border-bottom: none;
    }
    
    .preview-panel {
        width: auto;
        border-left: none;
        border-top: 1px solid #e5e7eb;
        max-height: 400px;
    }
    
    .view-controls {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px !important;
    }
    
    .view-toggle-buttons {
        width: 100%;
    }
    
    .view-toggle-btn {
        flex: 1;
        justify-content: center;
    }
}



/* 分组标题样式 */
.group-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin: 4px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    cursor: default;
    user-select: none;
}

.group-header .group-icon {
    margin-right: 8px;
    font-size: 14px;
}

.group-header .group-name {
    flex: 1;
    font-weight: 600;
}

/* 分组内脚本项目的缩进 */
.script-item[data-group-key] {
    margin-left: 12px;
    border-left: 2px solid #e9ecef;
}


/* 分类标签样式 */
.category-tag {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 6px;
    margin-bottom: 4px;
}

/* 状态样式 */
.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-approved {
    background: #d1fae5;
    color: #065f46;
}

.status-rejected {
    background: #fee2e2;
    color: #991b1b;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .folder-view-container {
        flex-direction: column;
    }
    
    .column {
        min-width: 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }
    
    .preview-panel {
        min-width: 100%;
        max-width: 100%;
    }
}



/* 脚本预览卡片样式 - 与卡片视图保持一致 */
.script-preview-card {
    position: relative;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 0;
    padding: 0;
    transition: all 0.2s ease;
    overflow: visible;
    min-height: 200px;
    width: 100%;
}

.script-preview-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* 权限信息区域 - 与卡片视图完全一致 */
.script-preview-card .permission-info {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 1000 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 6px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    padding: 8px 10px !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    min-width: 100px !important;
    backdrop-filter: blur(4px) !important;
}

/* 归属信息 */
.script-preview-card .owner-info {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 12px !important;
    color: #4b5563 !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
}

.script-preview-card .owner-avatar {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.script-preview-card .permission-badge {
    display: inline-block !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: white !important;
    text-align: center !important;
    white-space: nowrap !important;
    min-width: 50px !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

/* 所有者标签 - 紫色渐变 */
.script-preview-card .permission-badge.owner {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.4) !important;
}

/* 可编辑标签 - 绿色渐变 */
.script-preview-card .permission-badge.edit {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4) !important;
}

/* 可查看标签 - 蓝色渐变 */
.script-preview-card .permission-badge.view {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4) !important;
}

/* 脚本卡片内容区域 */
.script-preview-card .script-content-wrapper {
    padding: 16px !important;
    padding-right: 130px !important; /* 为权限信息留出足够空间 */
}

/* 脚本标题区域 */
.script-preview-card .script-header {
    margin-bottom: 12px !important;
    padding-right: 0 !important;
}

.script-preview-card .script-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #111827 !important;
    line-height: 1.4 !important;
    margin-bottom: 4px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* 脚本元信息 */
.script-preview-card .script-meta {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 12px !important;
    font-size: 14px !important;
    color: #6b7280 !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.script-preview-card .script-status {
    padding: 4px 8px !important;
    border-radius: 16px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
}

.script-preview-card .script-status.status-pending {
    background-color: #fef3c7 !important;
    color: #92400e !important;
}

.script-preview-card .script-status.status-approved {
    background-color: #d1fae5 !important;
    color: #047857 !important;
}

.script-preview-card .script-status.status-rejected {
    background-color: #fee2e2 !important;
    color: #b91c1c !important;
}

/* 脚本内容预览 */
.script-preview-card .script-content {
    margin-bottom: 16px !important;
}

.script-preview-card .script-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
    max-height: 150px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* 操作按钮区域 - 自适应单行显示 */
.script-preview-card .script-actions {
    display: flex !important;
    gap: 6px !important;
    flex-wrap: nowrap !important; /* 强制单行显示 */
    overflow-x: auto !important; /* 如果按钮太多，允许水平滚动 */
    padding: 12px 0 0 0 !important;
    border-top: 1px solid #e5e7eb !important;
    margin-top: 12px !important;
}

.script-preview-card .script-actions .btn {
    flex-shrink: 0 !important; /* 防止按钮被压缩 */
    padding: 6px 10px !important; /* 稍微减小按钮内边距 */
    font-size: 11px !important; /* 稍微减小字体 */
    border-radius: 4px !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
}

.script-preview-card .script-actions .btn-primary {
    background: #3b82f6 !important;
    color: white !important;
}

.script-preview-card .script-actions .btn-secondary {
    background: #6b7280 !important;
    color: white !important;
}

.script-preview-card .script-actions .btn-info {
    background: #06b6d4 !important;
    color: white !important;
}

.script-preview-card .script-actions .btn-success {
    background: #10b981 !important;
    color: white !important;
}

.script-preview-card .script-actions .btn-danger {
    background: #ef4444 !important;
    color: white !important;
}

.script-preview-card .script-actions .btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}


/* 脚本状态按钮容器 */
.script-status-container {
    padding: 8px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
}

/* 脚本状态按钮样式 */
.script-status-btn {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.script-status-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.script-status-btn.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.script-status-btn.status-approved {
    background: #d1fae5;
    color: #065f46;
}

.script-status-btn.status-rejected {
    background: #fee2e2;
    color: #991b1b;
}

/* 优化权限信息区域 */
.permission-info {
    padding: 8px 20px !important;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    min-height: 36px !important;
}

.owner-info {
    display: flex;
    align-items: center;
    gap: 6px !important;
    font-size: 0.8rem !important;
    color: #374151;
    flex: 1;
}

.owner-avatar {
    width: 18px !important;
    height: 18px !important;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
}

.permission-badge {
    padding: 2px 6px !important;
    border-radius: 10px;
    font-size: 0.65rem !important;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}

/* 优化脚本内容预览区域 */
.script-content-preview {
    padding: 12px 20px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.script-preview-text {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
    color: #334155;
    height: 200px; /* 固定高度 */
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

/* 只针对分栏视图的按钮样式优化 */
.preview-panel .script-actions {
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f8f9fa;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.preview-panel .script-actions .btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.2;
}

.preview-panel .script-actions .btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

